It is my first time programming with an rtos, I alwyas programmed bare metal on small 8bit microprocessors, so please bear with me.
I need to develop the driver to communicate in modbus rtu with some other devices.
I already have the application layer that manages all the FCs and the data link layer, what is difficult to me is the pysical layer.
Modbus specs say that the end of frame is after a 3.5 char timeout.
Normally I would set up a software timer with overflow at 3.5 char duration, the USART interrupt to receive one byte and in the USART RX ISR handler I would save the byte in a buffer and reload the timer.
In the timer overflow ISR handler I would signal to the data link layer that the frame is complete and then the data link layer can grab the received buffer and use it.
Now, at the moment the data link layer I have is a function to which I need to pass a pointer to the received buffer and the application layer is a task.
How can I solve this using freeRTOS (or any rtos in general) and STM32 HAL?
I’m not asking to write the code, but I don’t know which “software architecture” I need to use, since it seems to me that rtos’s timers don’t work like that and I need some help.
Please correct any mistake I wrote and feel free to point me to some document I can read to educate myself.
I already read the freeRTOS manual and did some research on google.