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

UART Implementation connection issue

Hi, I am learning how to implement Long Range on the UART central and peripheral examples using SDK 17.0.0. The error I am facing is that the debug terminal shows

[ app_timer: RTC:initialized

app: Debug logging for UART over RTT started.

app: Connected

app: Disconnected ]

The connection state switched immediately. The issue I think I face is about the high packet error rate : here

Will changing the dbm to 8 (max dBm for nRF52840) resolve this? And how to apply sd_ble_gap_tx_power_set() to the codes because I cannot find the function in the UART despite searching the whole file, any place I can learn to do this and if doing so will resolve the issue I am facing? Thank you.

  • Hi Haakonsh, I tried to build again and still got the same message. However, I chanced upon a thread which allows the UART Long Range to work but have yet to test. (click here for link) I then tried to send messages from the peripheral to central it was able to work. However, when I sent from the Central to peripheral the messages did not go through smoothly and there was some packet loss. Any idea why this is the case?

  • do you not get a more verbose debug log with the DEBUG flag enabled? 

    Check the logger module's configuration in sdk_config.h, there's should be a verbosity setting. 

    I'm going on vacation for a week, but I'll assign your case to another Tech Supporter.

    BR,

    Håkon Holdhus

  • Alright thank for your help Håkon, have a safe trip. 

    To the next Tech Supporter:

    I changed the sdk_config.h (NRF_LOG_DEFAULT_LEVEL) and was able to get a more detailed debug message.

    Peripheral side:

    <info> app_timer: RTC: initialized.
    <info> app: Debug logging for UART over RTT started.
    <debug> nrf_ble_gatt: Requesting to update ATT MTU to 247 bytes on connection 0x0.
    <debug> nrf_ble_gatt: Updating data length to 251 on connection 0x0.
    <info> app: Connected
    <debug> nrf_ble_gatt: ATT MTU updated to 23 bytes on connection 0x0 (response).
    <info> app: Data len is set to 0x14(20)
    <debug> app: ATT MTU exchange completed. central 0xF7 peripheral 0xF7
    <debug> nrf_ble_gatt: Data length updated to 27 on connection 0x0.
    <debug> nrf_ble_gatt: max_rx_octets: 27
    <debug> nrf_ble_gatt: max_tx_octets: 27
    <debug> nrf_ble_gatt: max_rx_time: 2704
    <debug> nrf_ble_gatt: max_tx_time: 2704
    <debug> app: ATT MTU exchange completed. central 0xF7 peripheral 0xF7
    

    Central side:
    <debug> ble_scan: Added filter on UUID 1
    <info> app: BLE UART central example started.
    <debug> ble_scan: Scanning
    <debug> ble_scan: Connecting
    <debug> ble_scan: Connection status: 0
    <info> app: Connecting to target A5C8B8E093D3
    <debug> ble_db_disc: Starting discovery of service with UUID 0x1 on connection handle 0x0.
    <debug> nrf_ble_gatt: Peer on connection 0x0 requested an ATT MTU of 247 bytes.
    <debug> nrf_ble_gatt: Updating ATT MTU to 23 bytes (desired: 23) on connection 0x0.
    <info> app: ATT MTU exchange completed.
    <info> app: Ble NUS max data length set to 0x14(20)
    <debug> nrf_ble_gatt: Peer on connection 0x0 requested a data length of 251 bytes.
    <debug> nrf_ble_gatt: Updating data length to 27 on connection 0x0.
    <debug> nrf_ble_gatt: Data length updated to 27 on connection 0x0.
    <debug> nrf_ble_gatt: max_rx_octets: 27
    <debug> nrf_ble_gatt: max_tx_octets: 27
    <debug> nrf_ble_gatt: max_rx_time: 2704
    <debug> nrf_ble_gatt: max_tx_time: 2704
    <debug> ble_db_disc: Found service UUID 0x1.
    <debug> ble_db_disc: Discovery of service with UUID 0x1 completed with success on connection handle 0x0.
    <info> app: Discovery complete.
    <info> app: Connected to device with Nordic UART Service.


  • Hi

    I have taken over this case while Håkon is taking some time off. You say that you immediately see a disconnection after the connection, but I can't see any disconnection happening in the logs you have provided. Upon disconnection, you should be able to see a disconnect reason after the devices disconnect.

    Best regards,

    Simon

  • Hi Simonr, thank you for the guidance, appreciate the help. I tried another UART long-range example here: (link) and got the UART long-range to work. The debug messages are shown above on 25 Jul 2020.

    However, when I am sending messages via Putty from the Central side to the Peripheral side the messages I was sending was not consistent. Not consistent as in every time I hit the enter button the messages don't get sent. I am not able to understand why or if the function uart_event_handle(app_uart_evt_t * p_event) under main.c is responsible for such an outcome.

Related