Hi,
Please check if 0x08 is shifted one bit left to get 0xD0....
I saw some I2C address incompatibilities, some use the upper 7 bits but shifted one bit left, some use the upper 7 bits but AND with 0xF7.
Check binary bits: 0x68 ==> 0b 0110 100R, where R represents the rw bit
Some say it is ==> 0b 110 1000 R.
Klaus
There's no standard value, everything depends on the total bus capacitance. I would consider 4k7 down to 1k.
Datasheet says that the device address is 0xD0 and I shifted it right to get the address 0x68 then the R/W bit
Hi,
If the pullup doesn't help and the RTC doesn't acknowledge, then I still assume you don't use the correct address.
0b11010000 for write and 0b11010001 for read.
Show us the code and a scope picture of both SCL and SDA.
Klaus
/* Send data to device */
void vTWI_SendData (uint8 u8DeviceAddress, uint8 * u8Data, uint8 u8DataLength)
{
AT91S_TWI *pTWI = AT91C_BASE_TWI;
/* load device address in write mode */
pTWI->TWI_MMR = u8DeviceAddress << 16 | AT91C_TWI_IADRSZ_1_BYTE << 8;
pTWI->TWI_IADR = 0;
/* start sending data */
pTWI->TWI_THR = *u8Data++;
/* decrement data length */
u8DataLength--;
while (u8DataLength)
{
/* wait for data to be sent to shift register */
while( ( pTWI->TWI_SR & AT91C_TWI_TXRDY ) == 0 );
/* continue sending data */
pTWI->TWI_THR = *u8Data++;
u8DataLength--;
}
/* wait for data to be sent to shift register */
while( ( pTWI->TWI_SR & AT91C_TWI_TXRDY ) == 0 );
/* wait for holding and shift register to be empty */
while( ( pTWI->TWI_SR & AT91C_TWI_TXCOMP ) == 0 );
}
uint8 data_to_send[2] = {0x00, 0x55};
vTWI_SetClock(TWI_FAST_MODE);
// RTC_ADDRESS = 0x68
vTWI_SendData(RTC_ADDRESS,data_to_send, 2);
Hi,
Did you ever try to use:
// RTC_ADDRESS = 0xD0
KLaus
Hi,
I can´t review the bit sequence,
neither from your code (because it´s not clear to me how it combines address, RW bit and ACK bit)
nor form your scope picture (because i have no relation between SCL and SDA)
--> try to find a second probe and show us an actual two channel scope picture
Klaus
You don't want to trigger on both channels, just record both channels simultaneously. I didn't yet saw a 2-channel DSO that wasn't capable of doing so.
Hi,
I can´t review the bit sequence,
neither from your code (because it´s not clear to me how it combines address, RW bit and ACK bit)
nor form your scope picture (because i have no relation between SCL and SDA)
--> try to find a second probe and show us an actual two channel scope picture
Klaus
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?