BT_Enable Function stuck in bt_rpmsg_platform_endpoint_is_bound() for nrf5340

Hello, 

I am having an issue with board bring up for a custom board I developed using the nrf5340 processor. 

I have created firmware based off the peripheral_uart sample that works on the nrf5340-dk.

My issue is my code is in bt_enable() only on the custom board, the code works perfectly fine on the dk board. 

It appears there is something wrong within the communication between the app and network core. When I step through the bt_enable function it looks like we are hung up in the following lines of code:

 

 

 

In the past I have been able to unlock the network core when running into issues on the dk boards with the following recovery/unlock commands but that didn’t seem to remedy the issue:

 

nrfjprog -f NRF53 --coprocessor CP_NETWORK --recover

nrfjprog -f NRF53 --coprocessor CP_NETWORK --program merged_CPUNET.hex --chiperase

nrfjprog --pinreset

 

It looks like quite a few people have had similar issues on the Dev Zone, but I don’t see a lot of answered tickets. 

Any help would be appreciated. 

Thanks, 

Matt 

Parents
  • Hello Matt,

    Does your custom board include the optional LF crystal shown in the ref. schematics below?

    If not, and assuming you are using the DK board files,  please make sure you have selected the internal RC oscillator as the clock source for the netcore image too. These clock settings can be applied by adding a new config file in the child_image folder (/peripheral_uart/child_image/hci_rpmsg/boards). You can make a copy of the existing thingy53_nrf5340_cpunet.conf file and rename it to nrf5340dk_nrf5340_cpunet.conf.

    Best regards,

    Vidar

  • Hi Vidar, 

    Thanks for your reply. 

    No, I do not have an external LF crystal. 

    The program is still stuck in bt_enable() after making the following changes: 

    1. Add the following lines to proj.conf: 

    #config internal crystal for XL1/Xl2 oscillator
    CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y
    CONFIG_BT_SMP=y
    CONFIG_CLOCK_CONTROL_NRF_K32SRC_500PPM=y

    2. Copy and rename following file /peripheral_uart/child_image/hci_rpmsg/boards/thingy53_nrf5340_cpunet.conf

    3. Added the following lines to the nrf5340dk_nrf5340_cpunet.conf file:

    #config internal crystal for XL1/Xl2 oscillator
    CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y
    CONFIG_BT_SMP=y
    CONFIG_CLOCK_CONTROL_NRF_K32SRC_500PPM=y
    Any other suggestions? 
    Kind regards, 
    Matt 
  • Hi Vidar, 

    I added the following config:

    CONFIG_SOC_HFXO_CAP_EXTERNAL=y to both app and network core. 

    And confirmed the internal caps were disabled in ozone:

    And it appears to be connecting (tested by sending a 240 byte buffer of dummy data to central) but the connection is not stable, it appears to be working, sending a few packets then the connection drops and I have to reset my board to reconnect where it again sends a few packets, then drops and requires a reset.    

    This code was tested on the dk board so I dont believe it to be a software issue. 

    Do you have any other suggestions? 

    Thanks for your help, 

    Matt 

     

  • Hi Matt,

    The connection loss could be a symptom of poor link quality. Do you have debug logging enabled in your peripheral project? It would be good to know what the disconnect reason is. For a bad connection I would expect the reason to be BT_HCI_ERR_CONN_TIMEOUT in most cases.

    Also, it would be good if you could try to connect with it using the nRF connect app on Android or iOS to see if it gives you the same result.

    Disconnect reason is logged over RTT if you use the peripheral_uart example as you can see here: https://github.com/nrfconnect/sdk-nrf/blob/2bee52d57e51cbe3108f0bbcb9ed68743bcd4e40/samples/bluetooth/peripheral_uart/src/main.c#L346

    Vidar

  • Hi Vedar, 

    You are correct, I am getting the  BT_HCI_ERR_CONN_TIMEOUT  error when viewing the RTT logs. 

    In my code, I am able to reliably connect to the other nrf5340-dk I am using as a central device, but it cuts out after a while and requires a reset to re-connect. 

    As a test, I have an LED that turns on when the device is connected over BLE on my board. Then turns off when its disconnected. When connecting over nrf connect for IOS I am able to toggle the LED manually and the connection appears to be stable. It is when I try to send data over my service to the nrf5340-dk that is running the modified central application that I am running into this issue. 

    Do you have any suggestions for what could be causing the  BT_HCI_ERR_CONN_TIMEOUT?

    I already tried investigating the XFXO oscillator as a possible source of the issue since I was originally using external caps, so I re-configured the following for internal caps: 

    1. Removing the external caps I had connected to the HFXO oscillator 

    2. Calculating the internal CL values as 12.5pF for my XTal with a CL of 8pF 

    3. Adding the following configs to both cores config files: 

    CONFIG_SOC_HFXO_CAP_INTERNAL=y
    CONFIG_SOC_HFXO_CAP_INT_VALUE_X2=25

    Thanks again for all your help, 

    Matt 

  • Hi Matt,

    It's interesting that the central side has to be reset to re-connect. Isn't that supposed to happen automatically after a disconnect? I would suggest to check the debug logs from the central side as well, maybe there is an assert exception that causes the program to hang and require a reset to recover. Though I don't have a good explanation as to why this would only happen when connected to your custom board and not another DK.

    There should not be an issue with the HFXO, or the LFCLK for that matter, as you are able to maintain the connection with your iOS device just fine.

    Vidar

  • Hi Vidar, 

    I was able to get it working after all, It turns out it was an electrical issue with the board I was trying to bring up.

    After making all the modifications that are listed above to a fresh board I was able to get it up and working and the connection seems to be stable, transmitting the correct data. 

    Thank you so much for all your help, I really appreciate the level of detail you included in your responses. 

    Kind regards, 

    Matt 

Reply
  • Hi Vidar, 

    I was able to get it working after all, It turns out it was an electrical issue with the board I was trying to bring up.

    After making all the modifications that are listed above to a fresh board I was able to get it up and working and the connection seems to be stable, transmitting the correct data. 

    Thank you so much for all your help, I really appreciate the level of detail you included in your responses. 

    Kind regards, 

    Matt 

Children
Related