2008-08-06 11:48 PM
I2C problem
2011-05-17 03:26 AM
I have probles to run I2C2.
When i set START bit in I2C2_CR1 register the pin PB11(I2C2_SDA) goes low, but SB bit is never set in I2C2_SR1. I2C2Test() { while((I2C2_SR2 & 0x02) != 0); //wait for I2C to be free I2C2_CR1 |= I2C2_CR1_START; //start while((I2C2_SR1 & 0x01) == 0); // wait for SB I2C2_DR = DIMMER2_ADDRESS; // Never get to this point ......... ......... } Here is Init function : I2C2Init() { I2C2_CR1 = I2C2_CR1_PE | I2C2_CR1_ACK; // turn on I2C and set ACK I2C2_OAR1 = 0x4001; I2C2_OAR2 = 0x0000; I2C2_CCR = 0x028; I2C2_TRISE = 0x03; } Any idea ?? Regards, Aleksander.2011-05-17 03:26 AM
hi alex,
I don't have time to check your code, but here is the lowest level of my I2C stack if you want to take a look. it's working fine on I2C2 at 400kbps.2011-05-17 03:26 AM
FYI - Your kind attachment seems to be empty/corrupt.
[ This message was edited by: bobz on 19-03-2008 15:02 ]2011-05-17 03:26 AM
BTW, there's a ''problem'' with the I2C hardware. I reproduce a comment form the files here in case someone's dealing with the same issue:
// Some byte counts cannot be received safely by a polling process that can be preempted // due to shortcomings in the peripheral hardware design, but a single byte can. (at least that's my current understanding of the situation.)2011-05-17 03:26 AM
alex, I just downloaded i2c.zip from my post and tested its contents and everything seems to be alright. please try to download it again, maybe clearing your browser cache first.
2011-05-17 03:26 AM
In which way could I establish a connection between 2 I2C channels from the STR9 Board.