HELLO,
I'm trying to use the circular buffer component with the Blackpill board to intercept responses from a modem. This modem is currently simulated by a terminal program on the PC that connects to the USART1. I then send the captured data to the same software via serial software. The strange thing is that whether I try to use the string capture functions or the array capture functions, characters are added. Furthermore, with the string function, 9 characters are captured, not 10. Am I using the circular buffer component wrong?
cirular buffer & blackpill
-
max.tisc
- Posts: 144
- http://meble-kuchenne.info.pl
- Joined: Thu Dec 10, 2020 5:40 pm
- Been thanked: 11 times
cirular buffer & blackpill
- Attachments
-
- CONTROLLO_STRINGA_STM32F411_FC10_.fcfx
- (22.39 KiB) Downloaded 5 times
-
- Screenshot 2025-12-14 182502.png (211.07 KiB) Viewed 42 times
-
LeighM
- Valued Contributor
- Posts: 522
- Joined: Mon Dec 07, 2020 1:00 pm
- Has thanked: 89 times
- Been thanked: 278 times
Re: cirular buffer & blackpill
Hi,
If you use the RX interrupt, then you should only process one received character within the called macro, putting it into a circular buffer is the best approach. Then in your main macro use the circular buffer commands to determine when you have received a string and process it.
(You can't mix interrupts and string get functions)
Also note that strings are null terminated (i.e. 0), so any buffers that you use should be at least the size of the maximum string expected plus one (for the terminator).
There should be some examples of use on the Circular buffer component wiki
If you use the RX interrupt, then you should only process one received character within the called macro, putting it into a circular buffer is the best approach. Then in your main macro use the circular buffer commands to determine when you have received a string and process it.
(You can't mix interrupts and string get functions)
Also note that strings are null terminated (i.e. 0), so any buffers that you use should be at least the size of the maximum string expected plus one (for the terminator).
There should be some examples of use on the Circular buffer component wiki