cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F103 UART I2C problems

wuguobing
Associate II
Posted on November 28, 2007 at 14:57

STM32F103 UART I2C problems

2 REPLIES 2
wuguobing
Associate II
Posted on May 17, 2011 at 12:16

Hi,

I use i2c1 in master mode, when in receiving process, if run without break, it works fine. But if run the program step by step, it doesn't work.

So i use uart1 to print running information, but a new problem comes. After POR(power on reset) the uart1 works fine, but when press the reset button to reset STM32, the TX1 is 1.5V, uart1 doesn't work, (GPIO works fine). When using IAR to debug the program in flash, it works fine when execute IAR RESET command.

Can anybody give me some suggestions?

Thanks a lot!

fpmartin
Associate II
Posted on May 17, 2011 at 12:16

When debugging the i2c library in IAR, you cannot monitor the I2C1 directly in the Registers window. This is because the i2c library acts on specific states of the SR1 and SR2 registers, and these states can be changed just by reading the registers. If IAR reads the registers before the code does, it changes the state, and the i2c code gets locked up.

Also be careful when using the code optimizations. The i2c_ee sample code will not work under some optmizations.

I am not sure about your uart problem - I do not have the eval board.

Hope this helps