This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Sending a NULL character in BLE UART example

In the ble app uart example, I need the BLE device to be able to send out a null character. I noticed when I receive a message with a null character at the end from the UART device, it does not get sent out over BLE. Our application uses a protocol with a checksum embedded into it. The checksum is always the last character in the message. Sometimes the checksum happens to be a null character. I can see from setting breakpoints in the code that the message is received properly in the uart_event_handle function. However, when ble_nus_data_send is called, the BLE device does not send out the last character in the data array if it is a null character.

Parents
  • I am using the ble_app_uart example. 

    In the uart_event_handle, uart_app_get is called each time a character is received from the uart and data_array is filled with each character so it can be sent out over BLE. Index is also incremented each time a character is received. When it is time to send out the message over BLE, ble_nus_send_data is called and data_array and index are passed to it. I verified that data_array has the elements I expect in it including the null character at the end. Index is also the correct length. However, the null character is not being sent. If I send a similar message with a different character at the end, it is sent correctly.

Reply
  • I am using the ble_app_uart example. 

    In the uart_event_handle, uart_app_get is called each time a character is received from the uart and data_array is filled with each character so it can be sent out over BLE. Index is also incremented each time a character is received. When it is time to send out the message over BLE, ble_nus_send_data is called and data_array and index are passed to it. I verified that data_array has the elements I expect in it including the null character at the end. Index is also the correct length. However, the null character is not being sent. If I send a similar message with a different character at the end, it is sent correctly.

Children
Related