Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training


[NXP 1766] LED control

Posted by Czarek Zegarek on May 25, 2010
I started using FreeRTOS on Cortex M3 NXP 1766. I found example projects:
Now I'm trying to modify the source code to control leds on board.
I took Example 1. I removed the creation of Task2. I modified Task1 by addong following lines:

for( ;; )
/* Print out the name of this task. */
vPrintString( pcTaskName );

LPC_GPIO1->FIODIR = 0xB0000000; /* LEDs on PORT1 defined as Output */
LPC_GPIO2->FIODIR = 0x0000007C; /* LEDs on PORT2 defined as Output */

After executing these instruction, leds should stop shining (after RESET they are normally on). But it doesn't work. Am I doing something wrong?


RE: [NXP 1766] LED control

Posted by Rohit Grover on May 25, 2010
Remove freeRTOS from the equation. Try adding your code to the start of main and mask the rest of FreeRTOS by adding a while(1); before the first call to xTaskCreate. You will then be able to verify if your LED code works on its own.

RE: [NXP 1766] LED control

Posted by Czarek Zegarek on May 25, 2010
This code is correct because it is copied from exemplary program without operating system.
Adding instruction in main don't work.
The question is: Can I directly send a value to GPIO registers or should I use some special function?

RE: [NXP 1766] LED control

Posted by Rohit Grover on May 25, 2010
Sure you can directly send values to GPIO registers.
The only time you need to pay attention to the OS is when you call FreeRTOS APIs. For example, if you setup an interrupt hander associated with a GPIO pin, and if the ISR needs to trigger an event using FreeRTOS, then you need to be careful about the restrictions imposed by FreeRTOS.

RE: [NXP 1766] LED control

Posted by Rohit Grover on May 25, 2010
By the way, in your code for turning off the LEDs, it appears that you're only setting the direction registers to configure GPIO pins as outputs. Don't you also need to set the output value for the pins?

RE: [NXP 1766] LED control

Posted by Czarek Zegarek on May 25, 2010
Yes, that's right. I'm setting pins connected to leds as outputs only. After reset all leds are shining, then setting pins as output should turn off the leds (as checked in program without operating system).
I have also tried to set the output value (i.e. 10101010 to turn on only 4 leds) but they are still shining.

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

Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.

Free TCP/IP and file system demos for the RTOS

Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

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

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

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

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists