Hi,
I want sample code for configuring baud rate of UART from mobile application (nRF Connect). So I don't need to hard-code the baud rate in my program.
Please share the code if anyone has or suggest me how to do that..
Hi,
I want sample code for configuring baud rate of UART from mobile application (nRF Connect). So I don't need to hard-code the baud rate in my program.
Please share the code if anyone has or suggest me how to do that..
I assume you are talking about ble_app_uart you run on the peripheral ?
It shouldn't be too hard. You just need to define your custom command via NUS. Please modify nus_data_handler, to check for you command in the data. For example, if you receive "UART_CONF" then you can parse the next 2 bytes as the baudrate, 1 next byte as priority or hardware flow control etc
I assume you are talking about ble_app_uart you run on the peripheral ?
It shouldn't be too hard. You just need to define your custom command via NUS. Please modify nus_data_handler, to check for you command in the data. For example, if you receive "UART_CONF" then you can parse the next 2 bytes as the baudrate, 1 next byte as priority or hardware flow control etc
Yes I am talking about ble_app_uart only.
Please send me the template or code for my better understanding.
@Mani: Have you had a look into the code of ble_app_uart and understand how it works ? For example what does nus_data_handler() do ?
Yes I understood and I am working on that code only.
Yes, then just add the code to check if the first 4 bytes of the packet is , say "BAUD" (you can use memcmp() to check) then the next 2 bytes is the baud rate that the UART should be set. You can define more commands the same way.