Why is the RGB LED not turning on when used out of for loop?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
DhDa_2432241
Level 5
Level 5
5 likes given First like received First like given

Hello,

I have setup a PSOC6 project using CY8CKIT-062-WiFi-BT as my device. I have configured a digital PIN and assigned P0_3 to it. P0_3 maps to RED LED in RGB from schematics. I am able to blink the LED when used in for loop but not outside of it.

In main_cm4.c,

The following is working:

int main(void)

{

     for(;;)

     {

        Cy_GPIO_Write(LED_R_PORT, LED_R_NUM, 1);

        CyDelay(500);

        Cy_GPIO_Write(LED_R_PORT, LED_R_NUM, 0);

        CyDelay(500);

     }

}

But this is not turning the LED on.

int main(void)

{

     Cy_GPIO_Write(LED_R_PORT, LED_R_NUM, 1);

     for(;;)

     {

     }

}

Why?

The GPIO is configured as Digital output with no hardware connection. The initial drive state is low.

Thanks

Dheeraj

0 Likes
1 Solution
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

All the user LEDs are active low, so a Cy_GPIO_Write(LED_R_PORT, LED_R_NUM, 0);  will turn it on.

Bob

View solution in original post

3 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

All the user LEDs are active low, so a Cy_GPIO_Write(LED_R_PORT, LED_R_NUM, 0);  will turn it on.

Bob

Oh okay. I didn't find active low symbol in the schematics. Can you point me to the docs where this information is present?

Thanks

Dheeraj

0 Likes

When you installed the CY8CKIT-062 correctly there will be an entry for the complete description in C:\Program Files(x86)\Cypress\...

When you follow the ...\Hardware\... path there you will find a schematics PDF. Search for "user LED"

Happy coding

Bob

0 Likes