This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

RTOS/CC1310: PIN driver and clock driver interrupt

Part Number: CC1310
Other Parts Discussed in Thread: SYSBIOS

Tool/software: TI-RTOS

Hello,

I have a question about a behaviour that I didn't wait.

I have an ISR executed on the edge of an input pin. The interrupt is enabled on both the edges. The pin is configured using the pin driver functions.

The pin ISR switches on one led and starts a clock. When the clock expires, the callback switches off the same led.

Just for test, I put a while(1) cycle in the pin ISR: the led is switched off the same. This is not the behaviour I thought to see, because I thought that the code remains blocked in the pin ISR.

I have some question about this:

1) Does the pin ISR work in the SWI context or in the HWI context?

2) And the clock ISR?

3) Is it correct that a HWI (or SWI) ISR is stopped by another interrupt?

Thanks in advance for your help, Andrea

  • Andrea,

    1) The HWI context

    2) The SWI context

    3) HWI and SWI both run to completion.

    Visit SimpleLink Academy here for more information on TI RTOS.

    BR,

    Seong

  • Hello Seong Kim,

    first of thank you very much for your answer.

    Excuse me but I can't see what you have written in your post. Using ROV, I can see that the callback I have registered as interrupt pin is indicated as PIN_swi. I can see that it has priority = 0. If I put a while(1) cycle inside the callback and block it, I can see that the clock function is executed after the time waited and using ROV I can see that the clock function has priority = 5.

    I don't know if this means that it is able to stop the pin callback, reading what you have said (HWI and SWI both run to completion) I suppose that the code should be blocked on the while(1) in the pin callback and never executes the clock function expiration, but it is not what I'm seeing.

    Have you got an idea of this?

    Thanks again, Andrea

  • Hey Andrea,

    While a HWI runs to completion and doesn't block on anything, they can get preempted by a higher priority HWI. SWIs are the same but are lower priority than HWIs.  SWIs are the same but run at lower priority than HWIs. See the TI-RTOS User's Guide here.

    With that said, because your clock function has higher priority is why you see what you're observing.

    Instead of experimenting with this, I recommend importing the SWI project found in the SDK's Sysbios example folder to CCS. Here you'll find 2 SWIs with different priority levels. Try changing the priorities of these SWIs and implementing infinite loops to better understand how TI-RTOS works.

    BR,

    Seong

  • Thank you very much Seong,

    I try to sumerize but I think it is clear now:

    1) HWI has a higher priority then SWI;

    2) HWI can be preempted by a higher HWI but not by SWI;

    3) SWI can be preempted by all HWI and by higher SWI;

    4) the clock SWI preemps the pin ISR because both are SWIs but the clock SWI has a higher priority then PIN SWI.

    Is it correct?

    Thanks again, Andrea 

  • Hey Andrea,

    Yes, you nailed it.

    BR,
    Seong