CAN Driver - Mailbox name confusion

Discussions and support about ChibiOS/HAL, the MCU Hardware Abstraction Layer.
Posts: 1
Joined: Sat Apr 01, 2023 1:01 am

CAN Driver - Mailbox name confusion

Postby haykodarb » Sat Apr 01, 2023 1:15 am

Hi everyone, hi Giovanni. First of all, many thanks for creating this wonderful tool. It's the first RTOS I learnt and it really simplified getting into embedded development after Arduino for me.

Now to my question, is the CAN Driver mailbox related in any way to the OSLIB Mailboxes?

I looked through the hal_can and hal_can_lld files and it looks like what are called rx mailboxes are not related to the OSLIB mailboxes but are more like buffers within the MCU memory where a single CAN frame is stored at a time (per "mailbox"), is this correct?

I was planning on implementing a callback based approach where a simple canRxCallback function receives messages and places them on a mailbox for later processing by a regular thread, does this make sense? The naming of the mailboxes en the CAN driver made me think that there were already existing mailboxes and that I was just copying from one OSLIB mailbox to another thus doing double the work and spending double the memory.

Thanks in advance for the help and for all of the work you've done here.

User avatar
Site Admin
Posts: 14319
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1053 times
Been thanked: 894 times

Re: CAN Driver - Mailbox name confusion

Postby Giovanni » Sat Apr 01, 2023 6:51 am


The 2 kind of mailboxes are 100% unrelated, OSLIB malboxes are a mechanism for exchanging messages between ISR/threads, CAN mailboxes are par of the CAN peripheral registers interface.

OSLIB and HAL are 2 distinct architectural layers, so don't worry about naming too much, look at where things are placed.


Return to “ChibiOS/HAL”

Who is online

Users browsing this forum: No registered users and 3 guests