[NXP 1766] LED control

Hi
I started using FreeRTOS on Cortex M3 NXP 1766. I found example projects:
/fr-content-src/uploads/2019/07/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

[NXP 1766] LED control

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.

[NXP 1766] LED control

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?

[NXP 1766] LED control

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.

[NXP 1766] LED control

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?

[NXP 1766] LED control

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.