I have an app that is to communicate with an STM32 sending short, usually single byte, commands and receiving large packets of sensor data over BT, frequently (50Hz or so).
The app and the firmware are both written and run happily in simulation mode. They are just waiting for me to finish the communications code.
I like the prefix mode and the large data packets arrive safely to Android in this mode. The problem is sending the commands back to RTOS. The RTOS in the STM32 fires off an event when a byte arrives. When this happens, and when I am ready, I check the input buffer for a valid first byte, maybe an argument, and a cr/lf, then do something, or maybe not.
This is really simple and works well from a serial console. It gets more complicated if the command arrives with a prefix from Android. It would be nice to avoid this.
To do this I would need an asymmetric prefix mode. I tried, without much hope of success, setting up two streams on the same serial device, one for input with prefix and the other for output without prefix. Not unexpectedly, it did not work.
Does anyone have any ideas how I may go about this or will I just have to "bite the bullet" and code the input prefix handling into the RTOS?
Thanks.
The app and the firmware are both written and run happily in simulation mode. They are just waiting for me to finish the communications code.
I like the prefix mode and the large data packets arrive safely to Android in this mode. The problem is sending the commands back to RTOS. The RTOS in the STM32 fires off an event when a byte arrives. When this happens, and when I am ready, I check the input buffer for a valid first byte, maybe an argument, and a cr/lf, then do something, or maybe not.
This is really simple and works well from a serial console. It gets more complicated if the command arrives with a prefix from Android. It would be nice to avoid this.
To do this I would need an asymmetric prefix mode. I tried, without much hope of success, setting up two streams on the same serial device, one for input with prefix and the other for output without prefix. Not unexpectedly, it did not work.
Does anyone have any ideas how I may go about this or will I just have to "bite the bullet" and code the input prefix handling into the RTOS?
Thanks.
Last edited: