I've been using NXP LPC microcontrollers for some time. One problem that I've faced in several projects is that every time the MCU is powered and a GPIO is setup to LOW logic level and output, a glitch in the GPIO pin happens.

The trace below was captured in one of the GPIOs of a LPC1548 and shows that the glitch has 1.84V and lasts for 1.26ms. Glitch capture

Even considering that this glitch has low amplitude and is fast, anything connected to the GPIO can have undesired behavior on board power up.

Some time ago didn't know about this behavior I connected the GPIO to a MOSFET gate that was controlling a TRIAC (for AC motor control). Because of this glitch problem, everytime the system was turned on, the motor quickly bumped/shaked. In this particular problem I had to change the MOSFET from N channel to P channel and invert the GPIO logic so it won't glitch anymore. Problem fixed.

Anyway, I'm having this problem again in a project that I cannot keep changing or adding components to the board (for space and costs constraints).

Does anyone knows how can I eliminate this glitch?

  • \$\begingroup\$ Nice question. From the top of my head I'd say a low pass filter, if it's ok with the application, or a power sequencer. I am not sure you can eliminate it completely. Maybe a pull down might be enough. \$\endgroup\$ Mar 17, 2016 at 19:29
  • 3
    \$\begingroup\$ I think there is just a missing pull-down resistor (remember that during boot / in reset, your desired pin state is not implemented), but there's a bit of ambiguity in your question -- does this glitch happen prior to your setting the GPIO, or after you issue the instruction to configure the GPIO? \$\endgroup\$ Mar 17, 2016 at 19:58

2 Answers 2


Start up state of a gpio is usually defined as input, potentially with a weak pull. In general, you should always design circuits so that they will not malfunction if the controlling pin is hi-z. This might be an external pull down resistor, or it might be controlling the enable input of whatever the pin connects to. It looks like your pin is rising with the circuit voltage. It is good practise to hold all ics in reset until the power is stable. There are chips designed specifically for this - see mcp130 for example.

If you post a schematic we can be more helpful

  • \$\begingroup\$ I solved using a 10K pull-down. In this particular case I tested several values and found that the highest value is 22K. \$\endgroup\$
    – RHaguiuda
    Mar 18, 2016 at 11:50

Possible the init state of GPIO pins are high and it takes a while for your part of the code to get to initializing it to low. I had a similar problem on another ARM chip.

Here's what I would do:

  • Check to see if other GPIO pins suffer the same.
  • move your code (in assembly) for setting IO pin to output and low, way, way up in the instruction/address list. So one of the first things the chip does is fix that pin.
  • if you have a spare IO pin and can add logic, put an XOR gate so only 0,1 value turns on the output.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.