MPSL_TIMESLOT_SIGNAL_RADIO - MPSL Radio Interrupt Expected Usage (driving ESB)

For reference I am using NCS v2.0 and VSCode with the NCS extension and coding in C++.

Hi, can you help clarify the expected behavior and usage of the MPSL_TIMESLOT_SIGNAL_RADIO signal?

I can see a few details from the MPSL API page (link

void MPSL_IRQ_RADIO_Handler(void)
RADIO interrupt handler.

Note: This handler should be placed in the interrupt vector table. The interrupt priority level should be priority 0.

...

MPSL_TIMESLOT_SIGNAL_RADIO
This signal indicates the RADIO interrupt. The signal will be executed in the same context as MPSL_IRQ_RADIO_Handler.

It isn't clear to me the meaning of how to use this information.

I have found the Nordic blog post  Updating to the MPSL Timeslot interface regarding MPSL and ESB. 

Looking at the source code, the MPSL_TIMESLOT_SIGNAL_RADIO event triggers calling RADIO_IRQHandler().

I can see in the nrf esb.c file there is such a function

ISR_DIRECT_DECLARE(RADIO_IRQHandler)
{
	radio_irq_handler();

	ISR_DIRECT_PM();

	return 1;
}

Question 1

So it seems that the Nordic example is what, receiving radio interrupts and routing them to the MPSL_TIMESLOT_SIGNAL_RADIO event?

Should I understand that if I'm driving another radio protocol, like ESB, that I have to forward radio event notifications to that protocol's radio ISR?

I have confirmed by implementing this that calling RADIO_IRQHandler() is necessary for the ESB example to work.

Question 2

Regarding the API page, for the MPSL_IRQ_RADIO_Handler(), when it says "This handler should be placed in the interrupt vector table", what does that mean?  Am I able to put the RADIO_IRQHandler() into an interrupt vector so I don't have to call it from the MPSL_TIMESLOT_SIGNAL_RADIO event myself?

Question 3

I can't seem to get access to the RADIO_IRQHandler() from my code without modifying the esb.h file to put an extern statement at the top.

extern void RADIO_IRQHandler();

I'm kind of baffled by that, I tried putting the exact same extern statement into the C++ file of my application and I get undefined reference to `RADIO_IRQHandler()' when compiling.  Unclear why or how I can work around that.  I don't want to edit the esb.h file.  Can you suggest what I do differently?

Thanks.

Parents
  • Hi,

    So it seems that the Nordic example is what, receiving radio interrupts and routing them to the MPSL_TIMESLOT_SIGNAL_RADIO event?

    Correct.

    Should I understand that if I'm driving another radio protocol, like ESB, that I have to forward radio event notifications to that protocol's radio ISR?

    Yes, you would need to handle this in the MPSL_TIMESLOT_SIGNAL_RADIO, but we are working on some new features so that you can fully uninitialize MPSL/SDC, and run ESB without using timeslots. This will hopefully be ready in some weeks/months. Here is one of the PR that will make this possible: https://github.com/nrfconnect/sdk-nrf/pull/8613

    Regarding the API page, for the MPSL_IRQ_RADIO_Handler(), when it says "This handler should be placed in the interrupt vector table", what does that mean? 

    The MPSL subsys does it for you in mpsl_init.c, it's not something you have to do in your code. https://github.com/nrfconnect/sdk-nrf/blob/v2.0.2/subsys/mpsl/init/mpsl_init.c#L188

    Am I able to put the RADIO_IRQHandler() into an interrupt vector so I don't have to call it from the MPSL_TIMESLOT_SIGNAL_RADIO event myself?

    This will be possible in the future, ref my answer previously. (MPSL will need to be uninitialized before you can register your own radio IRQ handler)

    I can't seem to get access to the RADIO_IRQHandler()

    Not sure what you are trying to do here, but the ESB RADIO_IRQHandler is here, and it calls the function radio_irq_handler().

  • Thank you for all of that, I understand.

    Not sure what you are trying to do here, but the ESB RADIO_IRQHandler is here, and it calls the function radio_irq_handler().

    I'm saying, I have to call RADIO_IRQHandler() from my MPSL handler.  But when I try to, it doesn't work, and I get a compiler error saying undefined reference to `RADIO_IRQHandler()'.

    The only way I can fix the compiler error is to modify your esb.h and putting "extern RADIO_IRQHandler();" at the top.

    I don't think I should have to modify your esb.h file.  I thought I'd be able to put that extern statement in my .cpp file, but that doesn't work.

    So, specifically, if I put the extern statement in the esb.h file, compile works, if I put the extern statement in my .cpp file, the compile fails.

    Any idea why the build process is failing in this case?

    Thanks.

  • Hi,

    I think the right approach here would be to call radio_irq_handler() from the MPSL handler.

    Do you need to use BLE and ESB concurrently? If not, then it might be better to wait until we have finished the ongoing work I mentioned in my first reply.

    Sigurd said:
    we are working on some new features so that you can fully uninitialize MPSL/SDC, and run ESB without using timeslots.
  • Hi, I do need to use them concurrently.

    Do you know the answer to my question about why I need to modify the esb.h header file in order for the build to work properly?

    Also, how do I learn about new features like what you're describing?  I'm unfamiliar with how you make updates/releases to NCS.  Is there a page with a changelog?

    Thanks.

  • douglas.malnati said:
    Do you know the answer to my question about why I need to modify the esb.h header file in order for the build to work properly?

    It's meant to be internal to esb.c only. Here are the functions that can be called from "outside" of esb.c: https://github.com/nrfconnect/sdk-nrf/blob/main/include/esb.h

    douglas.malnati said:
    Also, how do I learn about new features like what you're describing?  I'm unfamiliar with how you make updates/releases to NCS.  Is there a page with a changelog?

    We have a changelog in the release notes:https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/release_notes.html

  • Hi, thanks.

    I'm confused about your answer, can you help clarify.  It seems I'm being told two contradictory things.

    the right approach here would be to call radio_irq_handler() from the MPSL handler
    It's meant to be internal to esb.c only

    So, I should be calling radio_irq_handler() in order for MPSL to work with ESB, but at the same time the radio_irq_handler() is private (unless I go modify your source code).

    This doesn't seem consistent.

    What is the supported way for me to use MPSL and ESB at the same time?  If it requires that I call radio_irq_handler() from within my MPSL code, then the function should be exposed to me instead of me modifying your source code.

    What are your thoughts?

    Thanks.

Reply
  • Hi, thanks.

    I'm confused about your answer, can you help clarify.  It seems I'm being told two contradictory things.

    the right approach here would be to call radio_irq_handler() from the MPSL handler
    It's meant to be internal to esb.c only

    So, I should be calling radio_irq_handler() in order for MPSL to work with ESB, but at the same time the radio_irq_handler() is private (unless I go modify your source code).

    This doesn't seem consistent.

    What is the supported way for me to use MPSL and ESB at the same time?  If it requires that I call radio_irq_handler() from within my MPSL code, then the function should be exposed to me instead of me modifying your source code.

    What are your thoughts?

    Thanks.

Children
Related