[U-Boot-Users] External RTC in MPC860P (i2c - rtc DS1307)

Anand Mallya signetbangalore at yahoo.com
Wed May 10 14:21:58 CEST 2006


Dear All,

We are interfacing external RTC DS1307 in MPC860P(40MHz core frequency).
I've configured the following files in U-boot-1.1.3.

1.    In i2c.c

#define    CFG_I2C_SPEED        50000
#define    CFG_I2C_SLAVE         0xFE


2.    In  include/configs/BOARD.h

#define    CFG_I2C_SPEED        50000
#define    CFG_I2C_SLAVE         0x7F
#define    CONFIG_HARD_I2C       1
#define    CONFIG_RTC_DS1307   1
#define    CFG_CMD_DATE           1

In this file I commented CONFIG_RTC_MPC8xx

3.    In <board/board.h>

#define    CONFIG_HARD_I2C       1
#define    CFG_I2C_SPEED        50000
#define    CFG_I2C_SLAVE         0xFE

Is the above things correct in order to get the date and time
up and running in an MPC860P based custom board.
Anything else I need to configure !? or any code changes
required here?

But I'm not able to get the date and time in my board.
I've captured the log of i2c with debug enabled.
Pleas edo have a look at it & Kindly let me know where
I've gone wrong .
Thanks in advance!!!!.

The U-boot log :
~~~~~~~~~~~~

U-Boot 1.1.3 (May  3 2006 - 15:06:18)

CPU:   XPC86xxxZPnnD4 at 40 MHz: 16 kB I-Cache 8 kB D-Cache FEC present
Board: Integrated Communications Manager - Beta  with MPC860P
UPMB Enabled for IDE
I2C:   [I2C] Setting rate...
 [I2C] trying hz=40000000, speed=50000, filter=0, modval=0
  moddiv=32, brgdiv=25
  accepted brgval=10, totspeed=48076
 [I2C] trying hz=40000000, speed=50000, filter=0, modval=1
  moddiv=16, brgdiv=50
  accepted brgval=22, totspeed=50000
 [I2C] trying hz=40000000, speed=50000, filter=0, modval=2
  moddiv=8, brgdiv=100
  accepted brgval=47, totspeed=50000
 [I2C] trying hz=40000000, speed=50000, filter=0, modval=3
  moddiv=4, brgdiv=200
  accepted brgval=97, totspeed=50000
[I2C] Best is:
[I2C] CPU=40000000hz RATE=50000 F=0 I2MOD=00000001 I2BRG=00000016 DIFF=0hz
[I2C] i2mod=00000002 i2brg=00000016
[I2C] rbase = 0820
[I2C] tbase = 0840
[I2C] rxbd = ff002820
[I2C] txbd = ff002840
ready
DRAM:  (16 MB SDRAM) 16 MB
Top of RAM usable for U-Boot at: 01000000
Reserving 378k for U-Boot at: 00fa1000
Reserving 400k for malloc() at: 00f3d000
Reserving 60 Bytes for Board Info at: 00f3cfc4
Reserving 48 Bytes for Global Data at: 00f3cf94
Stack Pointer at: 00f3cf78
New Stack Pointer is: 00f3cf78
Now running in RAM - U-Boot at: 00fa1000
FLASH: flash_protect ON: from 0xFF800000 to 0xFF829FFF
protect on 0
protect on 1
protect on 2
protect on 3
flash_protect ON: from 0xFF840000 to 0xFF843FFF
protect on 4
 AMD-LV160-B : 8 MB
*** Warning - bad CRC, using default environment

[I2C] Setting rate...
 [I2C] trying hz=40000000, speed=50000, filter=0, modval=0
  moddiv=32, brgdiv=25
  accepted brgval=10, totspeed=48076
 [I2C] trying hz=40000000, speed=50000, filter=0, modval=1
  moddiv=16, brgdiv=50
  accepted brgval=22, totspeed=50000
 [I2C] trying hz=40000000, speed=50000, filter=0, modval=2
  moddiv=8, brgdiv=100
  accepted brgval=47, totspeed=50000
 [I2C] trying hz=40000000, speed=50000, filter=0, modval=3
  moddiv=4, brgdiv=200
  accepted brgval=97, totspeed=50000
[I2C] Best is:
[I2C] CPU=40000000hz RATE=50000 F=0 I2MOD=00000001 I2BRG=00000016 DIFF=0hz
[I2C] i2mod=00000002 i2brg=00000016
[I2C] rbase = 0820
[I2C] tbase = 0840
[I2C] rxbd = ff002820
[I2C] txbd = ff002840
In:    serial
Out:   serial
Err:   serial
U-Boot relocated to 00fa1000
Net:   FEC ETHERNET
IDE:   Bus 0: not available  Status = 0x00
LECD:    4 Line D## main_loop entered: bootdelay=1

### main_loop: bootcmd="bootm 0xff900000"
Hit any key to stop autoboot:  1  0
## Booting image at ff900000 ...
Bad Magic Number
[ICM] $
[ICM] $
[ICM] $date
[I2C] Setting rate...
 [I2C] trying hz=40000000, speed=50000, filter=0, modval=0
  moddiv=32, brgdiv=25
  accepted brgval=10, totspeed=48076
 [I2C] trying hz=40000000, speed=50000, filter=0, modval=1
  moddiv=16, brgdiv=50
  accepted brgval=22, totspeed=50000
 [I2C] trying hz=40000000, speed=50000, filter=0, modval=2
  moddiv=8, brgdiv=100
  accepted brgval=47, totspeed=50000
 [I2C] trying hz=40000000, speed=50000, filter=0, modval=3
  moddiv=4, brgdiv=200
  accepted brgval=97, totspeed=50000
[I2C] Best is:
[I2C] CPU=40000000hz RATE=50000 F=0 I2MOD=00000001 I2BRG=00000016 DIFF=0hz
[I2C] i2mod=00000002 i2brg=00000016
[I2C] rbase = 0820
[I2C] tbase = 0840
[I2C] rxbd = ff002820
[I2C] txbd = ff002840
[I2C] i2c_newio
[I2C] rxbd = ff002820
[I2C] txbd = ff002840
[I2C] tx_buf = ff002860
[I2C] i2c_send add=104 sec=00 flag=02 size=1
[I2C] txbd = ff002840
[I2C] Formatting addresses...
[I2C] copy data...
[I2C] txbd: length=0x0002 status=0x8400 addr[0]=0xd0 addr[1]=0x00
[I2C] i2c_receive 104 00 04
[I2C] rxbd = ff002820
[I2C] txbd = ff002848
[I2C] txbd: length=0x0002 status=0xac00 addr[0]=0xd1 addr[1]=0x00
[I2C] rxbd: length=0x0001 status=0xa000 addr[0]=0x00 addr[1]=0xf3
[I2C] i2c_doio
[I2C] Enabling I2C...
[I2C] Transmitting...(txbd=0xff002848)
 [I2C] Receiving...(rxbd=0xff002820)

 2c_read: i2c_doio failed (-1)
[I2C] Setting rate...
 [I2C] trying hz=40000000, speed=50000, filter=0, modval=0
  moddiv=32, brgdiv=25
  accepted brgval=10, totspeed=48076
 [I2C] trying hz=40000000, speed=50000, filter=0, modval=1
  moddiv=16, brgdiv=50
  accepted brgval=22, totspeed=50000
 [I2C] trying hz=40000000, speed=50000, filter=0, modval=2
  moddiv=8, brgdiv=100
  accepted brgval=47, totspeed=50000
 [I2C] trying hz=40000000, speed=50000, filter=0, modval=3
  moddiv=4, brgdiv=200
  accepted brgval=97, totspeed=50000
[I2C] Best is:
[I2C] CPU=40000000hz RATE=50000 F=0 I2MOD=00000001 I2BRG=00000016 DIFF=0htz
[I2C] i2mod=000002 i2brgR=00000016
[I2CC] tbase = 0840
[I2C] rxbd = ff002820
[I2C] txbd = ff002840
[I2C] i2c_newio
[I2C] rxbd = ff002820
[I2C] txbd = ff002840
[I2C] tx_buf = ff002860
[I2C] i2c_send add=104 sec=00 flag=02 size=1
[I2C] txbd = ff002840
[I2C] Formatting addresses...
[I2C] copy data...
[I2C] txbd: length=0x0002 status=0x8400 addr[0]=0xd0 addr[1]=0x01
[I2C] i2c_receive 104 00 04
[I2C] rxbd = ff002820
[I2C] txbd = ff002848
[I2C] txbd: length=0x0002 status=0xac00 addr[0]=0xd1 addr[1]=0x00
[I2C] rxbd: length=0x0001 status=0xa000 addr[0]=0x00 addr[1]=0xf3
[I2C] i2c_doio
[I2C] Enabling I2C...
[I2C] Transmitting...(txbd=0xff002848)

i2c_read: i2c_doio failed (-1)
[I2C] Setting rate...
 [I2C] trying hz=40000000, speed=50000, filter=0, modval=0
  moddiv=32, brgdiv=25
  accepted brgval=10, totspeed=48076
 [I2C] trying hz=40000000, speed=50000, filter=0, modval=1
  moddiv=16, brgdiv=50
  accepted brgval=22, totspeed=50000
 [I2C] trying hz=40000000, speed=50000, filter=0, modval=2
  moddiv=8, brgdiv=100
  accepted brgval=47, totspeed=50000
 [I2C] trying hz=40000000, speed=50000, filter=0, modval=3
  moddiv=4, brgdiv=200
  accepted brgval=97, totspeed=50000
[I2C] Best is:
[I2C] CPU=40000000hz RATE=50000 F=0 I2MOD=00000001 I2BRG=00000016 DIFF=0hz
[I2C] i2mod=00000002 i2brg=00000016
[I2C] rbase = 0820
[I2C] tbase = 0840
[I2C] rxbd = ff002820
[I2C] txbd = ff002840
[I2C] i2c_newio
[I2C] rxbd = ff002820
[I2C] txbd = ff002840
[I2C] tx_buf = ff002860
[I2C] i2c_send add=104 sec=00 flag=02 size=1
[I2C] txbd = ff002840
[I2C] Formatting addresses...
[I2C] copy data...
[I2C] txbd: length=0x0002 status=0x8400 addr[0]=0xd0 addr[1]=0x02
[I2C] i2c_receive 104 00 04
[I2C] rxbd = ff002820
[I2C] txbd = ff002848
[I2C] txbd: length=0x0002 status=0xac00 addr[0]=0xd1 addr[1]=0x00
[I2C] rxbd: length=0x0001 status=0xa000 addr[0]=0x00 addr[1]=0xf3
[I2C] i2c_doio
[I2C] Enabling I2C...
[I2C] Transmitting...(txbd=0xff002848)

i2c_read: i2c_doio failed (-1)
[I2C] Setting rate...
 [I2C] trying hz=40000000, speed=50000, filter=0, modval=0
  moddiv=32, brgdiv=25
  accepted brgval=10, totspeed=48076
 [I2C] trying hz=40000000, speed=50000, filter=0, modval=1
  moddiv=16, brgdiv=50
  accepted brgval=22, totspeed=50000
 [I2C] trying hz=40000000, speed=50000, filter=0, modval=2
  moddiv=8, brgdiv=100
  accepted brgval=47, totspeed=50000
 [I2C] trying hz=40000000, speed=50000, filter=0, modval=3
  moddiv=4, brgdiv=200
  accepted brgval=97, totspeed=50000
[I2C] Best is:
[I2C] CPU=40000000hz RATE=50000 F=0 I2MOD=00000001 I2BRG=00000016 DIFF=0hz
[I2C] i2mod=00000002 i2brg=00000016
[I2C] rbase = 0820
[I2C] tbase = 0840
[I2C] rxbd = ff002820
[I2C] txbd = ff002840
[I2C] i2c_newio
[I2C] rxbd = ff002820
[I2C] txbd = ff002840
[I2C] tx_buf = ff002860
[I2C] i2c_send add=104 sec=00 flag=02 size=1
[I2C] txbd = ff002840
[I2C] Formatting addresses...
[I2C] copy data...
[I2C] txbd: length=0x0002 status=0x8400 addr[0]=0xd0 addr[1]=0x03
[I2C] i2c_receive 104 00 04
[I2C] rxbd = ff002820
[I2C] txbd = ff002848
[I2C] txbd: length=0x0002 status=0xac00 addr[0]=0xd1 addr[1]=0x00
[I2C] rxbd: length=0x0001 status=0xa000 addr[0]=0x00 addr[1]=0xf3
[I2C] i2c_doio
[I2C] Enabling I2C...
[I2C] Transmitting...(txbd=0xff002848)
[I2C] Receiving...(rxbd=0xff002820)

i2c_read: i2c_doio failed (-1)
[I2C] Setting rate...
 [I2C] trying hz=40000000, speed=50000, filter=0, modval=0
  moddiv=32, brgdiv=25
  accepted brgval=10, totspeed=48076
 [I2C] trying hz=40000000, speed=50000, filter=0, modval=1
  moddiv=16, brgdiv=50
  accepted brgval=22, totspeed=50000
 [I2C] trying hz=40000000, speed=50000, filter=0, modval=2
  moddiv=8, brgdiv=100
  accepted brgval=47, totspeed=50000
 [I2C] trying hz=40000000, speed=50000, filter=0, modval=3
  moddiv=4, brgdiv=200
  accepted brgval=97, totspeed=50000
[I2C] Best is:
[I2C] CPU=40000000hz RATE=50000 F=0 I2MOD=00000001 I2BRG=00000016 DIFF=0hz
[I2C] i2mod=00000002 i2brg=00000016
[I2C] rbase = 0820
[I2C] tbase = 0840
[I2C] rxbd = ff002820
[I2C] txbd = ff002840
[I2C] i2c_newio
[I2C] rxbd = ff002820
[I2C] txbd = ff002840
[I2C] tx_buf = ff002860
[I2C] i2c_send add=104 sec=00 flag=02 size=1
[I2C] txbd = ff002840
[I2C] Formatting addresses...
[I2C] copy data...
[I2C] txbd: length=0x0002 status=0x8400 addr[0]=0xd0 addr[1]=0x04
[I2C] i2c_receive 104 00 04
[I2C] rxbd = ff002820
[I2C] txbd = ff002848
[I2C] txbd: length=0x0002 status=0xac00 addr[0]=0xd1 addr[1]=0x00
[I2C] rxbd: length=0x0001 status=0xa000 addr[0]=0x00 addr[1]=0xf3
[I2C] i2c_doio
[I2C] Enabling I2C...
[I2C] Transmitting...(txbd=0xff002848)
[I2C] Receiving...(rxbd=0xff002820)

i2c_read: i2c_doio failed (-1)
[I2C] Setting rate...
 [I2C] trying hz=40000000, speed=50000, filter=0, modval=0
  moddiv=32, brgdiv=25
  accepted brgval=10, totspeed=48076
 [I2C] trying hz=40000000, speed=50000, filter=0, modval=1
  moddiv=16, brgdiv=50
  accepted brgval=22, totspeed=50000
 [I2C] trying hz=40000000, speed=50000, filter=0, modval=2
  moddiv=8, brgdiv=100
  accepted brgval=47, totspeed=50000
 [I2C] trying hz=40000000, speed=50000, filter=0, modval=3
  moddiv=4, brgdiv=200
  accepted brgval=97, totspeed=50000
[I2C] Best is:
[I2C] CPU=40000000hz RATE=50000 F=0 I2MOD=00000001 I2BRG=00000016 DIFF=0hz
[I2C] i2mod=00000002 i2brg=00000016
[I2C] rbase = 0820
[I2C] tbase = 0840
[I2C] rxbd = ff002820
[I2C] txbd = ff002840
[I2C] i2c_newio
[I2C] rxbd = ff002820
[I2C] txbd = ff002840
[I2C] tx_buf = ff002860
[I2C] i2c_send add=104 sec=00 flag=02 size=1
[I2C] txbd = ff002840
[I2C] Formatting addresses...
[I2C] copy data...
[I2C] txbd: length=0x0002 status=0x8400 addr[0]=0xd0 addr[1]=0x05
[I2C] i2c_receive 104 00 04
[I2C] rxbd = ff002820
[I2C] txbd = ff002848
[I2C] txbd: length=0x0002 status=0xac00 addr[0]=0xd1 addr[1]=0x00
[I2C] rxbd: length=0x0001 status=0xa000 addr[0]=0x00 addr[1]=0xf3
[I2C] i2c_doio
[I2C] Enabling I2C...
[I2C] Transmitting...(txbd=0xff002848)

i2c_read: i2c_doio failed (-1)
[I2C] Setting rate...
 [I2C] trying hz=40000000, speed=50000, filter=0, modval=0
  moddiv=32, brgdiv=25
  accepted brgval=10, totspeed=48076
 [I2C] trying hz=40000000, speed=50000, filter=0, modval=1
  moddiv=16, brgdiv=50
  accepted brgval=22, totspeed=50000
 [I2C] trying hz=40000000, speed=50000, filter=0, modval=2
  moddiv=8, brgdiv=100
  accepted brgval=47, totspeed=50000
 [I2C] trying hz=40000000, speed=50000, filter=0, modval=3
  moddiv=4, brgdiv=200
  accepted brgval=97, totspeed=50000
[I2C] Best is:
[I2C] CPU=40000000hz RATE=50000 F=0 I2MOD=00000001 I2BRG=00000016 DIFF=0hz
[I2C] i2mod=00000002 i2brg=00000016
[I2C] rbase = 0820
[I2C] tbase = 0840
[I2C] rxbd = ff002820
[I2C] txbd = ff002840
[I2C] i2c_newio
[I2C] rxbd = ff002820
[I2C] txbd = ff002840
[I2C] tx_buf = ff002860
[I2C] i2c_send add=104 sec=00 flag=02 size=1
[I2C] txbd = ff002840
[I2C] Formatting addresses...
[I2C] copy data...
[I2C] txbd: length=0x0002 status=0x8400 addr[0]=0xd0 addr[1]=0x06
[I2C] i2c_receive 104 00 04
[I2C] rxbd = ff002820
[I2C] txbd = ff002848
[I2C] txbd: length=0x0002 status=0xac00 addr[0]=0xd1 addr[1]=0x00
[I2C] rxbd: length=0x0001 status=0xa000 addr[0]=0x00 addr[1]=0xf3
[I2C] i2c_doio
[I2C] Enabling I2C...
[I2C] Transmitting...(txbd=0xff002848)
[I2C] Receiving...(rxbd=0xff002820)

i2c_read: i2c_doio failed (-1)
Get RTC year: 00 mon: 00 mday: 00 wday: 00 hr: 00 min: 00 sec: 00
Get DATE: 2000-00-00 (wday=7)  TIME:  0:00:00
Date: 2000-00-00 (unknown day)    Time:  0:00:00
[ICM] $i2cinfo
I2MOD = 03 I2ADD = fe
I2BRG = 16 I2COM = 01
I2CER = 10 I2CMR = 00
RBASE = 00000820 TBASE = 00000840
RFCR  =       10 TFCR  =       10
MRBLR =     0080
RSTATE= 00000000 RDP   = 61cf2623
RBPTR =     0820 RBC   =     c6ef
RXTMP = bd65484e
TSTATE= 10000000 TDP   = ff002864
TBPTR =     0840 TBC   =     0001
TXTMP = d10057e2
[ICM] $
I2MOD = 03 I2ADD = fe
I2BRG = 16 I2COM = 01
I2CER = 10 I2CMR = 00
RBASE = 00000820 TBASE = 00000840
RFCR  =       10 TFCR  =       10
MRBLR =     0080
RSTATE= 00000000 RDP   = 61cf2623
RBPTR =     0820 RBC   =     c6ef
RXTMP = bd65484e
TSTATE= 10000000 TDP   = ff002864
TBPTR =     0840 TBC   =     0001
TXTMP = d10057e2
02840
[I2C] Formatting addresses...
[I2C] copy data...
[I2C] txbd: length=0x0002 status=0x8400 addr[0]=0xd0 addr[1]=0x05
[I2C] i2c_receive 104 00 04
[I2C] rxbd = ff002820
[I2C] txbd = ff002848
[I2C] txbd: length=0x0002 status=0xac00 addr[0]=0xd1 addr[1]=0x00
[I2C] rxbd: length=0x0001 status=0xa000 addr[0]=0x00 addr[1]=0x00
[I2C] i2c_doio
[I2C] Enabling I2C...
[I2C] Transmitting...(txbd=0xff002848)
[I2C] Receiving...(rxbd=0xff002820)
[I2C] Receiving...(rxbd=0xff002820)
i2c_read: i2c_doio failed (-1)
[I2C] Setting rate...
 [I2C] trying hz=40000000, speed=50000, filter=0, modval=0
  moddiv=32, brgdiv=25
  accepted brgval=10, totspeed=48076
 [I2C] trying hz=40000000, speed=50000, filter=0, modval=1
  moddiv=16, brgdiv=50
  accepted brgval=22, totspeed=50000
 [I2C] trying hz=40000000, speed=50000, filter=0, modval=2
  moddiv=8, brgdiv=100
  accepted brgval=47, totspeed=50000
 [I2C] trying hz=40000000, speed=50000, filter=0, modval=3
  moddiv=4, brgdiv=200
  accepted brgval=97, totspeed=50000


Regards,

ganesh


		
---------------------------------
Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls.  Great rates starting at 1&cent;/min.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.denx.de/pipermail/u-boot/attachments/20060510/63da39be/attachment-0001.htm 


More information about the U-Boot mailing list