I'm running a PIC24HJ series processor with a supply voltage of 3.3V. I need my PWM signal to be 0-5V, not 0-3.3V. Can I simply connect the PWM line to a 5V supply with a pull-up resistor? Or do I need to configure the pin for open-drain control with a pull-up resistor to 5V?

  • \$\begingroup\$ Added below that you should go open drain w/ pull up to 5V, and didn't want you to miss that. \$\endgroup\$ – Scott Seidman Jun 11 '14 at 20:24

Depends often on the pin. THIS DEVICE, for example, has some pins that are 5V tolerant. The Electrical Characteristics on page 283 of that datasheet show the 5V tolerant pins can go to 5.6V when Vdd >= 3V. Otherwise, you can go to Vdd +0.3V on a non five volt tolerant pin.

This may well impact your choice of pin for PWM. You should be able to use a similar table in your device's data sheet to figure this out on your own. Usually, in the package diagrams (like on page 8) the 5V tolerant pins are grayed in.

And yes, you should probably handle this as an open drain with a pull up resistor to 5V.

|improve this answer|||||
  • \$\begingroup\$ Two things: 1) Why not simply connect the line to a 5V rail with a pull-up resistor, and skip the open-drain config? Would the 5V pull-up be fighting the 3.3V signal derived from from the Vdd supply voltage? (hence, the need for configuring as open-drain?) 2) What value of pull-up resistor is recommended? I've tried 1K and 10K. The 10K sags to 2V, whereas the 1K sags to about 4V. Do I have something configured incorrectly? Or do I just need a <1Kohm resistor? \$\endgroup\$ – The_Ders Jun 11 '14 at 22:32
  • \$\begingroup\$ Because the pin would still be at 3.3v when high an 0v low. \$\endgroup\$ – Scott Seidman Jun 11 '14 at 22:57
  • \$\begingroup\$ When open drain, it will be at pull up voltage when open, and near ground when on. \$\endgroup\$ – Scott Seidman Jun 11 '14 at 22:58
  • \$\begingroup\$ 1) Why would the pin not pull up to 5V when not configured for open-drain? (i.e., normal digital output / push-pull). Is it something to do with the output pin impedance being lower than the pull-up resistor (say, 5 kOhm)? 2) So then, what is an acceptable value for the open-drain pull-up resistor? As mentioned before, I've tried 1k and 10k. The 10ksags to 2V, whereas the 1k sags to about 4V. Do I have something configured incorrectly? Or do I just need a <1k resistor? \$\endgroup\$ – The_Ders Jun 12 '14 at 15:20
  • 1
    \$\begingroup\$ Sounds like your power supply is getting bogged down, and can't handle enough current, or maybe your pullup is too big and you have too big of a voltage drop. A more detailed description of your new implementation under a new question might be a good idea \$\endgroup\$ – Scott Seidman Jun 27 '14 at 20:40

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.