0
\$\begingroup\$

I'm using an MCU to drive a set of SSRs, and whenever I reboot the MCU, the outputs that I have attached to the SSRs go high temporarily. I know that a pullup/pulldown resistor can keep a CMOS input from "floating", but can I do the same for an output? I tried putting a 47k resistor between the output and ground, but that did not change the behavior I'm seeing. What else can I try?

I've asked the vendor, and he suggests a 1k pulldown instead of the 47k pulldown, as shorted.neuron suggests. That seems like a lot of current, however, given that I'm going to have at least 16 of these outputs. It may be true that something in between there might also work, but a more elegant solution must be possible?

\$\endgroup\$
1
\$\begingroup\$

since your MCU is going to pull your outputs up during reset, you can make that an ok thing by attaching the output to a small PNP transistor, and pulling its base up. Then when you want to turn the SSR on, you drive the PNP low. Same can be done with p-channel FET of course.

I do not know much about SSRs, but from my reading it seems SCRs are a bit stubborn sometimes. Try ~4.7k pull up or down. If you are on Port0, where pulldown is ok, might be that you just need to pull down a little harder.

\$\endgroup\$
6
\$\begingroup\$

Upon reset a microcontroller always sets all its I/O to input, so that's high impedance. The reason is that this way you can force a known level by pulling up or down, even before the microcontroller has initialized the I/O, so that it can't unintentionally activate some external device, like your SSR.

Apparently it doesn't work as intended in your situation. I call software bug in initialization routine. Make sure you set the output low before setting the I/O pin to output.

\$\endgroup\$
  • \$\begingroup\$ Indeed, my firmware is setting all the I/O to input, with the added bonus of the internal pullup. That's why it's going high on reset. \$\endgroup\$ – Mark Jul 26 '11 at 16:14
  • 1
    \$\begingroup\$ So does removing the interal pullup resolve the issue? \$\endgroup\$ – Kortuk Jul 26 '11 at 16:35
  • \$\begingroup\$ I can't remove the internal pullup, that's all handled before any of my own code is run. \$\endgroup\$ – Mark Sep 6 '11 at 21:21
4
\$\begingroup\$

You didn't say what processor you are using, but most likely it powers up with pins in high impedance mode. The pulldown should have taken care of this. Even without a pulldown, it's pretty much impossible for a capacitively coupled power glitch to drive the line high enough with enough current to light the LED in the solid state relay.

That means the firmware is causing the output to go high during initialization. Make sure the initialization routine sets the output state low before setting it to low impedance (output mode). There are other ways to screw this up too. Perhaps you can catch the bug by stepping thru the initialization code.

\$\endgroup\$
1
\$\begingroup\$

It is a software bug. You are describing that reset on powered MCU causes unexpected change on outputs, even when you use pull-down resistors.

Reread the datasheet and come with proper initialization sequence for outputs.

  • Revalidate from datasheet, if initial state is 3rd state
  • Validate the expected pin state + value + direction first
  • If it fails goto panic
  • Assign output value
  • Assign pin direction
  • Assign output state enabled
  • Loop small fixed time to let physical value to settle to assigned value
  • Check if value has arrived on pin-reading-input, which is an output at the same time
  • If it fails goto panic
  • Continue rest of initialization
\$\endgroup\$
  • \$\begingroup\$ I'm not seeing anywhere in the LPC23xx user manual where the initialization sequence is described. The user manual describes the registers that control the port setup, but doesn't say what the initial state is (that I can find). \$\endgroup\$ – Mark Jul 25 '11 at 20:16
  • \$\begingroup\$ ics.nxp.com/support/documents/microcontrollers/pdf/an10404.pdf pp3 and 4. Says that some GPIO pins should not be held low on reset. Or else is will enable bootloader. Page 7 says about ports 0,1,2,3. All except port zero will be pulled up. So you are limited to P0 some few pins in P0 except P0.14, P0.26, P0.31. \$\endgroup\$ – user924 Jul 25 '11 at 20:41
0
\$\begingroup\$

When the mcu resets, it wants the pins to be in a safe state. This means "don't drive anything" (as configure it to be an output), and "stabilize the line" (don't leave the line floating). Convention says use a pull up (versus a pull down) and make it strong enough to stabilize the line, but not so strong that it it is difficult to overrule with with a different source. Because of this, industry typically settles on a weak pull-up value of 10kOhms.

If you want to "win", you'll 1) be needing to go the opposite direction (so adding a pull-down) and 2) select a value that will put the outside device in the right state.

One extreme is choosing to short the output directly to ground. That will guarantee that when your mcu starts up the output will be 0 V. That's not very practical because then you can't override the direct short with the mcu because it doesn't have amps of current available.

If you choose a 10kOhm pull down, for example, and your output it is 3.3 V, then the device that you're driving with it in power up will see 3.3÷2=1.65V. Keep in mind that your transistor will require a tiny amount of of current so the voltage at this point might vary a little bit.

So how much of a pull down do you need? As noted above, 1k is much smaller than 10k, so it will likely win the competition and you'd end up with 3.3(1k/(1k+10k))=0.3V. The drawback is that when the mcu drives 3.3V directly to the node, it will have to drive that pull down too, resulting in 3.3/1k= 3.3mA of essentially wasted current. Of course, if you're MCU is plugged into the wall then this is a little concerned; however, if it's powered by a button cell battery then 3.3mA of current could be is considerable drain on it.

So in search for the optimal value of the pulldown resister that will allow you to win the competition on reset, the most important thing to consider is what you're driving. You'll need to find out what the minimum input voltage is that will allow it to be in the correct state, and then, using the voltage divider equation, figure out what the pulldown resistor's optimal value is (and then make it a pinch smaller to guarantee operation over your environment parameter variables, such as temperature.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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