5 years, 7 months ago.

how to receive data via UART in nucleo-f207ZG(freeRTOS)

hello everyone!

I've bought a new NUCLEO-F207ZG for some development purpose. As I'm new to freeRTOS, Nucleo boards and HAL libraries, I'm having a problem using its peripherals(USART, UART etc) and their libraries. By referring to many documents I've able to generate code via STM32CubeMxX but none of them actually working.

Hence if anyone guides me how can I receive data via UART in interrupt mode with freeRTOS? and if there are any sample codes, tutorial or documentation available about how to use freeRTOS with NUCLEO-F207ZG board please refer me.

Thanking with regards Aatif Shaikh

1 Answer

5 years, 7 months ago.

Hi Aatif,

Mbed OS is a system by itself. It is different than FreeRTOS. You can find out more about it mbed here https://www.mbed.com/en/platform/getting-started/ Here is an example code that uses the UART for trasmit and recieve. I hope this helps. You can find more example code here: https://os.mbed.com/code/ You can use the online compiler https://os.mbed.com/compiler or command line compiler https://github.com/ARMmbed/mbed-cli to build this for your target.

snippet

mbed UART examples: 
#include "mbed.h"

int main() {
   
  Serial serial(USBTX, USBRX);
  serial.printf("Hello world\r\n");

  while (true) {
        if (serial.readable()) {
			c = serial.getc();
			if (c == '\n' || c == '\r')
				serial.printf("\n\r");
			else
				serial.putc(c);
        }
    }
}