FreeRTOS : Inerrupts
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-11-04 8:53 AM
I work with FreeRTOS and I have two interrupts that can be triggered at the same time: An interrupt on a Timer in Input Capture mode (because I'm working with an ultrasound sensor HCSR04) and a UART interrupt (which is the reception of 'a character ). The interrupt on the timer is still not functional which causes the loss of sensor information. How to handle both interrupts in this case?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-11-04 10:04 AM
For simultaneous interrupts you will have to decide which has the higher priority by assigning NVIC priority levels to each request source. If you assign the same priority to both requests then one or the other will be handled first. You can use nested interrupts (supported in FreeRTOS) to immediately go from one ISR to the next without a stack pop/push (look up tailchaining in the NVIC).
If your design can't tolerate one interrupt waiting for the other to complete then you may have to look for a dual-core processor that can execute two instruction streams at the same time.
Jack Peacock
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-11-04 11:51 PM
Thank you Jack :)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-11-05 1:38 AM
If the timer interrupt is not working at all, then either the expected event is not happening, you haven't enabled it or some other higher priority interrupt is stuck in a loop. If it's working but is executed after UART interrupt, it doesn't impact the measured data because the time value is captured by timer hardware independently.
Additional tip - use timer not only for input capture, but also use an another channel of the same timer for trigger signal generation. That way the whole trigger-capture process can be done by hardware and you will get the best accuracy unaffected by software timings.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-11-05 1:41 AM
I hope that was not a suggestion to use dual core because of that sensor... ;)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-11-05 1:54 AM
Thank you Piranha for your help
