Hi everybody,
I am currently working on a project using a STM32F415 (168 MHz) as a CAN Node controler. I am using the Keil RTX (RTOS) as well as the Keil CAN Middleware. Besides CAN there is a I2C bus to control a TLC5119 (LED PWM driver). I also use the STM Standard Peripherial Library for IO Init, I2C, .... So the following works perfect: CAN without I2C: send and receive I2C without CAN: write and read.
But CAN together with I2C is not possible. I do not use interrupts in I2C module.
Locking the I2C task before using I2C bus doesn't change anything. Mutexes are used to controll uC periphery (if I leave them away nothing changes).
When using CAN and I2C together the problem is in the following part of the code (a timeout is generated).
while(!I2C_CheckEvent(I2C, I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED))
By the way it doesn't make any change at which stage I initialize the I2C or the CAN.
Both are the same:
CAN_init(CAN_CONTROLER, CAN_SPEED); CAN_start(CAN_CONTROLER); I2C_Cmd(I2C, ENABLE); I2C_Init(I2C, &I2C_InitStructure);
is the same behaviour like
I2C_Cmd(I2C, ENABLE); I2C_Init(I2C, &I2C_InitStructure); CAN_init(CAN_CONTROLER, CAN_SPEED); CAN_start(CAN_CONTROLER);
Does anybody of you guys have an idea where the problem could be (it is strange because without CAN I2C works quite perfect and vica versa).? Had anybody had the same problem? (There was a thread here with a broken I2C1 CR1 register, SWRST bit, but for my problem it didn't had any impact). Maybe someone have a work around.
Thanks in advance Bernhard