Conic: USART available function in Arduino IDE

Post Reply
Conic
Posts: 1
Joined: Fri Feb 02, 2018 9:03 pm

Conic: USART available function in Arduino IDE

Post by Conic » Fri Feb 02, 2018 9:15 pm

Dear All,

I build a line follower car, which will use a radio module to communicate. And the radio module is connected to my STM32F446RE with USART.
I know i can use the HAL functions in the arduino IDE, and i do it regularly. But I can't find a solution in the HAL for the arduino Serial.available() function. And as I recognized my board doesn't support the arduino SoftwareSerial library.

Does anyone know a solution which is like Serial.available() for the USART?
I have to check if there is any data in the buffer arrived before I read the buffer, because cycle time is critical in my case.

Thank you very much! :)

Conic

User avatar
Manny
Posts: 73
Joined: Wed Dec 09, 2015 3:15 pm

Re: USART available function in Arduino IDE

Post by Manny » Sat Feb 03, 2018 10:49 am

Don't really understand the question as Serial.available() is a function in both Arduino_STM32 and STM32Generic cores...so what core are you using? :?

stevestrong
Posts: 2057
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany
Contact:

Re: USART available function in Arduino IDE

Post by stevestrong » Sat Feb 03, 2018 10:59 am

The STM32DUINO (Arduino_Core_STM32) core has the available functions, see here: https://github.com/stm32duino/Arduino_C ... l.cpp#L109
Just that you have to use Serial1 for UART1, Serial2 for UART2, and so on.

Post Reply