Dear All,<br><br>We are<span style="font-weight: bold;"> </span>interfacing external RTC DS1307 in MPC860P(40MHz core frequency).<br>I've configured the following files in U-boot-1.1.3.<br><br>1. In i2c.c<br><br>#define CFG_I2C_SPEED 50000<br>#define CFG_I2C_SLAVE 0xFE<br><br><br>2. In include/configs/BOARD.h<br><br>#define CFG_I2C_SPEED 50000<br>#define CFG_I2C_SLAVE 0x7F<br>#define CONFIG_HARD_I2C 1<br>#define CONFIG_RTC_DS1307 1<br>#define CFG_CMD_DATE 1<br><br>In this file I commented
CONFIG_RTC_MPC8xx<br><br>3. In <board/board.h><br><br>#define CONFIG_HARD_I2C 1<br>#define CFG_I2C_SPEED 50000<br>#define CFG_I2C_SLAVE 0xFE<br><br>Is the above things correct in order to get the date and time<br>up and running in an MPC860P based custom board.<br>Anything else I need to configure !? or any code changes<br>required here?<br><br>But I'm not able to get the date and time in my board.<br>I've captured the log of i2c with debug enabled.<br>Pleas edo have a look at it & Kindly let me know where<br>I've gone wrong .<br>Thanks in advance!!!!.<br><br>The U-boot log :<br>~~~~~~~~~~~~<br><br>U-Boot 1.1.3 (May 3 2006 - 15:06:18)<br><br>CPU: XPC86xxxZPnnD4 at 40 MHz: 16 kB I-Cache 8 kB D-Cache FEC present<br>Board: Integrated Communications
Manager - Beta with MPC860P<br>UPMB Enabled for IDE<br>I2C: [I2C] Setting rate...<br> [I2C] trying hz=40000000, speed=50000, filter=0, modval=0<br> moddiv=32, brgdiv=25<br> accepted brgval=10, totspeed=48076<br> [I2C] trying hz=40000000, speed=50000, filter=0, modval=1<br> moddiv=16, brgdiv=50<br> accepted brgval=22, totspeed=50000<br> [I2C] trying hz=40000000, speed=50000, filter=0, modval=2<br> moddiv=8, brgdiv=100<br> accepted brgval=47, totspeed=50000<br> [I2C] trying hz=40000000, speed=50000, filter=0, modval=3<br> moddiv=4, brgdiv=200<br> accepted brgval=97, totspeed=50000<br>[I2C] Best is:<br>[I2C] CPU=40000000hz RATE=50000 F=0 I2MOD=00000001 I2BRG=00000016 DIFF=0hz<br>[I2C] i2mod=00000002 i2brg=00000016<br>[I2C] rbase = 0820<br>[I2C] tbase = 0840<br>[I2C] rxbd = ff002820<br>[I2C] txbd = ff002840<br>ready<br>DRAM: (16 MB SDRAM) 16 MB<br>Top of RAM usable for U-Boot at:
01000000<br>Reserving 378k for U-Boot at: 00fa1000<br>Reserving 400k for malloc() at: 00f3d000<br>Reserving 60 Bytes for Board Info at: 00f3cfc4<br>Reserving 48 Bytes for Global Data at: 00f3cf94<br>Stack Pointer at: 00f3cf78<br>New Stack Pointer is: 00f3cf78<br>Now running in RAM - U-Boot at: 00fa1000<br>FLASH: flash_protect ON: from 0xFF800000 to 0xFF829FFF<br>protect on 0<br>protect on 1<br>protect on 2<br>protect on 3<br>flash_protect ON: from 0xFF840000 to 0xFF843FFF<br>protect on 4<br> AMD-LV160-B : 8 MB<br>*** Warning - bad CRC, using default environment<br><br>[I2C] Setting rate...<br> [I2C] trying hz=40000000, speed=50000, filter=0, modval=0<br> moddiv=32, brgdiv=25<br> accepted brgval=10, totspeed=48076<br> [I2C] trying hz=40000000, speed=50000, filter=0, modval=1<br> moddiv=16, brgdiv=50<br> accepted brgval=22, totspeed=50000<br> [I2C] trying hz=40000000, speed=50000, filter=0, modval=2<br> moddiv=8,
brgdiv=100<br> accepted brgval=47, totspeed=50000<br> [I2C] trying hz=40000000, speed=50000, filter=0, modval=3<br> moddiv=4, brgdiv=200<br> accepted brgval=97, totspeed=50000<br>[I2C] Best is:<br>[I2C] CPU=40000000hz RATE=50000 F=0 I2MOD=00000001 I2BRG=00000016 DIFF=0hz<br>[I2C] i2mod=00000002 i2brg=00000016<br>[I2C] rbase = 0820<br>[I2C] tbase = 0840<br>[I2C] rxbd = ff002820<br>[I2C] txbd = ff002840<br>In: serial<br>Out: serial<br>Err: serial<br>U-Boot relocated to 00fa1000<br>Net: FEC ETHERNET<br>IDE: Bus 0: not available Status = 0x00<br>LECD: 4 Line D## main_loop entered: bootdelay=1<br><br>### main_loop: bootcmd="bootm 0xff900000"<br>Hit any key to stop autoboot: 1 0<br>## Booting image at ff900000 ...<br>Bad Magic Number<br>[ICM] $<br>[ICM] $<br>[ICM] $date<br>[I2C] Setting rate...<br> [I2C] trying hz=40000000, speed=50000, filter=0,
modval=0<br> moddiv=32, brgdiv=25<br> accepted brgval=10, totspeed=48076<br> [I2C] trying hz=40000000, speed=50000, filter=0, modval=1<br> moddiv=16, brgdiv=50<br> accepted brgval=22, totspeed=50000<br> [I2C] trying hz=40000000, speed=50000, filter=0, modval=2<br> moddiv=8, brgdiv=100<br> accepted brgval=47, totspeed=50000<br> [I2C] trying hz=40000000, speed=50000, filter=0, modval=3<br> moddiv=4, brgdiv=200<br> accepted brgval=97, totspeed=50000<br>[I2C] Best is:<br>[I2C] CPU=40000000hz RATE=50000 F=0 I2MOD=00000001 I2BRG=00000016 DIFF=0hz<br>[I2C] i2mod=00000002 i2brg=00000016<br>[I2C] rbase = 0820<br>[I2C] tbase = 0840<br>[I2C] rxbd = ff002820<br>[I2C] txbd = ff002840<br>[I2C] i2c_newio<br>[I2C] rxbd = ff002820<br>[I2C] txbd = ff002840<br>[I2C] tx_buf = ff002860<br>[I2C] i2c_send add=104 sec=00 flag=02 size=1<br>[I2C] txbd = ff002840<br>[I2C] Formatting addresses...<br>[I2C] copy data...<br>[I2C] txbd:
length=0x0002 status=0x8400 addr[0]=0xd0 addr[1]=0x00<br>[I2C] i2c_receive 104 00 04<br>[I2C] rxbd = ff002820<br>[I2C] txbd = ff002848<br>[I2C] txbd: length=0x0002 status=0xac00 addr[0]=0xd1 addr[1]=0x00<br>[I2C] rxbd: length=0x0001 status=0xa000 addr[0]=0x00 addr[1]=0xf3<br>[I2C] i2c_doio<br>[I2C] Enabling I2C...<br>[I2C] Transmitting...(txbd=0xff002848)<br> [I2C] Receiving...(rxbd=0xff002820)<br><br> 2c_read: i2c_doio failed (-1)<br>[I2C] Setting rate...<br> [I2C] trying hz=40000000, speed=50000, filter=0, modval=0<br> moddiv=32, brgdiv=25<br> accepted brgval=10, totspeed=48076<br> [I2C] trying hz=40000000, speed=50000, filter=0, modval=1<br> moddiv=16, brgdiv=50<br> accepted brgval=22, totspeed=50000<br> [I2C] trying hz=40000000, speed=50000, filter=0, modval=2<br> moddiv=8, brgdiv=100<br> accepted brgval=47, totspeed=50000<br> [I2C] trying hz=40000000, speed=50000, filter=0, modval=3<br> moddiv=4,
brgdiv=200<br> accepted brgval=97, totspeed=50000<br>[I2C] Best is:<br>[I2C] CPU=40000000hz RATE=50000 F=0 I2MOD=00000001 I2BRG=00000016 DIFF=0htz<br>[I2C] i2mod=000002 i2brgR=00000016<br>[I2CC] tbase = 0840<br>[I2C] rxbd = ff002820<br>[I2C] txbd = ff002840<br>[I2C] i2c_newio<br>[I2C] rxbd = ff002820<br>[I2C] txbd = ff002840<br>[I2C] tx_buf = ff002860<br>[I2C] i2c_send add=104 sec=00 flag=02 size=1<br>[I2C] txbd = ff002840<br>[I2C] Formatting addresses...<br>[I2C] copy data...<br>[I2C] txbd: length=0x0002 status=0x8400 addr[0]=0xd0 addr[1]=0x01<br>[I2C] i2c_receive 104 00 04<br>[I2C] rxbd = ff002820<br>[I2C] txbd = ff002848<br>[I2C] txbd: length=0x0002 status=0xac00 addr[0]=0xd1 addr[1]=0x00<br>[I2C] rxbd: length=0x0001 status=0xa000 addr[0]=0x00 addr[1]=0xf3<br>[I2C] i2c_doio<br>[I2C] Enabling I2C...<br>[I2C] Transmitting...(txbd=0xff002848)<br><br>i2c_read: i2c_doio failed (-1)<br>[I2C] Setting rate...<br> [I2C] trying hz=40000000, speed=50000, filter=0,
modval=0<br> moddiv=32, brgdiv=25<br> accepted brgval=10, totspeed=48076<br> [I2C] trying hz=40000000, speed=50000, filter=0, modval=1<br> moddiv=16, brgdiv=50<br> accepted brgval=22, totspeed=50000<br> [I2C] trying hz=40000000, speed=50000, filter=0, modval=2<br> moddiv=8, brgdiv=100<br> accepted brgval=47, totspeed=50000<br> [I2C] trying hz=40000000, speed=50000, filter=0, modval=3<br> moddiv=4, brgdiv=200<br> accepted brgval=97, totspeed=50000<br>[I2C] Best is:<br>[I2C] CPU=40000000hz RATE=50000 F=0 I2MOD=00000001 I2BRG=00000016 DIFF=0hz<br>[I2C] i2mod=00000002 i2brg=00000016<br>[I2C] rbase = 0820<br>[I2C] tbase = 0840<br>[I2C] rxbd = ff002820<br>[I2C] txbd = ff002840<br>[I2C] i2c_newio<br>[I2C] rxbd = ff002820<br>[I2C] txbd = ff002840<br>[I2C] tx_buf = ff002860<br>[I2C] i2c_send add=104 sec=00 flag=02 size=1<br>[I2C] txbd = ff002840<br>[I2C] Formatting addresses...<br>[I2C] copy data...<br>[I2C] txbd:
length=0x0002 status=0x8400 addr[0]=0xd0 addr[1]=0x02<br>[I2C] i2c_receive 104 00 04<br>[I2C] rxbd = ff002820<br>[I2C] txbd = ff002848<br>[I2C] txbd: length=0x0002 status=0xac00 addr[0]=0xd1 addr[1]=0x00<br>[I2C] rxbd: length=0x0001 status=0xa000 addr[0]=0x00 addr[1]=0xf3<br>[I2C] i2c_doio<br>[I2C] Enabling I2C...<br>[I2C] Transmitting...(txbd=0xff002848)<br><br>i2c_read: i2c_doio failed (-1)<br>[I2C] Setting rate...<br> [I2C] trying hz=40000000, speed=50000, filter=0, modval=0<br> moddiv=32, brgdiv=25<br> accepted brgval=10, totspeed=48076<br> [I2C] trying hz=40000000, speed=50000, filter=0, modval=1<br> moddiv=16, brgdiv=50<br> accepted brgval=22, totspeed=50000<br> [I2C] trying hz=40000000, speed=50000, filter=0, modval=2<br> moddiv=8, brgdiv=100<br> accepted brgval=47, totspeed=50000<br> [I2C] trying hz=40000000, speed=50000, filter=0, modval=3<br> moddiv=4, brgdiv=200<br> accepted brgval=97,
totspeed=50000<br>[I2C] Best is:<br>[I2C] CPU=40000000hz RATE=50000 F=0 I2MOD=00000001 I2BRG=00000016 DIFF=0hz<br>[I2C] i2mod=00000002 i2brg=00000016<br>[I2C] rbase = 0820<br>[I2C] tbase = 0840<br>[I2C] rxbd = ff002820<br>[I2C] txbd = ff002840<br>[I2C] i2c_newio<br>[I2C] rxbd = ff002820<br>[I2C] txbd = ff002840<br>[I2C] tx_buf = ff002860<br>[I2C] i2c_send add=104 sec=00 flag=02 size=1<br>[I2C] txbd = ff002840<br>[I2C] Formatting addresses...<br>[I2C] copy data...<br>[I2C] txbd: length=0x0002 status=0x8400 addr[0]=0xd0 addr[1]=0x03<br>[I2C] i2c_receive 104 00 04<br>[I2C] rxbd = ff002820<br>[I2C] txbd = ff002848<br>[I2C] txbd: length=0x0002 status=0xac00 addr[0]=0xd1 addr[1]=0x00<br>[I2C] rxbd: length=0x0001 status=0xa000 addr[0]=0x00 addr[1]=0xf3<br>[I2C] i2c_doio<br>[I2C] Enabling I2C...<br>[I2C] Transmitting...(txbd=0xff002848)<br>[I2C] Receiving...(rxbd=0xff002820)<br><br>i2c_read: i2c_doio failed (-1)<br>[I2C] Setting rate...<br> [I2C] trying hz=40000000,
speed=50000, filter=0, modval=0<br> moddiv=32, brgdiv=25<br> accepted brgval=10, totspeed=48076<br> [I2C] trying hz=40000000, speed=50000, filter=0, modval=1<br> moddiv=16, brgdiv=50<br> accepted brgval=22, totspeed=50000<br> [I2C] trying hz=40000000, speed=50000, filter=0, modval=2<br> moddiv=8, brgdiv=100<br> accepted brgval=47, totspeed=50000<br> [I2C] trying hz=40000000, speed=50000, filter=0, modval=3<br> moddiv=4, brgdiv=200<br> accepted brgval=97, totspeed=50000<br>[I2C] Best is:<br>[I2C] CPU=40000000hz RATE=50000 F=0 I2MOD=00000001 I2BRG=00000016 DIFF=0hz<br>[I2C] i2mod=00000002 i2brg=00000016<br>[I2C] rbase = 0820<br>[I2C] tbase = 0840<br>[I2C] rxbd = ff002820<br>[I2C] txbd = ff002840<br>[I2C] i2c_newio<br>[I2C] rxbd = ff002820<br>[I2C] txbd = ff002840<br>[I2C] tx_buf = ff002860<br>[I2C] i2c_send add=104 sec=00 flag=02 size=1<br>[I2C] txbd = ff002840<br>[I2C] Formatting addresses...<br>[I2C] copy
data...<br>[I2C] txbd: length=0x0002 status=0x8400 addr[0]=0xd0 addr[1]=0x04<br>[I2C] i2c_receive 104 00 04<br>[I2C] rxbd = ff002820<br>[I2C] txbd = ff002848<br>[I2C] txbd: length=0x0002 status=0xac00 addr[0]=0xd1 addr[1]=0x00<br>[I2C] rxbd: length=0x0001 status=0xa000 addr[0]=0x00 addr[1]=0xf3<br>[I2C] i2c_doio<br>[I2C] Enabling I2C...<br>[I2C] Transmitting...(txbd=0xff002848)<br>[I2C] Receiving...(rxbd=0xff002820)<br><br>i2c_read: i2c_doio failed (-1)<br>[I2C] Setting rate...<br> [I2C] trying hz=40000000, speed=50000, filter=0, modval=0<br> moddiv=32, brgdiv=25<br> accepted brgval=10, totspeed=48076<br> [I2C] trying hz=40000000, speed=50000, filter=0, modval=1<br> moddiv=16, brgdiv=50<br> accepted brgval=22, totspeed=50000<br> [I2C] trying hz=40000000, speed=50000, filter=0, modval=2<br> moddiv=8, brgdiv=100<br> accepted brgval=47, totspeed=50000<br> [I2C] trying hz=40000000, speed=50000, filter=0,
modval=3<br> moddiv=4, brgdiv=200<br> accepted brgval=97, totspeed=50000<br>[I2C] Best is:<br>[I2C] CPU=40000000hz RATE=50000 F=0 I2MOD=00000001 I2BRG=00000016 DIFF=0hz<br>[I2C] i2mod=00000002 i2brg=00000016<br>[I2C] rbase = 0820<br>[I2C] tbase = 0840<br>[I2C] rxbd = ff002820<br>[I2C] txbd = ff002840<br>[I2C] i2c_newio<br>[I2C] rxbd = ff002820<br>[I2C] txbd = ff002840<br>[I2C] tx_buf = ff002860<br>[I2C] i2c_send add=104 sec=00 flag=02 size=1<br>[I2C] txbd = ff002840<br>[I2C] Formatting addresses...<br>[I2C] copy data...<br>[I2C] txbd: length=0x0002 status=0x8400 addr[0]=0xd0 addr[1]=0x05<br>[I2C] i2c_receive 104 00 04<br>[I2C] rxbd = ff002820<br>[I2C] txbd = ff002848<br>[I2C] txbd: length=0x0002 status=0xac00 addr[0]=0xd1 addr[1]=0x00<br>[I2C] rxbd: length=0x0001 status=0xa000 addr[0]=0x00 addr[1]=0xf3<br>[I2C] i2c_doio<br>[I2C] Enabling I2C...<br>[I2C] Transmitting...(txbd=0xff002848)<br><br>i2c_read: i2c_doio failed (-1)<br>[I2C] Setting
rate...<br> [I2C] trying hz=40000000, speed=50000, filter=0, modval=0<br> moddiv=32, brgdiv=25<br> accepted brgval=10, totspeed=48076<br> [I2C] trying hz=40000000, speed=50000, filter=0, modval=1<br> moddiv=16, brgdiv=50<br> accepted brgval=22, totspeed=50000<br> [I2C] trying hz=40000000, speed=50000, filter=0, modval=2<br> moddiv=8, brgdiv=100<br> accepted brgval=47, totspeed=50000<br> [I2C] trying hz=40000000, speed=50000, filter=0, modval=3<br> moddiv=4, brgdiv=200<br> accepted brgval=97, totspeed=50000<br>[I2C] Best is:<br>[I2C] CPU=40000000hz RATE=50000 F=0 I2MOD=00000001 I2BRG=00000016 DIFF=0hz<br>[I2C] i2mod=00000002 i2brg=00000016<br>[I2C] rbase = 0820<br>[I2C] tbase = 0840<br>[I2C] rxbd = ff002820<br>[I2C] txbd = ff002840<br>[I2C] i2c_newio<br>[I2C] rxbd = ff002820<br>[I2C] txbd = ff002840<br>[I2C] tx_buf = ff002860<br>[I2C] i2c_send add=104 sec=00 flag=02 size=1<br>[I2C] txbd = ff002840<br>[I2C]
Formatting addresses...<br>[I2C] copy data...<br>[I2C] txbd: length=0x0002 status=0x8400 addr[0]=0xd0 addr[1]=0x06<br>[I2C] i2c_receive 104 00 04<br>[I2C] rxbd = ff002820<br>[I2C] txbd = ff002848<br>[I2C] txbd: length=0x0002 status=0xac00 addr[0]=0xd1 addr[1]=0x00<br>[I2C] rxbd: length=0x0001 status=0xa000 addr[0]=0x00 addr[1]=0xf3<br>[I2C] i2c_doio<br>[I2C] Enabling I2C...<br>[I2C] Transmitting...(txbd=0xff002848)<br>[I2C] Receiving...(rxbd=0xff002820)<br><br>i2c_read: i2c_doio failed (-1)<br>Get RTC year: 00 mon: 00 mday: 00 wday: 00 hr: 00 min: 00 sec: 00<br>Get DATE: 2000-00-00 (wday=7) TIME: 0:00:00<br>Date: 2000-00-00 (unknown day) Time: 0:00:00<br>[ICM] $i2cinfo<br>I2MOD = 03 I2ADD = fe<br>I2BRG = 16 I2COM = 01<br>I2CER = 10 I2CMR = 00<br>RBASE = 00000820 TBASE = 00000840<br>RFCR = 10 TFCR = 10<br>MRBLR = 0080<br>RSTATE=
00000000 RDP = 61cf2623<br>RBPTR = 0820 RBC = c6ef<br>RXTMP = bd65484e<br>TSTATE= 10000000 TDP = ff002864<br>TBPTR = 0840 TBC = 0001<br>TXTMP = d10057e2<br>[ICM] $<br>I2MOD = 03 I2ADD = fe<br>I2BRG = 16 I2COM = 01<br>I2CER = 10 I2CMR = 00<br>RBASE = 00000820 TBASE = 00000840<br>RFCR = 10 TFCR = 10<br>MRBLR = 0080<br>RSTATE= 00000000 RDP = 61cf2623<br>RBPTR = 0820 RBC = c6ef<br>RXTMP = bd65484e<br>TSTATE= 10000000 TDP = ff002864<br>TBPTR = 0840 TBC = 0001<br>TXTMP = d10057e2<br>02840<br>[I2C] Formatting addresses...<br>[I2C] copy data...<br>[I2C] txbd: length=0x0002 status=0x8400
addr[0]=0xd0 addr[1]=0x05<br>[I2C] i2c_receive 104 00 04<br>[I2C] rxbd = ff002820<br>[I2C] txbd = ff002848<br>[I2C] txbd: length=0x0002 status=0xac00 addr[0]=0xd1 addr[1]=0x00<br>[I2C] rxbd: length=0x0001 status=0xa000 addr[0]=0x00 addr[1]=0x00<br>[I2C] i2c_doio<br>[I2C] Enabling I2C...<br>[I2C] Transmitting...(txbd=0xff002848)<br>[I2C] Receiving...(rxbd=0xff002820)<br>[I2C] Receiving...(rxbd=0xff002820)<br>i2c_read: i2c_doio failed (-1)<br>[I2C] Setting rate...<br> [I2C] trying hz=40000000, speed=50000, filter=0, modval=0<br> moddiv=32, brgdiv=25<br> accepted brgval=10, totspeed=48076<br> [I2C] trying hz=40000000, speed=50000, filter=0, modval=1<br> moddiv=16, brgdiv=50<br> accepted brgval=22, totspeed=50000<br> [I2C] trying hz=40000000, speed=50000, filter=0, modval=2<br> moddiv=8, brgdiv=100<br> accepted brgval=47, totspeed=50000<br> [I2C] trying hz=40000000, speed=50000, filter=0, modval=3<br> moddiv=4,
brgdiv=200<br> accepted brgval=97, totspeed=50000<br><br><br>Regards,<br><br>ganesh<br><br><p>
                <hr size=1>Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. <a href="http://us.rd.yahoo.com/mail_us/taglines/postman7/*http://us.rd.yahoo.com/evt=39666/*http://messenger.yahoo.com"> Great rates starting at 1¢/min.