Quality RTOS & Embedded Software

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




Loading

[NXP 1766] LED control

Posted by Czarek Zegarek on May 25, 2010
Hi
I started using FreeRTOS on Cortex M3 NXP 1766. I found example projects:
http://www.freertos.org/index.html?http://www.freertos.org/Documentation/code/
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?

Regards

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) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

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