application runs 9 times out of 10 NRF_ERROR_RESOURCES error free and then, once in a while, NRF_ERROR_RESOURCES massively present from the beginning

To the kind attention of Nordic support team,

I'm testing a freertos project, with softdevice and radio notifications. A constant number of notifications is queued before the starting of the connection interval, and sent during the connection interval itself. It works very well, I get this high speed data stream. Every time I get a sporadic NRF_ERROR_RESOURCES, the feedback mechanism exploiting BLE_GATTS_EVT_HVN_TX_COMPLETE starts working as well, and the resource error disappear after a while.

Everything works fine, like 9 executions of the program out of 10 are really stable and NRF_ERROR_RESOURCES free. If I reset (Ctrl+Shift+F5 using Segger), it seems that, once in a while, from the beginning of the connection NRF_ERROR_RESOURCES is massively there, and it never goes away. Only reducing the number of queued notifications help.

But why the number of notifications should be reduced once in a while? All this sounds to you like a problem in the application, or there could be something changing in the connection? I thought about master forcing a different connection interval than the desired one. But using BLE_GAP_EVT_CONN_PARAM_UPDATE_REQUEST I have no evidence for now that this behavior is due to a change in connection interval timing. I attached systemview files to the project and next days I'll be possibly able to post some more thing about this issue (also I'm gonna use Nordic sniffer). Really, just a quick opinion from your experts would be very much appreciated. Also, any debug strategy you would recommend.

Thank you in advance, best regards.

Parents
  • Hi Einar, I have a very simple application, without freertos and using softdevice s140 7.3.0. I enabled radio notifications and I can see, at least observing systemview output, that sw1 frequency is not constant.

    This is what this test code looks like. Ble_SendReportHVX(); is also called when BLE_GATTS_EVT_HVN_TX_COMPLETE. 

    void Common_Init()
    {
        Ble_PeerManager_Init();
        
        Ble_Start();
     
        Ble_StartAdvertising(NULL);
        
        while(1){
           Ble_SendReportHVX();
           nrf_sdh_evts_poll();    
        }
    }

        // Configure and initialize the BLE stack.
        if (!nrf_sdh_is_enabled())
            ble_stack_init();
    
        err_code = radio_notification_init(3, NRF_RADIO_NOTIFICATION_TYPE_INT_ON_INACTIVE, NRF_RADIO_NOTIFICATION_DISTANCE_1740US);
        APP_ERROR_CHECK(err_code);

    f

    That measure in systemview is:

    void SWI1_IRQHandler(bool radio_evt)
    {
        SEGGER_SYSVIEW_RecordEnterISR();
        if (radio_evt)
        {
          radio_evt_ok = true;
          if(m_number_of_packets_per_interval == 0)
          {
            m_number_of_packets_per_interval = MAXIMUM_NUMBER_PACKET_PER_INTERVAL;
          }
        }
        SEGGER_SYSVIEW_RecordExitISR(); 
    }

    Is it normal to have this sw1 behavior? Am I missing some setting? I expected to get a more regular sw1 timing. What could be the cause of this variability?

    Best regards

  • This is solving the previous issue, like this -triggering on active- the event is quite regular as expected:

    uint16_t err_code = radio_notification_init(2, NRF_RADIO_NOTIFICATION_TYPE_INT_ON_ACTIVE, NRF_RADIO_NOTIFICATION_DISTANCE_800US);

Reply Children
  • Hi,

    I am a bit confused and lack an overview here, so please bear with me.

    astella said:
    This is what this test code looks like. Ble_SendReportHVX(); is also called when BLE_GATTS_EVT_HVN_TX_COMPLETE. 

    There is not much to say here, other than note that you call Ble_SendReportHVX() for every time you poll for SDH events, which is a bit odd (you will probably get other events that are not BLE_GATTS_EVT_HVN_TX_COMPLETE). But I so not see your Ble_SendReportHVX() or your event handling so I cannot say to what extent this is just odd or problematic.

    astella said:
    Is it normal to have this sw1 behavior? Am I missing some setting? I expected to get a more regular sw1 timing. What could be the cause of this variability?

    I am not sure. What is SW1? What are you using radio notification fore? I am a bit confused about the whole ting. I am also not sure what you are seeing from the systemview, or if that is relevant at this point (it might be, it is just not clear to me). Perhaps you can backtrack a bit and focus on the main problem, that you are getting unexpected number of full buffers (NRF_ERROR_RESOURCES when doing notifications). What do you see from a sniffer trace? Is there something happening on air that could explain this?

  • Hi Einar, maybe I have found something. I had the idea, as also suggested in one of your Nordic threads to test my program in a regular pca10056, and not in my custom hardware. It seems that there could be some activity - from my sensors - that is disturbing the antenna. When executing in pca10056, softdevice tx buffer fills up, but it never has a hard time emptying itself. While in my hardware lot of noise could be the root cause of retransmissions and not exploited connection intervals. I got these two screenshot using Nordic power profiler:

    pca100556:

    my hardware:

    Is there any other debug technique you could please suggest in order to 100% validate this feeling? 

    Best regards

Related