Initial driving state of a pin

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

cross mob
vegan_electron
Level 2
Level 2
10 replies posted 10 questions asked 10 sign-ins

Dear community members,

I've attached an Led to an gpio pin.  The led is later driven by a PWM component. But until I reach the state that I can initialize the PWM the control the behavior of the led it's just turned on. Since it's an RGB led it shows some color I don't want.

The initial driving state drop-down in the pin configuration is disabled. How can I achieve that the led is initially powered off?

Thank you for taking your time,

Daniel

0 Likes
1 Solution
SuSh_1535366
Level 5
Level 5
Distributor - Macnica (Japan)
10 solutions authored 10 likes given 10 likes received

Hello Daniel,

One idea is to keep the pin's drive mode set to Analog High-Z until you start the PWM.
You can either select High impedance analog in the pin component settings, or use software
LED_SetDriveMode( LED_DM_ALG_HIZ );

After starting the PWM, set it to the desired drive mode (e.g. Open-Drain Drive Low) and the LED will light up.
LED_SetDriveMode( LED_DM_OD_LOW );

I hope this is helpful.

Shima

View solution in original post

0 Likes
2 Replies
SuSh_1535366
Level 5
Level 5
Distributor - Macnica (Japan)
10 solutions authored 10 likes given 10 likes received

Hello Daniel,

One idea is to keep the pin's drive mode set to Analog High-Z until you start the PWM.
You can either select High impedance analog in the pin component settings, or use software
LED_SetDriveMode( LED_DM_ALG_HIZ );

After starting the PWM, set it to the desired drive mode (e.g. Open-Drain Drive Low) and the LED will light up.
LED_SetDriveMode( LED_DM_OD_LOW );

I hope this is helpful.

Shima

0 Likes
vegan_electron
Level 2
Level 2
10 replies posted 10 questions asked 10 sign-ins

Thank you Shima, this perfectly do.

0 Likes