FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [May 2010 Threads] [NXP 1766] LED controlPosted 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 controlPosted 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 controlPosted 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 controlPosted 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 controlPosted 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 controlPosted 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.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|