AnsweredAssumed Answered

STM32F4 I2c1 and USART1 (and USART6) conflict

Question asked by Bob jenkins on Oct 14, 2017
Latest reply on Oct 15, 2017 by Clive One

I have an STM32F446RE Nucleo board. 

I am using I2C1 in interrupt (not DMA) mode, to continuously read data from an MPU9250 accelerometer/magnetometer/gyroscope board. I also use the USART1 to read logs with my laptop (using FTDI adapter) and to write some text commands to the STM32, that I read in a DMA mode.

The problem is that, occasionally, after I write into usart1 from a pc, a function HAL_I2C_Mem_Read_IT, that is supposed to read data from the MPU9250, returns error HAL_TIMEOUT. This doesn't happen always, in fact, this is a rare event. But I can't figure out why that might happen, how are I2C and USART related?


After I checked in CubeMX, USART1 pins, that I use, can be assigned to I2C1 as well (although they are assigned to USART1, and I2C1 uses different pair of pins). Just to be safe, I tried to use USART6 instead of USART1. And after a couple of tens of "commands" that I sent via USART from my PC, I got this error HAL_TIMEOUT once again.


Why might that happen?

Thanks for your replies!