Page 1 of 1

Understanding PAL and ChibiOS Events

Posted: Mon Mar 02, 2020 2:52 pm
by JSStabl
I read this great tutorial about the PAL Event System and how to execute threads based on a GPIO port. https://www.playembedded.org/blog/buttons-stm32/

However some things are unclear to me. According to the chibiOS documentation, threads register to events by using an event listener. (Taken from here: http://chibios.org/dokuwiki/doku.php?id ... nel_events). However in the tutorial no event listeners a used. Just a simple wait function. How does the implementation in the tutorial differ from the one explained in the wiki? What happens if multiple threads execute the palWaitPadTimeout function for the same event? (That seems to work). Is there a similar way to enable a event for the end of an SPI receive?

Re: Understanding PAL and ChibiOS Events

Posted: Mon Mar 02, 2020 6:28 pm
by Giovanni
Hi,

PAL events and RTOS events are two different and unrelated things, the article on play embedded is correct. RTOS events are a generic mechanism used by some other drivers.

Giovanni

Re: Understanding PAL and ChibiOS Events

Posted: Tue Mar 03, 2020 9:29 am
by JSStabl
Thanks for the explanation, I figured the play article is correct, since it works. I just wanted to understand why it works the way it does :)
Maybe something can be done to differentiate the two different event types?

How does the PAL events deal with multiple threads waiting for the same event? I couldn't find any more documentation on it.

Re: Understanding PAL and ChibiOS Events

Posted: Tue Mar 03, 2020 9:50 am
by Giovanni
All waiting threads are woken together on event.

Giovanni