View previous topic :: View next topic |
Author |
Message |
Fabri
Joined: 22 Aug 2005 Posts: 275
|
Burst Transient and I2C bus |
Posted: Thu Feb 22, 2007 11:29 am |
|
|
Hi,
I've a problem with RTC PCF8563 and Burst transient.
My micro read rtc every 100us and after a burst on power supply I found the date and time changed. The new date and time isn't bcd format and really strange.
I tryed to supply PCF with only battery but the problem remain.
The micro don't do any kind of reset during test and all seem work fine.
Some any idea about ?
Regards,
Fabri |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Feb 22, 2007 1:56 pm |
|
|
Put a 0.1 uF (100 nF) capacitor between the Vdd pin and ground
on both the PIC and the PCF8563 chip. Put the capacitors very
close to the Vdd pins.
Add at least a 10 uF (16v) Tantalum capacitor on the output of your
voltage regulator. Use Tantalum, not Aluminum Electrolytic. |
|
|
Fabri
Joined: 22 Aug 2005 Posts: 275
|
|
Posted: Thu Feb 22, 2007 2:47 pm |
|
|
Hi PCM,
I did it, in my layout there's capacitors really near PIC18 and PCF8563.
Any other suggestion ?
Regards, |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Feb 22, 2007 2:56 pm |
|
|
Quote: | My micro read rtc every 100us |
Are you really trying to read the date and time every 100 us ?
Try changing it to every 1 second. |
|
|
Fabri
Joined: 22 Aug 2005 Posts: 275
|
|
Posted: Thu Feb 22, 2007 3:13 pm |
|
|
I'm sorry,
I read RTC every 100ms. I used the same way in other software with PIC16 in assembler without any problem. I read only one register at time.
Do you think I read many time the RTC ? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Feb 22, 2007 3:16 pm |
|
|
What driver program are you using to talk to the PCF8563 ?
Did you write it, or is it available on the net ? |
|
|
Fabri
Joined: 22 Aug 2005 Posts: 275
|
|
Posted: Thu Feb 22, 2007 3:36 pm |
|
|
Hi,
I wrote the driver by myself using datasheet of PCF8563 and after wrote the assembler one.
I use this routine to read every single register of PCF8563
Code: |
#use I2C(MASTER,sda=PIN_C4,scl=PIN_C3,FORCE_HW,slow,RESTART_WDT)
#define address_rtc_read 0b10100011
#define address_rtc_write 0b10100010
int read_rtc_register(int address_rtc){
int dato_locazione_rtc;
int mo;
i2c_start();
i2c_write(address_rtc_write);
i2c_write(address_rtc);
i2c_start();
i2c_write(address_rtc_read);
dato_locazione_rtc =i2c_read();
mo=i2c_read(0);
i2c_stop();
return dato_locazione_rtc;
}
|
|
|
|
|