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

Know when the softdevice / Interrupt took control

Hi,

I'm developing a unit which i need from time to time to send a packet throw I/O lines (F.E.virtual uart)

However the packet bit timing is very critical.

As far as i understand, when using a softdevice, the softdevice can interrupt me whenever he needed (& also, other interrupts)

that's ok,  but i need to know that the softdevice interrupted me (or other interrupts occered), ruined my packet timing and i'll take care of it and resend the packet again.

What i thought of is making a flag and check at the end of my packet transmition it's status (if it still 0 - then no interrupt were made)....

So, Where shoud i put the "flag=1" ? is there a centrer place that i can raise this flag and know that the soft device / Other interrupt took control/were made ?

B.R

Yuval

Parents
  • Hi Yuval,

    Interrupts for the SoftDevice are not propagated to the application, except for in cases where the SoftDevice notifies the application about something in the form of an event by calling the registered event handler(s). Therefor the method of setting a flag in the application indicating that the SoftDevice has interrupted you will not work. However, that may not be needed as there are a few other options worth considering:

    • The application can use the Timeslot API to obtain a timeslot where it is guaranteed to not be interrupted by the SoftDevice. This API is intended to be used for implementing a second concurrent radio protocol, but it can be used for any situation where the application needs full control for a limited duration of time with a guarantee that there will be no SoftDevice interrupts.
    • The UART peripheral support DMA, so a SoftDevice interrupt will not affect an ongoing transaction. The CPU is only needed to set up the transaction. If I understood your use case correctly, this will circumvent the whole problem.

    Br,

    Einar

Reply
  • Hi Yuval,

    Interrupts for the SoftDevice are not propagated to the application, except for in cases where the SoftDevice notifies the application about something in the form of an event by calling the registered event handler(s). Therefor the method of setting a flag in the application indicating that the SoftDevice has interrupted you will not work. However, that may not be needed as there are a few other options worth considering:

    • The application can use the Timeslot API to obtain a timeslot where it is guaranteed to not be interrupted by the SoftDevice. This API is intended to be used for implementing a second concurrent radio protocol, but it can be used for any situation where the application needs full control for a limited duration of time with a guarantee that there will be no SoftDevice interrupts.
    • The UART peripheral support DMA, so a SoftDevice interrupt will not affect an ongoing transaction. The CPU is only needed to set up the transaction. If I understood your use case correctly, this will circumvent the whole problem.

    Br,

    Einar

Children
No Data
Related