2011-11-10 05:38 AM
Hi,
i try to let two stm32 Boards set all 2 seconds a few bytes on the general call bus (0x00). Every board allone is doing his job, but when i put them together at the bus, there is nothing going on the I2C bus. First SDA and SDL stuck both at high, and after a little second SCL is going down and stay forever at low. I am using the stm libs fom an2824 (the optimized i2c example). It is attached. For initialization I am using the I2C_LowLevel_Init() funktion to init I2C2 with the I2C speed 400khz. for Transmitting i am using the I2C_Master_BufferWrite() funktion of the attached file. Does anyone had the same Problem? #i2c-stm32-scl-go-low2011-11-10 08:18 AM
I don't have time to dig through this, but you only ever enable I2C2, and I'm pretty sure you need to use I2C_Cmd(I2Cx, ENABLE) prior to the I2C_Init(I2Cx, ..) for the peripheral to come up properly. At least in all the examples I've looked at. I2C on the STM32 is painful.
I2C_Cmd(I2C2, ENABLE);
2011-11-10 09:37 AM
// I2C Peripheral Enable
I2C_Cmd(I2C2, ENABLE); is written in the code, after initializing the I2C_InitStructure. I2C1 I dont need, so i did not used the I2C_Cmd() funktion for I2C12011-11-10 10:47 AM
How exactly do you have these boards connected together? I2C devices, etc.
2011-11-10 11:00 AM
the two boards are both connecte with the backplane of a 19 inch casing
2011-11-10 01:13 PM
the two boards are both connecte with the backplane of a 19 inch casing
Thanks, that totally cleared up the electrical side for me.2014-01-31 07:44 AM
Hey, Im fighting also with I2C problem for stm32f2xx. Maybe sb has a clue how to solve it or had the same problem.
My problem: I want to have a communication between two boards in master and slave mode. I impemented both modes without interrupt and it works. But now all has to be done using interrupts. When I send data from master to slave, everything works fine. When I want to send data from slave to master here the problems starts. The ADDR and RxNE flag is not set but I get ACK (checked on osciloscope and Logic app). To check if it is a master fault, I checked how the same code works with EEPROM as a slave. Without interrupts everything works fine, both flags are set. But when master is ''done'' on interrupts just RxNE flag is set despite I get ACK. It looks like this event I2C_EVENT_SLAVE TRANSMITTER_ADDRESS_MATCHED is accomplished but at the same time I2C_EVENT_MASTER_RECEIVER_ADDRESS_MATCHED is not. I have no clue why it happens and I already spent a couple of days trying to solve this problem. My code with interrupts is based on the stm32f2xx example.