Can you change the Baud rate of the Android BLE block
1 次查看(过去 30 天)
显示 更早的评论
I am trying to receive a 256 samples per second signal from a HM10 bluetooth device using the custom characteristic of the HM10. I have successfully sampled a 1hz sine wave that is not distorted at that sample rate. However when I try to sample a 128Hz sine wave it is all over the place (which is the signal I actually need for my project). The custom characteristic of the HM10 sends a maximum of 20 characters. Im assuming one of the issues is that the 9600 baud rate is not high enough and I need 57600 to get the whole signal ie 20(characters) x 8 (bits) x 256 (samples per second)...please correct if Im wrong. I can change the baud on the HM10 easily enough but does anyone know how can I match it with the simulink driven android device? ie change the baud for the android BLE block to 57600
0 个评论
采纳的回答
Sruthi Yenugula
2018-11-2
Hi Matthew,
Maximum data sent through BLE characteristic is 20 bytes. Android BLE receive blocks can receive the characteristic for every 0.1 second, if the sample time parameter of the BLE Receive block is set to 0.1. You can set the sample time according to your needs. Two things you control in BLE Receive BLE block is Sample time and Data Size(it depends on peripheral/central device i.e sender data size ).
1 个评论
li li
2021-8-11
编辑:li li
2021-8-11
Hi Sruthi :
- I used to send 7 bytes data to the mobile by (STM32F407 through BLE4.0 module,Baud rate=115200) every 0.001 second;
- BLE Receive block's sample time set to 0.001, data size set to 10;
- and also log the receive data by To Workspace block which sample time set to 0.001 too;
but the result :
- the receive data logged in MAT-files seems wrong,The data is not stored in the correct position, the frame header often appears in the 3rd or 4th bit value.The data is completely useless.
- when i reduce transmission frequency to 7 bytes per 0.02 second , the data stored correct, but always missing log some frame data.
my Q :
- Why do the above two results occur?
- What is the highest sending frequency of the slave device can be used?
- What is the appropriate sampling time and the data size of the BLE Receive block?
- Can To Workspace block be freely to control the start and stop of the recording data?
Thanks.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Modeling 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!