timeslot parameter setting and softdevice hang

Hi:

   when i set the timeslot parameter see below:I found it will run.However, after running for a few seconds, the program hangs. Debugging found that the softdevice hangs.(see the picture below).

my questions is:

1.why the "timeout_us"  parameter setting is too small, the program will hang instead of reporting an error state and let the program continue?

2.For app code that needs to be executed during a timeslot session, is there any requirement to put it in which function. My understanding is: as long as it is judged that the "NRF_RADIO_CALLBACK_SIGNAL_TYPE_START" signal is triggered, a global variable can be set, and my app will monitor this global variable. If the global variable is set, my program will be executed immediately.

3.If there is BLE network communication during the request timeslot (for example, I request a 100ms timeslot), will BLE data packets be lost at this time?

void configure_next_event_earliest(void)
{
    m_slot_length                                  = 80000;
    m_timeslot_request.request_type                = NRF_RADIO_REQ_TYPE_EARLIEST;
    m_timeslot_request.params.earliest.hfclk       = NRF_RADIO_HFCLK_CFG_XTAL_GUARANTEED;
    m_timeslot_request.params.earliest.priority    = NRF_RADIO_PRIORITY_HIGH;
    m_timeslot_request.params.earliest.length_us   = m_slot_length;
    m_timeslot_request.params.earliest.timeout_us  = 10000*100;
}

my SDK:15.0.0

softdevice:S132

IC:nrf52832

Parents
  • Hi Hung Bui

        Thanks. I now have a deeper understanding.

         But I haven't found the reason why my program hangs. Attached I uploaded the minimal code of my full project.

        The program applies for a timeslot of 100 ms with a timeout of 120 ms. When the timeslot is about to expire, it will apply for another timeslot of 100 ms, and so on.

       the log output see below.

    Meanwhile, I have two questions.

    1. The code in the blog, executing your own code in the timeslot is the way of using the interrupt.

    For example, "NVIC_SetPendingIRQ(TIMESLOT_BEGIN_IRQn);" The interrupt number used by TIMESLOT_BEGIN_IRQn is COMP_LPCOMP_IRQn. This is an interrupt number for existing hardware.

    My understanding is whether the interrupt number borrowed by timeslot can use the hardware interrupt number that is not used in the project。

    2.If my project uses BLE mesh. Is it not possible to use timeslot. Because I found that mesh itself also used timeslot. A timeslot session can only be opened once.

    nRF5_SDK_15.0.0_myTest.7z

Reply
  • Hi Hung Bui

        Thanks. I now have a deeper understanding.

         But I haven't found the reason why my program hangs. Attached I uploaded the minimal code of my full project.

        The program applies for a timeslot of 100 ms with a timeout of 120 ms. When the timeslot is about to expire, it will apply for another timeslot of 100 ms, and so on.

       the log output see below.

    Meanwhile, I have two questions.

    1. The code in the blog, executing your own code in the timeslot is the way of using the interrupt.

    For example, "NVIC_SetPendingIRQ(TIMESLOT_BEGIN_IRQn);" The interrupt number used by TIMESLOT_BEGIN_IRQn is COMP_LPCOMP_IRQn. This is an interrupt number for existing hardware.

    My understanding is whether the interrupt number borrowed by timeslot can use the hardware interrupt number that is not used in the project。

    2.If my project uses BLE mesh. Is it not possible to use timeslot. Because I found that mesh itself also used timeslot. A timeslot session can only be opened once.

    nRF5_SDK_15.0.0_myTest.7z

Children
  • Hi Zjw, 

    I haven't got time to look into  your code yet. I would suggest to use one of our example and modify it for your use. Our example have very similar mechanism where it request a timeslot and then try to expand it before it is expired. 

    Regarding your questions: 

    1. Correct, you can use the interrupt that is not used by the hardware for your own use. The main point here is to trigger an interrupt that has a lower priority than your current interrupt. So that you don't stay in the high priority interrupt handler for too long. 

    2. It can be a challenge to implement timeslot protocol with the mesh stack. As you mentioned the mesh stack also use timeslot. You may want to choose to pause the mesh stack for a period of time when you do your own timeslot. Could you give more information about your application ? 

Related