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

pc-ble-driver problem : target reset after starting scanning

Hi,

We have a Gateway based on mediatek MT7688 MIPS 32bits architecture CPU, and we integrate an nRF523832 chip to acquire BLE packets.

The gateway uses OpenWrt OS, and communicates with the nRF52832 chip over UART using pc-ble-driver in my application.

I am using pc-ble-driver-connectivity-V4.1.1.

My problem is : in order to test the pc-ble-driver on the gatewen, i used the heart rate collector example, and when i start scanning, it is fine, i acquire packets (ble address, rssi, channel id ...etc), but after a while, the scan stops suddenly and i have these messages : "Status: 6, message: Target Reset performed , Status: 7, message: Connection active" .

i tried many times but the result is the same, the target restarts suddenly !

And the time between the application start and the target reset is completely random ! (20 seconds, 45 seconds , 10 seconds)

See the attached image for more details.

Any one have an idea why the target restarts suddenly ?

Thanks,

Parents
  • Hello,

    The line: "Failed to receive response for command"

    comes from serialization_transport.cpp, from the SerializationTransport::send() function. It is the NRF_ERROR_SD_RPC_SERIALIZATION_TRANSPORT_NO_RESPONSE return value (0x8016) that is returned. 

    "Error sending packet to target. Code:" is printed from encode_decode() in ble_common.cpp. 

    The reason why this happens is not easy to say. It means that the nRF has stopped responding. How did you program the device, and with what?

    It looks like the application is trying to reset the nRF, but that it isn't able to do so. Did you connect the reset pin to your controller? And did you shorten SB 17 on the DK? The log doesn't say why it attempts to reset the device, though. Can you try to set a breakpoint on the line saying "Target Reset performed", and see if you can see from the callstack why this is called?

    Best regards,

    Edvin

Reply
  • Hello,

    The line: "Failed to receive response for command"

    comes from serialization_transport.cpp, from the SerializationTransport::send() function. It is the NRF_ERROR_SD_RPC_SERIALIZATION_TRANSPORT_NO_RESPONSE return value (0x8016) that is returned. 

    "Error sending packet to target. Code:" is printed from encode_decode() in ble_common.cpp. 

    The reason why this happens is not easy to say. It means that the nRF has stopped responding. How did you program the device, and with what?

    It looks like the application is trying to reset the nRF, but that it isn't able to do so. Did you connect the reset pin to your controller? And did you shorten SB 17 on the DK? The log doesn't say why it attempts to reset the device, though. Can you try to set a breakpoint on the line saying "Target Reset performed", and see if you can see from the callstack why this is called?

    Best regards,

    Edvin

Children
  • Hello,

    Thanks for reply,

    • The application turns in the gateway (MT7688 MIPS 32bits architecture CPU) with OpenWrt OS.
    • I have programmed the nrf52832 chip with connectivity_4.0.0_1m_with_s132_6.1.0.hex which is present in the git repository.
    • the nrf52832 is not a DK but it is in the gateway on the same PCB as the MT7688 MIPS 32bits architecture CPU (see attached images).
    • I used the heart_rate_collector example in the pc-ble-driver repository.

    unfortunately, i cannot debug on the gateway for the moment, it is very difficult (if no choice, i will try with gdb server on remote !!)

    Do you think that my problem is that the pc-ble-driver is not compatible with embedded architectures ? or...

    Best regards,

  • Can you see whether you are able to reproduce it using a DK so that you have debugging capabilities? I believe development would be a bit easier if you are able to debug.

  • With exactly the same application (same code heart_rate_collector and same pc-ble-driver) on my pc (ubuntu 18.04 LTS) and nRF52, i don't have the problem, now it's been 3 hours since the application runs and no problem !!

    I don't understand why it crashes in the gateway after few sencods!!

    Thanks,

  • Me neither.

    What are the differences between the DK and your PCB? Do you use the same crystals? Do you have a Low frequency Xtal? The 32KHz? Although if you are able to scan that doesn't seem like the issue, but I am just trying to think of possible reasons. 

    And again, can you try to set a breakpoint on the line where it says: "Status 6, message: Target reset performed", and see if you can determine from the callstack why this happens? What caused the device to try to reset the nRF?

  • finally, i can debug on the gateway now Slight smile

    attached the callstack.

    Do you see something interesting ?

    Edit : i have a remark :

    when i add a usleep(50000) just before sd_ble_gap_scan_start() on on_adv_report() it seems like the reset time before reset is bigger > 4 min

    static void on_adv_report(const ble_gap_evt_t * const p_ble_gap_evt)
    {
        uint32_t err_code;
        uint8_t  str[STRING_BUFFER_SIZE] = {0};
    
        // Log the Bluetooth device address of advertisement packet received.
        ble_address_to_string_convert(p_ble_gap_evt->params.adv_report.peer_addr, str);
        
        printf("address: 0x%s", str);
        fflush(stdout);
        printf(" - ch_idx : %d ", p_ble_gap_evt->params.adv_report.ch_index);
        fflush(stdout);
        printf(" - rssi : %d \n", p_ble_gap_evt->params.adv_report.rssi);
        fflush(stdout);
    
        //wait
        usleep(50000);
    
        err_code = sd_ble_gap_scan_start(m_adapter, NULL, NULL);
        if (err_code != NRF_SUCCESS)
        {
           printf("Scan start failed with error code: 0x%02X\n", err_code);
            fflush(stdout);
        }
    
    }

    my supposition : it seems like the problem is sd_ble_gap_scan_start(), the call of this method is very fast and the transport fails !!!

Related