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,

  • 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 !!!

  • Hello,

    I see that you did some changes to the on_adv_report() function, is that correct? Does it happen if you revert to the standard:

    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("Received advertisement report with device address: 0x%s\n", str);
        fflush(stdout);
    
        if (find_adv_name(&p_ble_gap_evt->params.adv_report, TARGET_DEV_NAME))
        {
            if (m_connected_devices >= MAX_PEER_COUNT || m_connection_is_in_progress)
            {
                return;
            }
    
            err_code = sd_ble_gap_connect(m_adapter,
                                          &(p_ble_gap_evt->params.adv_report.peer_addr),
                                          &m_scan_param,
                                          &m_connection_param
    #if NRF_SD_BLE_API >= 5
                                         , m_config_id
    #endif
                                         );
            if (err_code != NRF_SUCCESS)
            {
                printf("Connection Request Failed, reason %d\n", err_code);
                fflush(stdout);
                return;
            }
    
            m_connection_is_in_progress = true;
        }
    #if NRF_SD_BLE_API >= 6
        else {
            err_code = sd_ble_gap_scan_start(m_adapter, NULL, &m_adv_report_buffer);
    
            if (err_code != NRF_SUCCESS)
            {
                printf("Scan start failed with error code: %d\n", err_code);
                fflush(stdout);
            }
            else
            {
                printf("Scan started\n");
                fflush(stdout);
            }
        }
    #endif
    
    }

    Not saying that you can't do any changes, but just to pinpoint whether it is the changes or if it is something with the setup. Do you use the same baudrate/frequency as when you use the DK (and it doesn't fail)?


    Can you try to stop the debugger inside the sd_ble_gap_scan_start() and see what check or what function that returns the err_code != 0?

  • I have tested the heart_rate_collector as that without any modification, and still have the same problem.

    Yes, i used the same baudrate (1m) for both DK and gateway, and it doen't fail in the DK but fails in the gateway

    i have stopped the debugger inside the sd_ble_gap_scan_start() but i dont see anything that can help me !!.

    FYI: i have tested the heart_rate_collector in connectivity V3 with connectivity_2.0.1_1m_with_s132_5.0.hex and it works fine, no crashes since boot (7 hours)

  • Hello,

    I need to have someone who has worked a bit closer with serialization to have a look at this. But just to check: When you run on the DK, does it still say "Target Reset performed", but without the errors afterward?

Related