Skip to main content
Patriks
Senior
November 25, 2014
Solved

[solved] Interrupt priorities

  • November 25, 2014
  • 16 replies
  • 3283 views
Posted on November 25, 2014 at 13:18

Hello,

Yesterday, I investigated a problem with my software project for an SPC560B. There are several calculations running on the controller and it additionally communicates over UART with a PC. When I tried to increase the UART baud rate, I got the effect that the controllers ''miss'' some bytes sent by the PC.

I found out, that reason for that effekt has something to do with the UART RX interrupt and an interrupt created by the periodical timer PIT. After the PIT causes an interrupt, the UART RX can not trigger an interrupt. I always thought that a higher priority interrupt can break the program even when another lower prior interrupt is currently running?

Best regards,

Patrik
    This topic has been closed for replies.
    Best answer by Erwan YVIN
    Posted on April 23, 2015 at 18:28

    Hello Patrik ,

    The problem has been reproduced .

    in forcing in ivor.s, it is working.

    /* Allows preemption while executing the software handler.*/
    wrteei 1
    /* Executes the software handler.*/
    bctrl
    /* Prevents preemption again.*/
    wrteei 0

    Could you try this piece of code ''ivor.s'' ?

    The compilation switch was not taken in account.

    i am checking the platform configuration in SPC5studio

    Best Regards

    Erwan

    ________________

    Attachments :

    photo.JPG : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I0VV&d=%2Fa%2F0X0000000bZm%2FItO27sKjPGzL3Ya3K0cSNAw_8by8ZlvVr186uAmJKRE&asPdf=false

    16 replies

    Erwan YVIN
    ST Employee
    April 22, 2015
    Posted on April 22, 2015 at 18:12

    Hello Patrik ,

    Very strange, on SPC56xL , the preemption and nesting IRQ are activated by default. I will check this issue this thursday. could you check your CPR by debugger when the interruption is generated ?

    #define INTC_CPR(n) (*((volatile uint32_t *)(INTC_BASE + 8 + ((n) * sizeof (uint32_t)))))

    could you try INTC_EOIR(

    INTC_PSR_CORE0

    ) = 0 before the end of the interruption handler the two) ? Could you send me your application ? Best regards Erwan
    Patriks
    PatriksAuthor
    Senior
    April 23, 2015
    Posted on April 23, 2015 at 07:52

    Hello Erwan,

    I checked INTC_CPR_PCR0 register value. When interrupt is generated, the register shows the priority level of corresponding interrupt (8 or 2).

    Including

    INTC_EOIR(INTC_PSR_CORE0) = 0;

    at the end of interrupt handler has no effect onbehavior.

    You can find the project within the zip file attached to this post.

    Best regards,

    Patrik

    ________________

    Attachments :

    SPC56ELxx_OS-Less_Test_Application.7z : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I0Va&d=%2Fa%2F0X0000000bZn%2FqIArxY6dwHNPq0HRmyxV_4dS5_rQZbCuX9Dtc.yqw3E&asPdf=false
    Erwan YVIN
    ST Employee
    April 23, 2015
    Posted on April 23, 2015 at 10:46

    Thanks ;)

    We will check today

    Erwan YVIN
    Erwan YVINBest answer
    ST Employee
    April 23, 2015
    Posted on April 23, 2015 at 18:28

    Hello Patrik ,

    The problem has been reproduced .

    in forcing in ivor.s, it is working.

    /* Allows preemption while executing the software handler.*/
    wrteei 1
    /* Executes the software handler.*/
    bctrl
    /* Prevents preemption again.*/
    wrteei 0

    Could you try this piece of code ''ivor.s'' ?

    The compilation switch was not taken in account.

    i am checking the platform configuration in SPC5studio

    Best Regards

    Erwan

    ________________

    Attachments :

    photo.JPG : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I0VV&d=%2Fa%2F0X0000000bZm%2FItO27sKjPGzL3Ya3K0cSNAw_8by8ZlvVr186uAmJKRE&asPdf=false
    Patriks
    PatriksAuthor
    Senior
    April 24, 2015
    Posted on April 24, 2015 at 08:38

    Hello Erwan,

    That was the reason. After changing ivor.s it works. Thanks for your fast help!

    Best regards,

    Patrik
    Erwan YVIN
    ST Employee
    April 24, 2015
    Posted on April 24, 2015 at 09:19

    Hello Patrik ,

    we have submitted an Error Report to have this correction.

    sorry again for the issue

       Best regards

                  Erwan