chSysLock SV#4 mismatched

Discussions and support about ChibiOS/RT, the free embedded RTOS.
Post Reply
nonameletters
Posts: 7
Joined: Fri Aug 25, 2017 1:07 pm

chSysLock SV#4 mismatched

Post by nonameletters »

Hello, I am new in ChibiOS.
I have got a project with CLI.
I can't put message to console from interrupt handler. When I call "chprintf" from interrupt handler I enter to infinite loop with error SV#4. I followed step by step in debugging mode and find the problem in hal_buffers.c -> obqPutTimeout (674) -> osalSysLock();
But when i call "chprintf" from CLI it works fine, osalSysLock() don't initiate infinite loop.
I have check all parameters they are valid.
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: chSysLock SV#4 mismatched

Post by Giovanni »

Hi,

There are things you cannot do from interrupt handlers, this includes calling any API with name not terminated by an upper case i. The stream you are using as output cannot be used from an ISR thus that error.

Please read the "kernel concepts" section in the RT manual, function classes are described there.

Giovanni
nonameletters
Posts: 7
Joined: Fri Aug 25, 2017 1:07 pm

Re: chSysLock SV#4 mismatched

Post by nonameletters »

Giovanni, thank you so much.
I obligatory read RT manual.
Can you derive me how to solve this?
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: chSysLock SV#4 mismatched

Post by Giovanni »

You cannot print on a serial port from an ISR.

What you could do is to wakeup a thread that then does the printing.

Giovanni
nonameletters
Posts: 7
Joined: Fri Aug 25, 2017 1:07 pm

Re: chSysLock SV#4 mismatched

Post by nonameletters »

Great thanks
nonameletters
Posts: 7
Joined: Fri Aug 25, 2017 1:07 pm

Re: chSysLock SV#4 mismatched

Post by nonameletters »

I have a next question about using EXTI on STM32.
I use EXTI on GIOPB0, and GPIOB1. I find that i have to define call back function and I did that for GPIOB1. In works fine. But when I do the same for GPIOB0 a get unhandled_exception. As a result i find that GPIOB0 handler Vector58() doesn't defined, but for GPIOB1 Vector5C() is defined. Is it bug or am I doing some thing wrong?
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: chSysLock SV#4 mismatched

Post by Giovanni »

It is possible there is a bug, you should verify if the correct interrupt vectors are used or just post a note in the "bug reports" forum.

Giovanni
Post Reply