Understanding PAL and ChibiOS Events

Discussions and support about ChibiOS/HAL, the MCU Hardware Abstraction Layer.
JSStabl
Posts: 78
Joined: Tue Feb 25, 2020 4:06 pm
Has thanked: 3 times
Been thanked: 2 times

Understanding PAL and ChibiOS Events

Postby JSStabl » Mon Mar 02, 2020 2:52 pm

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?

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: Understanding PAL and ChibiOS Events

Postby Giovanni » Mon Mar 02, 2020 6:28 pm

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

JSStabl
Posts: 78
Joined: Tue Feb 25, 2020 4:06 pm
Has thanked: 3 times
Been thanked: 2 times

Re: Understanding PAL and ChibiOS Events

Postby JSStabl » Tue Mar 03, 2020 9:29 am

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.

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: Understanding PAL and ChibiOS Events

Postby Giovanni » Tue Mar 03, 2020 9:50 am

All waiting threads are woken together on event.

Giovanni


Return to “ChibiOS/HAL”

Who is online

Users browsing this forum: No registered users and 13 guests