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

nrf52832 ble_uart project - sending all data received on uart over BLE

Hi

I have problem because i dont get all data which are in FIFO uart  on my smartphone via BLE. Nrf as i can see in example sends data where data[index-1] == 0x0d || data[index-1] == 0x0a.

Becase not all message which nrf52832 get via uart ending with 0x0d or 0x0a i dont receive on my smartphone.

I want that every byte nrf52832 get on uart it sends over ble. I have tried with smaller buffer and changing/adding conditions in 

but nothing help with that. When messages are ended with 0x0d 0x0a i dont see on my smartphone 0x0a.

Parents
  • It all works well when i using baudrate 300 but when change to baud 9600 and send to nrf52s uart same 50+ bytes(which i send when baudrate is 300 and get every byte to smartphone) i receive on my smartphone from 25 to 40 bytes.

    EDIT: max data lenght in both directions is 512 bytes and max baudrate which will be on uart is 19200. When i send from smartphone 140+bytes  everything is ok. Only when i send to nrf52s uart 50+ byte to  send further over ble to smartphone then on bigger baudrate it doenst get all bytes.

  • Hi,

    Can you try turning on flow control? See if that helps.

  • it is even worse. Message from smarphone doesnt appear on uart and from uart doesnt get to smartphone.

  • Can you try debugging your application and see which error code is returned? Set the define "DEBUG" in your preprocessor and set a breakpoint at the function app_error_fault_handler(). Then try to debug the code, this will let you see which function that triggers the error and which error code is returned.

  • it doent get in error. It behave like nothing happend like it doent receive more bytes to uart 

  • everything is ok on every baudrate when i use default settings in main.c  that nrf sends over ble to smartphone message when on uart is received 0x0a or 0x0d but that its not fine with me i want to every byte which is received over uart immediately sends over ble to smartphone because  for protocol which is used on smartphone and device on which nrf52s uart is connected it never should pass more than 1500ms  between two character/messages( some messages is almost 512 bytes) till end of communication session.

  • Maybe you can try to start an app_timer on the first byte and then send the whole message when it times out? Note that you won't be able to send the whole 512bytes in one go, it will cut up in chunks.

Reply
  • Maybe you can try to start an app_timer on the first byte and then send the whole message when it times out? Note that you won't be able to send the whole 512bytes in one go, it will cut up in chunks.

Children
  • This size of 512 bytes is only important when is ble_uart default setting that it sends data only when over uart receive 0x0a  or 0x0d.

     when it sends byte by byte  is best solution for me but that for some reason doesnt work on bigger baudrate (code which i have posted above in this topic) 

  • Have you maybe idea why is this when bigger baudrate(9600) it cant send character by character. BLE is more quicker than uarts baudrate.