Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


Correct TickHook application

Posted by PBXNewbie on July 18, 2007
I want to access the DBGU UART on a SAM7S256 using an ISR. My understanding is that DBGU interrupts show up as a SYS interrupt, which is the interrupt used by the tick timer. Therefore, I believe that I need to place my ISR into TickHook. My questions are:
1. Can anyone confirm that this is the right way to do so? If not, can you please let me know a better way to accomplish what I want to do?
2. If this is the right way, is TickHook necessarily a coroutine?
3. Do I need to enable coroutines to put in a tickhook, or merely just enable tickhook?
3. Can I use a xQueueReceiveFromISR from within tickhook, or do I need to use crQUEUE_RECEIVE_FROM_ISR?
4. If tickhook is a coroutine, does it need to yield or just return?

I also wish to put the system in idle mode when it is not doing anything. My understanding is that I can do so by creating an idlehook routine. My questions related to this are:
1. Is idlehook necessariloy a coroutine?
2. Do I need to enable coroutines to put in an idlehook or merely just enable idlehook?
3. If I put the processor into idle mode in idlehook, will it automatically come out of idle mode when a task is ready or do I need to take it out of idlemode in a tickhook routine?
4. Does idlehook need to yield or just return?

Any help would be very much appreciated.

Thanks in advance.

RE: Correct TickHook application

Posted by Dave on July 18, 2007
One way to use two system interrupts is to have a single system interrupt handler ISR. The ISR looks at the status bits of the system peripherals and calls a standard function to handle either the PIT or the DBU handler as appropriate. You need to take care that the context is saved before this is done. You do not use the tick hook.

The idle hook has nothing to do with coroutines other than it being a convenient place to call the coroutine schedule function. All you need to do is enable the idle hook then write a function:

void vApplicationIdleHook( void )
//place processor into sleep mode here

The sleep mode chosen must ensure that timer interrupts will wake the processor up again.

RE: Correct TickHook application

Posted by PBXNewbie on July 19, 2007
Thanks Dave. That was very helpful.

[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ Sitemap ]    [ ]

Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS v10.2.0 is available for immediate download. MIT licensed, and including RISC-V and ARMv8-M (Cortex-M33) demos.

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


FreeRTOS and other embedded software careers at AWS.

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Cadence Tensilica Cortes

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers





STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner