Page 1 of 1

chSysLock SV#4 mismatched

Posted: Fri Aug 25, 2017 1:23 pm
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.

Re: chSysLock SV#4 mismatched

Posted: Fri Aug 25, 2017 1:34 pm
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

Re: chSysLock SV#4 mismatched

Posted: Fri Aug 25, 2017 1:42 pm
by nonameletters
Giovanni, thank you so much.
I obligatory read RT manual.
Can you derive me how to solve this?

Re: chSysLock SV#4 mismatched

Posted: Fri Aug 25, 2017 1:57 pm
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

Re: chSysLock SV#4 mismatched

Posted: Fri Aug 25, 2017 2:21 pm
by nonameletters
Great thanks

Re: chSysLock SV#4 mismatched

Posted: Mon Aug 28, 2017 2:43 pm
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?

Re: chSysLock SV#4 mismatched

Posted: Mon Aug 28, 2017 3:47 pm
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