Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
10 years, 6 months ago.
K64F: mbed rtos vs. top priority ticker
Hi all,
Target: K64F.
The Ethernet Interface library has a dependency on mbed-rtos, which (apparently) uses timer3 internally. The Ticker class also uses this very timer3. I want a ticker that has higher priority than anything else, including the rtos (!) in order to produce a stable 25KHz pulse train while allowing for Ethernet traffic.
My current idea is to decrease timer3's IRQ priority to 1 (from its default of 0), and to use "another" Ticker that's linked to one of the remaining timers (0..2) with IRQ priority 0.
Q1. Is this idea viable?
Q2. Any a pointer to how I can attach an interrupt procedure to a timer that's not the same as the one used by the rtos? I've been looking for the Ticker's source code (where timer3 was hooked), but didn't find it. UPDATE: here it is: https://github.com/mbedmicro/mbed/blob/master/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_K64F/us_ticker.c
Thanks, DG.
1 Answer
10 years, 6 months ago.
Also regarding your previous question, you are confusing the LPC1768 setup with that of the K64F. The K64F currently uses the low-power timer to implement the Ticker (I assume that is going to change to PIT timer 2-3 in the near future, but dunno how high priority that is for Martin).
Afaik every target uses the ARM systick timer for RTOS, which every ARM should have, so is another timer. I dunno how that is priority wise, but I guess you could change its priority to something lower if you want, but are you sure that that is required in the first place? So attaching a function can just be done in the regular way.
Question for you: The goal is to make a 25kHz pulse train? Then I wonder why you aren't simply using PWM.
Thanks for your leads. I've put all IRQs from 15 to 101, except 58 (low power timer), into a lower priority group. Works like a charm. PWM didn't apply in my particular situation as I'm just going to output a bunch of bytes to GPIOs. Ref. http://cache.freescale.com/files/microcontrollers/doc/ref_manual/K64P144M120SF5RM.pdf pp. 74-78.
posted by 08 May 2014