Example of FreeRTOS-PLUS-UDP


I’m looking for the FreeRTOS-Plus-UDP example, where they pass pointers to a queue, but I don’t find it. (see the picture)

I’m interested in a method to share an array between to tasks without copying it. I know I could do it with a semaphore, but I want to learn other methods.

Best Regards,

See also the API doc and the example code e.g. here xQueueReceive how a queue of pointer items works.
Key is that you have to manage the validity of the referenced memory or buffer yourself.
After sending the address of a buffer it can’t be reused immediately (e.g. filling in new values) because the receiver might not have processed it yet. This could make things a bit more complicated.

Thank you for you answer, that’s exactly what I want to deal with, how to protect the access.

My first thought was to have a queue that only contains one pointer. Send the pointer from one task to another task and back, so that only one task can work on the buffer. One task works on the buffer, if it is finished it sends the address of the buffer to the other task.

Then this can be extended if I use several buffers, so I don’t have to wait for the task to process the data. Each task works on a different buffer and passes the pointer of the buffer to the other task if it processed the data.
Is this a reasonable way?

Are there other(better) approaches?

Yes, it sounds reasonable. I’d like to add to with by reference or pointer transport mechanisms usually require a concept of ownership of the referenced data (as your approach does). I think it helps to design a robust application.