2

enter image description here

enter image description here

enter image description here enter image description here

KEY_EN connect to MCU as push input.

With 100 nF capacitor, the MCU will crash after some pushes.

Without 100 nF cpacitor, everything is OK.

The MCU is Nordic 52832

After inserting the battery, long press SW1 3s POW_KEY to pull down Q1 and turn on, and the VCC3V3 output system is powered on. POW_EN, KEY_EN output high level, short press SW1 to switch PWM output mode, long press for 3s to shut down POW_EN low, the whole system is powered down.

winny
  • 13,064
  • 6
  • 46
  • 63
haiwuxing
  • 218
  • 1
  • 8

3 Answers3

1

I don't see enough information to make a conclusion. So what is left is speculation: The capacitor makes the L-H transition slow: The 100nF * 100kOhm = 10ms time constant. That should be still OK if properly treated in HW (Schmitt trigger in the path) or properly "debounced" in the SW. I would say that every input signal being processed by an MCU shall be treated in a way that non-ideal signal transitions won't crash the system. Therefore I would look in the SW and try to fix the bug there to make it resilient. Knowing where the signals lead on the MCU is important with further assessment. Is it a GPIO pin, is the pin programmed to trigger an interrupt or is it a reset pin?

Martin Vana
  • 684
  • 1
  • 11
0

Have you considered waiting for a few milliseconds in the startup function before doing anything with the micro controller? Waiting will allow you to charge up the capacitor, giving you more stable power.

guttih
  • 55
  • 7
0

After inserting the battery, long press SW1 3s POW_KEY to pull down Q1 and turn on, and the VCC3V3 output system is powered on. POW_EN, KEY_EN output high level, short press SW1 to switch PWM output mode, long press for 3s to shut down POW_EN low, the whole system is powered down.

If either KEY_EN or POW_KEY are outputs at "HIGH", whenever you press the putton you are shorting the GPIO to ground via the diode(s) in D1 and discharging the capacitor, when releasing the switch the GPIO has to charge the capacitor. Not sure if that would cause a hard fault but surely doesnt sound like a good idea, at least not without some series resistance.

Wesley Lee
  • 7,844
  • 6
  • 35
  • 53