FreeRTOS/ARM - does it use interrupts? - Page 1
Forum section: electronics / general

author: alank2
author_rank: Super Contributor
timestamp: June 06, 2017, 02:14:07 am
content: Hi Everyone,I've only done AVR microcontroller programming for a few years and I understand how interrupts work on AVR's. I'm going to be working on an ST project that uses FreeRTOS soon and I wonder - does FreeRTOS use interrupts as well? Or do you just schedule a task to run as quickly as you need and it polls? I'm going to be using a UART on it.Thanks,Alan

author: Kjelt
author_rank: Super Contributor
timestamp: June 06, 2017, 05:16:58 am
content: Rtos uses timerticks for scheduling which in the basis are using a timer interrupt but the programmer does not need to bother with it. In the beginning you start all threads and if not used you let them (conditionally) sleep. Rtos has a very good website with lots of documentation and also free downloadable book, I would suggest to start reading there and when done start with a small project and do simple steps to get the grasp.

author: hans
author_rank: Super Contributor
timestamp: June 06, 2017, 06:10:42 am
content: Yes almost all RTOS implementations use interrupts.A timer is used as a timebase for the system, which can trigger the scheduler to review the current set of tasks and dispatch a higher priority task that comes out of sleep (e.g. if you use a time delay in the function).Most ARM implementations I've seen also usesoftwareinterrupts like system calls, to trigger context switches and/or switch to "kernel mode" (depends on how religiously that has been implemented) to do the "magic" a nice RTOS should provide.If you're concerned about UART and most likely the interrupts you'll use there; then make sure nested interrupts is enabled and that the RTOS interrupts are set to a lower priority than the UART.If you then keep the UART interrupts very short (write data to buffer and use some IPC from FreeRTOS to trigger a task for processing), it will work quite well.

author: tggzzz
author_rank: Super Contributor
timestamp: June 06, 2017, 07:54:31 am
content: Quote from: hans on June 06, 2017, 06:10:42 amIndeed.A notable exception is the XMOS processors, which have up to 32 independent cores, "FPGA-like" i/o structures, timing guaranteed by design in the IDE (not by measurements), and i/o timings measured in ns not us or ms. How?You dedicate a core to servicing a peripheral, so no i/o and that core sleeps.The "RTOS" is a combination of hardware and the xC language, which has parallel constructs added to C.Great for bit-banging, and more.

author: Jeroen3
author_rank: Super Contributor
timestamp: June 06, 2017, 08:26:23 am
content: If you are new to ARM Cortex, I suggest you find a (digital) copy of this book:The Definitive Guide to ARM® Cortex®-M3 and Cortex®-M4 ProcessorsBy Joseph Yiu.Or the M3 only version.Don't get scared by the size of the book. You don't need all chapters to get your application running.

author: mikerj
author_rank: Super Contributor
timestamp: June 06, 2017, 10:16:30 am
content: Quote from: Jeroen3 on June 06, 2017, 08:26:23 amAlso read the FreeRTOS documentation regarding Cortex M micros. And then read it several more times, but you'll almost certainly still get it wrong the first time.

author: RichardBarry
author_rank: Newbie
timestamp: June 06, 2017, 01:55:00 pm
content: Interrupts on a Cortex-M are much more complex than an AVR, especially as the FreeRTOS Cortex-M port supports interrupt nesting whereas the AVR port does not. See the following:http://www.freertos.org/RTOS-Cortex-M3-M4.htmlFreeRTOS uses the SysTick interrupt to generate the RTOS tick, the SVC interrupt to start the scheduler, and the PendSV interrupt for context switching. Q1 on of the following FAQ page shows how to install them:http://www.freertos.org/FAQHelp.html

author: Kjelt
author_rank: Super Contributor
timestamp: June 06, 2017, 03:01:36 pm
content: Quote from: RichardBarry on June 06, 2017, 01:55:00 pmAre you THE Richard Barry ?

author: mubes
author_rank: Regular Contributor
timestamp: June 06, 2017, 07:41:34 pm
content: Quote from: Kjelt on June 06, 2017, 03:01:36 pmSurely there can be only one?? :-)Dave

author: mac.6
author_rank: Regular Contributor
timestamp: June 07, 2017, 07:08:18 am
content: Quote from: RichardBarry on June 06, 2017, 01:55:00 pmNote that basic implementation use systick, but there is vendor specific port to use other sources, especially when dealing with low power and tickless scheduling.http://www.freertos.org/low-power-cortex-rtos.html