JeromeBu1982
JeromeBu1982

Reputation: 143

Two UARTs on MCU: FreeRTOS required (or wise)?

I want to use a small stm32G0 with two UARTs:

Furthermore there are no tasks.

I understand this can be done using FreeRTOS, but I am new to that, will figure it out though, but I wonder whether it could ever be as stable as when keeping it simple. But I have to admit, I have not figured out how I could keep this simple:

Question I have is whether it can be even be done without freeRTOS. And if so, whether it is advisable.

Upvotes: 0

Views: 263

Answers (1)

Tagli
Tagli

Reputation: 2602

You probably don't need RTOS for this project.

There are 3 main parts:

  1. Some logic to fill RFID RX buffer, using DMA and/or interrupts
  2. Some logic to fill Modbus RX buffer, using DMA and/or interrupts
  3. The main loop :
do forever {
    Process RFID RX buffer, parse text
    Possibly update Modbus registers using the parsed values
    Process Modbus RX buffer, arm USART TX DMA with the response
}

If this loop can execute before the Modbus master times out or before the RFID reader sends another package, you're done. If not, you can move your Modbus processing (which probably has tighter timing requirements than RFID) into an ISR. Normally, it's not a good idea to do time consuming work in ISR, but in your case I think it's okay considering that your uC doesn't have much to do.

Upvotes: 1

Related Questions