Use Serial.available with CubeMX

Post here all questions related to STM32 core if you can't find a relevant section!
Post Reply
Tagazop
Posts: 1
Joined: Tue May 26, 2020 2:36 am

Use Serial.available with CubeMX

Post 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 !
stas2z
Posts: 131
Joined: Mon Feb 24, 2020 8:17 pm
Answers: 8

Re: Use Serial.available with CubeMX

Post 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.
mrburnette
Posts: 633
Joined: Thu Dec 19, 2019 1:23 am
Answers: 7

Re: Use Serial.available with CubeMX

Post 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/
rufousfeigned
Posts: 1
Joined: Mon Apr 10, 2023 1:35 am

Re: Use Serial.available with CubeMX

Post 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 ().
Post Reply

Return to “General discussion”