8 years ago.

Powerup and digital Output trick

Hi All Today i have solve one problem with state of digital Output at Power-up for LPC1768 (and perhaps others cards). The problem was this: I have declare few outputs on the top of my program with DigitalOut statement,and in the start of main i force them to high. But when i power-up my card, the output became low state during few seconds (4s) before became at high state as hope. It seem that became from MBED Firmware who force to low state the output until the initialization phase and before start program

I have try to find how force pin to true at power-up, but don't find how....And after few tests, find this solution

To solve this, You need declare your output as DigitalInOut and in the main , force it to output with pinName.output() command and place it at High state with pinName = 1 command.

This seem run because compiler show it as InOut and then place it as Input (with pullup)by default. Then the pin become high during MBED initialization phase. And when the main run, became one Output with high state. Like that, there isn't any unwanted low state on the output pin.

I which that can help....

1 Answer

8 years ago.

After a reset all pins become inputs with pull-up. The problem you have with outputpins that briefly go to low-level between declaration time and the execution of first instructions in 'main' is well known. The reason is that DigitalOut pins default to low level at declaration time. You can override that default low level in more recent mbed libraries by using the following declaration:

DigitalOut mypin(PinName, 1);

Accepted Answer

Sorry but DigitalOut mypin(PinName, 1) not run and generate error below during compilation.

Error: No instance of constructor "mbed::DigitalOut::DigitalOut" matches the argument list in "main.cpp", Line: 61, Col: 17

posted by BOBILLIER Eric 01 Apr 2016

Oups after another control, that not run because i use old version of MBED Library. I have test with new version, and that seem ok

posted by BOBILLIER Eric 01 Apr 2016