Re: Controlling PCF8583 clock chip with a PIC

From: John Gruenenfelder (johng_at_as.arizona.edu)
Date: 12/06/04


Date: Mon, 06 Dec 2004 13:56:39 -0700

On Sat, 04 Dec 2004 02:00:58 +0100, Jeroen wrote:
>
> "John Gruenenfelder" <johng@as.arizona.edu> wrote in message
>> I have a board set up with a PIC16F877 microcontroller and on the I2C bus
>> I have a Phillips PCF8583 clock/alarm chip.
>>
>> I am attempting to use the alarm function of this chip and thus far am
>> having almost no luck getting it to work. I know the I2C bus is good
>> because I have several other devices on it plus the clock function of this
>> chip is working fine.
>>
>> Specifically, no matter what type of alarm I instruct the chip to enable
>> (i.e. daily, weekly, etc.) none of them seem to function. I can test this
>> by checking the interrupt output pin of the chip with a scope. The
>> interrupt generation is enabled, but nothing shows on the pin.
>>
>> I realize this is rather general. My hope is that somebody else has used
>> this chip and may be able to help me with my problem. If, by any remote
>> chance, you have, please contact me or post a followup.
>>
>
> The interrupt output seems to be a open drain output... So it will only
> supply a path to ground when an interrupt is active, or high impedance when
> not; in other words, you will see nothing on your scope... Add a pull up
> resistor to VCC.

Our board is set up correctly in this respect. The pull up resistor is
there, and we have tested the power-on 50% duty cycle interrupt generated
by the 8583 which does work. It's just the interrupt that is to be
triggered by the alarm function which never occurs.

For a little more information, here is how I am setting the alarm:

  write_clk(CLOCK_CONTROL, 0x04); // stop 1Hz reset, enable alarm
  write_clk(ALARM_WEEKDAY, 0x40); // weekly alarm on weekday 6
  write_clk(ALARM_CONTROL, 0xA0); // enable weekly alarm and interrupt

The first argument is the address to write to. The ones used above are
defined as:

#define CLOCK_CONTROL 0x00
#define ALARM_CONTROL 0x08
#define ALARM_WEEKDAY 0x0E

And the function to set the alarm values is:

#define CLK_WRITE 0xA0
void
write_clk(byte address, byte data)
{
  i2c_start();
  i2c_write(CLK_WRITE);
  i2c_write(address);
  i2c_write(data);
  i2c_stop();
}

That's about it. It's really simple, but it just doesn't seem to work.
The I2C functions are verified as there are used extensively elsewhere.
The values are set properly in the clock/alarm. They can be read back and
verified.

-- 
--John Gruenenfelder    Research Assistant, Steward Observatory, U of Arizona
                        johng@as.arizona.edu
Try Weasel Reader for PalmOS  --  http://gutenpalm.sf.net
"This is the most fun I've had without being drenched in the blood
of my enemies!"
        --Sam of Sam & Max


Relevant Pages

  • Re: No interrupts coming to device driver.
    ... : coming to driver. ... I believe I configured chip (carrier freq. ... divisor) and enabled interrupt mode the same way it windows driver does. ... If it is on the ISA bus, then you can look at the IRQ line that you ...
    (freebsd-hackers)
  • Re: Audio uC Development Board
    ... Apart from "It seems to be a really nice chip"? ... The only real documentation I found was the datasheet (most similar ... The device is mising the usual ARM vectored interrupt controller, ... No DMA, so the 1MHz ADC will need to use the FIQ, and some pretty ...
    (sci.electronics.design)
  • Re: re(4) driver dropping packets when reading NFS files
    ... received that even though it couldn't send response packets. ... Actually I'm not a fan of pollingbut recontrollers might be ... I can print out the exact chip device info, ... I'll see what can be done in interrupt handler and I'll let you ...
    (freebsd-current)
  • Re: [patchset] Generic IRQ Subsystem: -V5
    ... there's an interrupt "concentrator" which consists of logically ORing ... Hence, there is no "chip" for this, and while it works with the ARM ... IRQ subsystem, it doesn't even boot with the genirq stuff. ... nzCv IRQs off FIQs on Mode SVC_32 Segment kernel ...
    (Linux-Kernel)
  • Re: [RFC patch 2/3] genirq: Add buslock support for irq chips on slow busses
    ... yet) which can use interrupts via the main interrupt controller on ... out to dedicated pins on the chip for direct connection to the CPU ... If the low level functions just store the information and schedule it ... for bus access then there is no serialization anymore. ...
    (Linux-Kernel)