Low Initial Drive State for PWM components

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

cross mob
ToVa_285016
Level 5
Level 5
100 replies posted 50 replies posted 50 questions asked

Hi,

   

I have a PWM connected to a high power LED, and want it's pin state to be low on startup.

   

The problem is that I cannot set it low, as the initial drive state is grayed out in the configuration window.  There is a visible flash on startup because of this.  

   

Is there I way that I can change this?  Maybe disconnect the pin through software somehow until I am able to set the PWM low?

   

Thank you,
Tom

0 Likes
8 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Before the pin is configured it is in a Hi-Z mode. You can apply a pull down (or pull up) resistor to span the time until the pin is configured.

   

 

   

Bob

0 Likes
ToVa_285016
Level 5
Level 5
100 replies posted 50 replies posted 50 questions asked

Hi Bob,

   

Do you mean physically on the circuit board?  Is there any way to do this through software, as there are 'resistive pull-down' pin styles, but this does not seem to make a difference to my design i.e. it still flashes.

   

Thank you,

   

Tom

0 Likes
ToVa_285016
Level 5
Level 5
100 replies posted 50 replies posted 50 questions asked

Another interesting twist is that for a project I have for a BLE device, you can set the pin initial state to low/high even with a hardware output attached, whereas for a PSOC 4 device, it does not have this functionality.

   

Regards,
Tom

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

According to datasheet is the initial setting only allowed when there is no hardware connection to the pin.

   

Do you mean physically on the circuit board?  Yes

   

Is there any way to do this through software  No  your LED flash happens before the pin is initialized and your software main() is not yet running

   

What does your LED driver do when its input is floating?

   

 

   

Bob

0 Likes
ToVa_285016
Level 5
Level 5
100 replies posted 50 replies posted 50 questions asked

Hi Bob,

   

The driver is off on a floating input.

   

Regards,

   

Tom

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

So the best way to act is:

   

Configure the pin as High-Z in Creator

   

At initialization: Setup and start PWM

   

Configure the pin's drive mode as `Strong` using PinName_SetDriveMode()

   

This should avoid the initial glitch.

   

 

   

Bob

0 Likes
ToVa_285016
Level 5
Level 5
100 replies posted 50 replies posted 50 questions asked

Hi Bob,

   

Unfortunately this does not stop the initial flash.

   

I looked at the datasheet again, and it looks like open circuit is indeed high:

   

http://www.meanwell.com/mw_search/LDD-L/LDD-L-spec.pdf

   

If I add pull down resistors, won't the initial pin state of high overcome the resistors, and it will flash anyways?

   

Any other ideas about getting this pin to start pulled low?  Like I said, in the PROC module, it is an option to start low even if there is a hardware connection.

   

Thank you for your thoughts,

   

Tom

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

I looked at the datasheet again, and it looks like open circuit is indeed high: Yes, it is ON when left floating. As a consequence a pull-down resistor of 1kOhm should cure that.

   

Starting the pin low is grayed-out, look for reason in pin's datasheet. It states that the pin's state is ruled by the connected signal. so the state of the PWM is relevant for the output.

   

Again: to avoid glitches set the pin to High-z in design and when all is initialized re-program the pin to strong drive mode. Use the APIs provided for the PWM's component generated pin, search for "SetDriveMode"

   

 

   

Bob

0 Likes