[solved] Interrupt priorities
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2014-11-25 4:18 AM
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, PatrikSolved! Go to Solution.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-04-23 9:28 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2014-11-27 12:30 AM
Hello Patrik ,
We are investigating the issue Best Regards Erwan- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2014-12-11 10:31 PM
Dear Erwan,
Can you already give me a hint how I can avoid the described behaviour? I thought about locking other interrupts during the UART receive process. Is there a way to lock parts of the source code (e.g. an interrupt handler) that it can not be interrupted from another interrupt source? Best regards, Patrik- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-01-21 8:53 AM
Hello Patrik ,
Sorry for the late answer.osalSysLockFromISR is used to enter to a critical zone.OSAL_USE_IRQ_PREEMPTION is not defined (cf osal.h)you can try to define OSAL_USE_IRQ_PREEMPTION in your project (Platform component)but we have not tested this case.Which speed do you try to validate ? best regards Erwan- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-01-23 3:50 AM
Hello Erwan,
I have added a picture which shows the loss of UART data (hope it worked). The PIT interrupt raises every 100ms and can´t be interrupted from the UART RX interrupt. UART baud rate was configured as 460800. Best regards, Patrik ________________ Attachments : pic.png : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HyLa&d=%2Fa%2F0X0000000bZq%2FEx56LI44R7FHrFI4CPZ_DHJPwcDyMZa4VSdrVMigVak&asPdf=false- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-01-30 2:01 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-02-01 10:52 PM
Hello Erwan,
do you mean to setOSAL_ENABLE_IRQ_PREEMPTION
in osal.h to TRUE? I never tried to change any of theses default settings./*===========================================================================*/
/* Module pre-compile time settings. */
/*===========================================================================*/
/**
* @brief Enables the interrupts during the ISRs execution.
*/
#if !defined(OSAL_ENABLE_IRQ_PREEMPTION) || defined(__DOXYGEN__)
#define OSAL_ENABLE_IRQ_PREEMPTION FALSE
#endif
For what is PIT_0 used in default configuration?
Best regards,
Patrik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-02-02 8:58 AM
Hello Patrick ,
OSAL_ENABLE_IRQ_PREEMPTION
is configurable on OSAL Component. (Configuration level) FALSE by default#if OSAL_ENABLE_IRQ_PREEMPTION
/* Allows preemption while executing the software handler.*/
wrteei 1
#endif
/* Executes the software handler.*/
bctrl
#if OSAL_ENABLE_IRQ_PREEMPTION
/* Prevents preemption again.*/
wrteei 0
#endif
PIT_0 is used for 1ms tick (os-less)
If you think that the Tick is too heavy, you can try to enable this feature.
Best Regards
Erwan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-02-03 5:53 AM
Hi Patrik,
At which baud rate you start to experience the issue? Giovanni- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2015-02-03 6:59 AM
Hello Giovanni,
I tried three baud rates. It worked with 57,6kb/s, but not with 460,8kb/s and 128kb/s. Best regards, Patrik