I2C Lockup

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

Post Reply
Tabulous
Posts: 518
Joined: Fri May 03, 2013 12:02 pm
Has thanked: 7 times
Been thanked: 18 times

I2C Lockup

Post by Tabulous »

STM32F101

seem to be experiencing random I2C lockup at startup/reset.
when locked up the SDA line in low all the time. If it doesn't lockup then it seems to run ok.

the software is still running and calling i2cMasterTransmitTimeout, but it just returns -1 MSG_RESET.
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: I2C Lockup

Post by Giovanni »

It is possible your debugger is resetting the device while the I2C is in use, the device will be locked after the reset.

Giovanni
Tabulous
Posts: 518
Joined: Fri May 03, 2013 12:02 pm
Has thanked: 7 times
Been thanked: 18 times

Re: I2C Lockup

Post by Tabulous »

Giovanni wrote:It is possible your debugger is resetting the device while the I2C is in use, the device will be locked after the reset.

Giovanni


it does it even when the debugger is not connected
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: I2C Lockup

Post by Giovanni »

Try putting I2C IRQ priority above the other peripherals.

Also: http://wiki.chibios.org/dokuwiki/doku.p ... e_shooting

Giovanni
rew
Posts: 383
Joined: Sat Jul 19, 2014 12:59 pm
Has thanked: 2 times
Been thanked: 14 times

Re: I2C Lockup

Post by rew »

This could happen when the slave and the master become unsynchronized. The slave is apparently transmitting a "zero" right now, while your master thinks it is no longer inside a byte. The raspberry pi can, under certain circumstances, generate a VERY short pulse that the slave may not recognize as a pulse, but because it itself generated that pulse, it knows it's sent it.

Anyway, Put the SCL pin in open-drain mode and produce 9 pulses. Wait 5 microseconds before each toggle (100kHz max).
Tabulous
Posts: 518
Joined: Fri May 03, 2013 12:02 pm
Has thanked: 7 times
Been thanked: 18 times

Re: I2C Lockup

Post by Tabulous »

Giovanni wrote:Try putting I2C IRQ priority above the other peripherals.

Also: http://wiki.chibios.org/dokuwiki/doku.p ... e_shooting

Giovanni


It is 5 for Ints and 3 for DMA does not make any difference.

So i dropped the driver, and bit banged it, now everything works great :-)
Post Reply