Assertion error in I2C interrupt (thread not suspended) Topic is solved

Report here problems in any of ChibiOS components. This forum is NOT for support.
Post Reply
lerela
Posts: 11
Joined: Tue Mar 21, 2017 7:08 pm
Been thanked: 2 times

Assertion error in I2C interrupt (thread not suspended)

Post by lerela »

Hi,

I am running an STM32F417.

When I start an I2C3 transfer using i2cMasterTransmitTimeout(), I encounter the following assertion error (chthreads.c:571), called by the _i2c_wakeup_isr from the I2C interrupt "i2c_lld_serve_event_interrupt" (I2Cv1/i2c_lld.c:322):

Code: Select all

chDbgAssert(tp->p_state == CH_STATE_SUSPENDED, "not THD_STATE_SUSPENDED");


The thread ChibiOS is trying to wake up is indeed the one that called the i2c transfer function. I am wondering if it's possible that the I2C transfer started and ended before osalThreadSuspendTimeoutS() was even called, but if that's the case I don't understand why would I be the only person to encounter this error.

Any idea?

Thanks!
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Assertion error in I2C interrupt (thread not suspended)

Post by Giovanni »

Hi,

It could also be a spurious interrupt when there is no thread waiting.

Very strange, moving this topic in "bug reports", you should explain how to reproduce the problem, that would make things easier.

Giovanni
lerela
Posts: 11
Joined: Tue Mar 21, 2017 7:08 pm
Been thanked: 2 times

Re: Assertion error in I2C interrupt (thread not suspended)

Post by lerela »

There's no other task using I2C and this spurious interrupt comes after my call to the transmit function so I suspect this is the intended interrupt (especially since the rx buffer contains the data I am expecting), that's why I thought it might come from a misuse of the API.
If that does not ring a bell I'll dig deeper, I'll let you know what I find.

Thank you
lerela
Posts: 11
Joined: Tue Mar 21, 2017 7:08 pm
Been thanked: 2 times

Re: Assertion error in I2C interrupt (thread not suspended)

Post by lerela »

Turned out to be an undetected stack overflow. Sorry about that.
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Assertion error in I2C interrupt (thread not suspended)

Post by Giovanni »

Np, glad you fixed it.

Giovanni
Post Reply