2011-09-06 11:51 AM
Hi
I have a small problem that I hope you can help me with. My problem I that the I2C communication stops after some time.I have 2 IRQ, one I2C and one timer 3 update with highest priority, TIM3 interrupt with 20kHz.The I2C works fine if I disable the TIM3 IRQ.I am controlling a digital Potentiometer with the I2C.sending address and 2 data byte.When the I2C works, the event comes as:I2C_EVENT_MASTER_MODE_SELECTI2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTEDI2C_EVENT_MASTER_BYTE_TRANSMITTINGI2C_EVENT_MASTER_BYTE_TRANSMITTINGI2C_EVENT_MASTER_BYTE_TRANSMITTEDbut if I enable Timer 3, The I2C stops after: (after some times) I2C_EVENT_MASTER_MODE_SELECTif I look at the signal with a scoop the address is never transmitted to the slave.Hope you can help me with an idea.. thanksIhave attached the code if it will help solving the problem.
#i2c2011-09-07 01:03 AM
Hello!
> The I2C works fine if I disable the TIM3 IRQ. The STM32F I2C state machine is very ''sensitive'' to the timings. Being interrupted in the ''inconvenient'' point it fails. Reading the manual (RM0008) regarding I2C and AN2824 carefully you'll see that it is recommended either to assign to the I2C the highest interrupt priority or to ''protect'' certain I2C event processing steps by disabled interrupts.2011-09-07 06:23 AM
also read the errata. ST tried to be nice and 'improve' on the I²C and failed miserably. Double buiffering I²C is a mistake
Erik2011-09-08 02:44 AM
> Double buiffering I²C is a mistake
ABSOLUTELY.2011-09-08 04:10 AM
Thanks for you reply.
I have tried to disable the TIM3 IRQ but with out any luck, so now I have deicide to use a chip with SPI instead.2011-09-08 07:04 AM
A radical, but effective, solution :)
Erik