Quality RTOS & Embedded Software

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



Posted by jvogel65 on October 2, 2017

I have the NXP TWR-K22F120M board that I am working with to see how FreeRTOS works. I would like to setup Sw1 and SW3 they are both on PORTC. How would I write code to have an interrupt triggered if either one of these switches is pressed. I have looked at code which has SW2 wake up on interrupt but when trying to duplicate the code for SW1 I recieve an error that PORTC is being redefined.


Posted by rtel on October 2, 2017

I don't think this is a FreeRTOS question, but a hardware question. Do Freescale provide drivers for the inputs? Or even board level drivers? It would be unusual for drivers that do things like set pins as inputs, and set them up to generate interrupts, etc., not to be provided.


Posted by jvogel65 on October 3, 2017

I believe that this is a freeRTOS question becauase I would like to configure RTOS to interrupt the application when either Switch 1 or 3 is pressed. Both of these switches are on PORTC and I am not sure how to configure PORTC interrupt to use both of these items and how I know which switch was pressed causing the interrupt.


Posted by hs2sf on October 3, 2017

As you said you have to configure PORTC hardware that the switches generate PORTC interrupts as desired (edge vs. level triggered, etc.). Then in the associated ISR you have to implement (and add to your exception vector table) you need to handle PORTC_ISFR register accordingly to detect (and clear) the individual PORTC pin interrupt(s). FreeRTOS related stuff/code might start inside your ISR e.g. concerning signalling a FreeRTOS task about the switches pressed etc. So it's not really a FreeRTOS question ;)

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

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

Latest News

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

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

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

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