Author Topic: FreeRTOS/ARM - does it use interrupts?  (Read 4654 times)

0 Members and 1 Guest are viewing this topic.

Offline alank2Topic starter

  • Super Contributor
  • ***
  • Posts: 2185
FreeRTOS/ARM - does it use interrupts?
« on: June 06, 2017, 02:14:07 am »
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
 

Offline Kjelt

  • Super Contributor
  • ***
  • Posts: 6460
  • Country: nl
Re: FreeRTOS/ARM - does it use interrupts?
« Reply #1 on: June 06, 2017, 05:16:58 am »
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.
 

Offline hans

  • Super Contributor
  • ***
  • Posts: 1641
  • Country: nl
Re: FreeRTOS/ARM - does it use interrupts?
« Reply #2 on: June 06, 2017, 06:10:42 am »
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 use software interrupts 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.
 

Offline tggzzz

  • Super Contributor
  • ***
  • Posts: 19511
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: FreeRTOS/ARM - does it use interrupts?
« Reply #3 on: June 06, 2017, 07:54:31 am »
Yes almost all RTOS implementations use interrupts.

Indeed.

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.
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Offline Jeroen3

  • Super Contributor
  • ***
  • Posts: 4078
  • Country: nl
  • Embedded Engineer
    • jeroen3.nl
Re: FreeRTOS/ARM - does it use interrupts?
« Reply #4 on: June 06, 2017, 08:26:23 am »
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 Processors
By 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.
 

Offline mikerj

  • Super Contributor
  • ***
  • Posts: 3240
  • Country: gb
Re: FreeRTOS/ARM - does it use interrupts?
« Reply #5 on: June 06, 2017, 10:16:30 am »
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 Processors
By 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.

Also 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.
 

Offline RichardBarry

  • Newbie
  • Posts: 6
  • Country: 00
Re: FreeRTOS/ARM - does it use interrupts?
« Reply #6 on: June 06, 2017, 01:55:00 pm »
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.html

FreeRTOS 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
+ http://www.FreeRTOS.org + http://www.FreeRTOS.org/plus
The de facto standard, downloaded every 4.2 minutes during 2015.
IoT, Trace, Certification, TCP/IP, FAT FS, Training, and more...
 

Offline Kjelt

  • Super Contributor
  • ***
  • Posts: 6460
  • Country: nl
Re: FreeRTOS/ARM - does it use interrupts?
« Reply #7 on: June 06, 2017, 03:01:36 pm »
Interrupts ........... 

Are you THE Richard Barry ?  :-+  :clap:
 

Offline mubes

  • Regular Contributor
  • *
  • Posts: 238
  • Country: gb
  • Do Not Boil
Re: FreeRTOS/ARM - does it use interrupts?
« Reply #8 on: June 06, 2017, 07:41:34 pm »
Are you THE Richard Barry ?  :-+  :clap:

Surely there can be only one?? :-)

Dave
 

Offline mac.6

  • Regular Contributor
  • *
  • Posts: 225
  • Country: fr
Re: FreeRTOS/ARM - does it use interrupts?
« Reply #9 on: June 07, 2017, 07:08:18 am »
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.html

FreeRTOS 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

Note 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
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf