NUS ble_app_uart freezes when client app is closed while receiving data from peripheral

When the nRF52840 Dev Kit is sending data as a peripheral, connected to client running nRF Connect all works.

I am sending (streaming) a text file to iOS phone or Android tablet.

1)

If I close nRF Connect while streaming, the peripheral (nRF52840) stays connected.

I have to power cycle to get nRF52840 to start advertising again.

2)

If I send a 340-character text file to NUS, all is fine. I can disconnect and reconnect.

If I send a 360-character text file, NUS locks up (Freezes).s

Only a power cycle can get the Dev Kit to function.again.

Any help appreciated

I am using:

nRF52840
nRF5_SDK_17.1.0_ddde560
s140_nrf52_7.2.0_softdevice

When I use:

ble_app_uart
nRF5_SDK_15.3.0_59ac345
s132_nrf52_6.1.1_softdevice.hex

nRF52832 Dev Kit

I can send a file of320 bytes, no problem

When I send a file of 360 bytes, the nRF52832 Dev Kit (Peripheral) automatically disconnects, but does NOT freeze.

So the Client, (Android tablet), can reconnect.

Parents
  • Amanda,

    Thanks for this, but there is still a problem.

    The magic number is around 400 characters.

    1)

    I placed the 'Hello" array into a Notepad text file. (720 lines of 'Hello')

    I use Tera Term to connect to the JLink CDC UART Port of the nRF52840 DevKit.

    I then use 'Send File' from Tera Term to send this 720 character file, and it freezes NUS every time.

    BLE disconnects with message:

    INFO Disconnected from device ED:FD:19:76:49:0E, reason: BLE_HCI_CONNECTION_TIMEOUT

    This is how the module is used in the real word, streaming text to the UART, simulating a wireless cable.

    2)

    I cut and paste the 360 array, to make it a 720 char array, of 'Hello'

    I press Button 4, and it works just great

    So there is a difference in sending text from within the UART app, as you did, or sending a text file through the external UART port.

    3)

    I can get the error to go away, if I comment out the //APP_ERROR_HANDLER(p_event->data.error_communication);

    case APP_UART_COMMUNICATION_ERROR:
    APP_ERROR_HANDLER(p_event->data.error_communication);
    break;

    4)

    In my case, when using a module with the nRF52840, the UART text is streamed to the external port,. So it crashes every time.

    If I send less then say 340 characters, and have some delay before sending another stream of characters, then nRF52840 will work.

    If I send say 400 or more chars, it crashes.

    The only way to get that to work, is to comment out the //APP_ERROR_HANDLER(p_event->data.error_communication);

    Any help appreciated

Reply
  • Amanda,

    Thanks for this, but there is still a problem.

    The magic number is around 400 characters.

    1)

    I placed the 'Hello" array into a Notepad text file. (720 lines of 'Hello')

    I use Tera Term to connect to the JLink CDC UART Port of the nRF52840 DevKit.

    I then use 'Send File' from Tera Term to send this 720 character file, and it freezes NUS every time.

    BLE disconnects with message:

    INFO Disconnected from device ED:FD:19:76:49:0E, reason: BLE_HCI_CONNECTION_TIMEOUT

    This is how the module is used in the real word, streaming text to the UART, simulating a wireless cable.

    2)

    I cut and paste the 360 array, to make it a 720 char array, of 'Hello'

    I press Button 4, and it works just great

    So there is a difference in sending text from within the UART app, as you did, or sending a text file through the external UART port.

    3)

    I can get the error to go away, if I comment out the //APP_ERROR_HANDLER(p_event->data.error_communication);

    case APP_UART_COMMUNICATION_ERROR:
    APP_ERROR_HANDLER(p_event->data.error_communication);
    break;

    4)

    In my case, when using a module with the nRF52840, the UART text is streamed to the external port,. So it crashes every time.

    If I send less then say 340 characters, and have some delay before sending another stream of characters, then nRF52840 will work.

    If I send say 400 or more chars, it crashes.

    The only way to get that to work, is to comment out the //APP_ERROR_HANDLER(p_event->data.error_communication);

    Any help appreciated

Children
Related