Re: designing a message "bus"

Guy Morand

Hi Yshragai,

Small correction on my previous statement. As stated in the documentation, broadcasting is not possible:

Each message may be received by only one thread (i.e.
point-to- multipoint and broadcast messaging is not supported).
We had a small internal discussion about a similar topic this morning and for this reason, we decided to implement our own observer pattern by sending events to a dispatcher using message queue.

Anyway, if you have a better approach, I'm eager to hear more!

Best regards,


On 5/4/22 09:31, Guy Morand via wrote:
Hi Yshragai,
Have you looked at 'k_mbox' data structure? It seems you can set a destination thread or broadcast messages with 'K_ANY': Hope this helps,
On 5/3/22 23:20, yshragai.firmware@... wrote:
I'm wanting to design a firmware, for a small low-power embedded system, with an architecture that features a "bus" over which the firmware modules communicate. I'm wondering how to design this "bus".
Basically what I'm envisioning is modules sending messages over this bus that contain an address or module ID of some sort or another; the module that matches this address or ID would pick up the message off the bus.
One brute-force way to design this is a queue (such as a FIFO) per target module. This is not the most elegant or scalable solution, but it'll work... Is there a way to design this that's more scalable, and maybe even elegant?
I wish there were a mechanism in Zephyr by which a thread could subscribe to messages in a given queue not by sender ID (as is possible with a mailbox) but by some identifying characteristic of the message (e.g., by the value in the "info" field).
bytes at work
Technoparkstrasse 7
CH-8406 Winterthur

phone: +41 52 213 79 79

Join to automatically receive all group messages.