Page 1 of 1

Use Serial.available with CubeMX

Posted: Tue May 26, 2020 2:43 am
by Tagazop
Hello,

I post here today to ask you for help, I need to know how Arduino IDE uses polling (serial.available) I search and find the code but I do not understand how is adapt on a STM32 , I would like to use polling on an STM with CubeMX so use a command like serial.available().

Thank you for your help !

Re: Use Serial.available with CubeMX

Posted: Tue May 26, 2020 3:20 am
by stas2z
Usually it doesnt use polling. Serial.available returns amount of unread data in the rx buffer. That buffer filled by reading serial with serial interrupt handler.

Re: Use Serial.available with CubeMX

Posted: Wed May 27, 2020 3:33 am
by mrburnette
Actually, this is polling (the read buffer)

Code: Select all

  while (!Serial.available())
     ;
  Serial.print(timer);
}
https://forum.arduino.cc/index.php?topic=468340.0

You will find your answer quicker on: community.st.com

For example:
https://community.st.com/s/question/0D5 ... -interrupt
https://community.st.com/s/question/0D5 ... age-length
https://stm32f4-discovery.net/2017/07/s ... using-dma/

Re: Use Serial.available with CubeMX

Posted: Mon Apr 10, 2023 1:37 am
by rufousfeigned
The code exists, but I can't figure out how to modify it for usage on an STM32. I'd want to implement polling on an STM using CubeMX, but I'm not sure how to do so ().