How to design the PCB of PIC18f2520 microcontroller

Discuss hardware-related topics, such as development cartridges, CopyNES, PowerPak, EPROMs, or whatever.

Moderators: B00daW, Moderators

Post Reply
Jackspin
Posts: 1
Joined: Mon Nov 16, 2020 12:24 am

How to design the PCB of PIC18f2520 microcontroller

Post by Jackspin » Wed Nov 18, 2020 11:08 pm

Guys, I am designing a PCB with a PIC18f2520 microcontroller. I want to know if I can use pickit3 to power the microcontroller because I have connected the vdd pin of the microcontroller to the voltage regulator. If there is no voltage input on the voltage regulator, will this affect the voltage regulator?

This is what I found about the description of PIC18F2520 on the Jotrin website: 28/40/44-Pin Enhanced Flash Microcontrollers with 10-Bit A/D and nanoWatt Technology
Last edited by Jackspin on Wed Dec 02, 2020 3:26 am, edited 1 time in total.

User avatar
aquasnake
Posts: 155
Joined: Fri Sep 13, 2019 11:22 pm

Re: How to design the PCB of PIC18f2520 microcontroller

Post by aquasnake » Thu Nov 19, 2020 3:09 am

two power sources and one destination port,should add diodes to prevent the short cut between different VDDs.

for example, when the board is powered on and connected to a download cable meanwhile

User avatar
Ben Boldt
Posts: 645
Joined: Tue Mar 22, 2016 8:27 pm
Location: Minnesota, USA

Re: How to design the PCB of PIC18f2520 microcontroller

Post by Ben Boldt » Thu Nov 19, 2020 9:04 pm

Sorry but I have to disagree with that completely aquasnake.

First of all, I advise against the diodes because then the voltage getting to the PIC micro will be less by a diode drop.

You could check the datasheet to be sure but 99.9992% chance the regulator doesn't care if its output gets powered with no input. I do it all the time. You can hook your pickit power and the regulator output directly together. Bear in mind, whatever else is on your board also connected to the VDD would also get powered by your pickit and it has a very limited amount of power it can put out. If there is a lot there, you might end up having to give the regulator an input to get everything powered up properly and able to program anyway.

Don't forget to put a pull-up resistor on /MCLR! Also it is a very good idea to put a ceramic cap directly from VDD to GND, connect it right from pin 19 to pin 20 physically right next to it on the board. Something 10nF to 100nF is good. Have you considered wiring everything up as a prototype before making the board? That is a great way to make sure that your circuits are all designed correctly and try them out.

User avatar
aquasnake
Posts: 155
Joined: Fri Sep 13, 2019 11:22 pm

Re: How to design the PCB of PIC18f2520 microcontroller

Post by aquasnake » Fri Nov 20, 2020 6:45 am

BAT54 has 0.3V Vf,it can be accepted.

Some mature designs use a PMOS to control power cut-off, or LDO with EN pin. The voltage drop of the former is also 0.3V (PMOS on the power path can be seen in most designs), while the latter is more common in handheld low-power systems

Diode access should be avoided as far as possible in the main power supply path. However, on the auxiliary VDD of the download line, the 5V from the PC USB can be controlled by PMOS. When the main power supply is detected, the VDD from the USB side will be shut off, otherwise it will be on

User avatar
Jeroen
Posts: 1048
Joined: Tue Jul 03, 2007 1:49 pm

Re: How to design the PCB of PIC18f2520 microcontroller

Post by Jeroen » Fri Nov 20, 2020 11:42 am

Ben Boldt wrote:
Thu Nov 19, 2020 9:04 pm
Sorry but I have to disagree with that completely aquasnake.

First of all, I advise against the diodes because then the voltage getting to the PIC micro will be less by a diode drop.

You could check the datasheet to be sure but 99.9992% chance the regulator doesn't care if its output gets powered with no input. I do it all the time.
That's like people who say you don't need bypass caps because "it worked for me".

"backwards" powering a 7805 (or other linear regulator) is definitely bad practice. In fact, if you have a large capacitance on the output side, you're supposed to put a diode from the output to the input, so that the output can not be (more than a diode drop) higher than the input.

https://www.ti.com/lit/ds/symlink/lm780 ... se%253DGPN

Page 13:
When using large capacitors at the output of these regulators, a protection diode connected input to output. (FIGURE 15) may be required if the input is shorted to ground. Without the protection diode, an input short causes the input to rapidly approach ground potential, while the output remains near the initial Vout because of the stored charge in the large output capacitor. The capacitor will then discharge through a large internal input to the output diode and parasitic transistors. If the energy released by the capacitor is large enough, this diode, low current metal, and the regulator are destroyed. The fast diode in FIGURE 15 shunts most of the capacitors discharge current around the regulator. Generally no protection diode is required for values of output capacitance < 10uF
Then below that it says:
Because the output device does not sink current, forcing the output high can cause damage to internal low current paths in a manner similar to that just described in "Shorting the regulator input"
Now technically in those examples the Vin is still connected to something, but I still wouldn't consider it very good engineering to not take it into account. It also provides a way to power this circuit without having the diode in series, connect it from the output to input of the LDO. This prevents a significant voltage delta between the two, even if the input is not connected.

Image

edit: also, if you do go with the above set-up, make sure you never connect both the pickit power and the linear regulator power at once, in that case I would still recommend a schottky diode in series. If the small voltage drop does not fall within the tolerances of the micros input, you can use the same type of diode to shift "up" the voltage of the linear regulator by the same amount.

User avatar
Ben Boldt
Posts: 645
Joined: Tue Mar 22, 2016 8:27 pm
Location: Minnesota, USA

Re: How to design the PCB of PIC18f2520 microcontroller

Post by Ben Boldt » Fri Nov 20, 2020 1:57 pm

Jeroen wrote:
Fri Nov 20, 2020 11:42 am
That's like people who say you don't need bypass caps because "it worked for me".
I say that on purpose to show clearly that I don't have anything to back up my statements, even encouraging to look up the datasheet. It's just my experience, making sure you know that and not hiding anything.

I never heard of this before, will keep it in mind. I always connect my programming connectors, Micro VDD, and regulator output all directly together and never knew or experienced any potential problem. Sometimes power them both at the same time. I never broke a regulator before, but maybe I did cause stresses though. Probably it's wrong judging on what you guys are saying.

Edit:
I will be adding this diode in all future designs, thanks for the wake-up call.
7805.PNG
7805_2.PNG
7805_2.PNG (10.3 KiB) Viewed 363 times
Last edited by Ben Boldt on Fri Nov 20, 2020 2:08 pm, edited 1 time in total.

User avatar
Jeroen
Posts: 1048
Joined: Tue Jul 03, 2007 1:49 pm

Re: How to design the PCB of PIC18f2520 microcontroller

Post by Jeroen » Fri Nov 20, 2020 2:07 pm

Ben Boldt wrote:
Fri Nov 20, 2020 1:57 pm
Jeroen wrote:
Fri Nov 20, 2020 11:42 am
That's like people who say you don't need bypass caps because "it worked for me".
I say that on purpose to show clearly that I don't have anything to back up my statements, even encouraging to look up the datasheet. It's just my experience, making sure you know that and not hiding anything.

I never heard of this before, will keep it in mind. I always connect my programming connectors, Micro VDD, and regulator output all directly together and never knew or experienced any potential problem. Sometimes power them both at the same time. I never broke a regulator before, but maybe I did cause stresses though. Probably it's wrong judging on what you guys are saying.
You can't back it up, but you stated that there was a 99.999% chance.

I'm not saying nobody should be wrong ever, it happens. But don't say stuff with such certainty if you can't back it up?

User avatar
Ben Boldt
Posts: 645
Joined: Tue Mar 22, 2016 8:27 pm
Location: Minnesota, USA

Re: How to design the PCB of PIC18f2520 microcontroller

Post by Ben Boldt » Fri Nov 20, 2020 2:08 pm

Jeroen wrote:
Fri Nov 20, 2020 2:07 pm
Ben Boldt wrote:
Fri Nov 20, 2020 1:57 pm
Jeroen wrote:
Fri Nov 20, 2020 11:42 am
That's like people who say you don't need bypass caps because "it worked for me".
I say that on purpose to show clearly that I don't have anything to back up my statements, even encouraging to look up the datasheet. It's just my experience, making sure you know that and not hiding anything.

I never heard of this before, will keep it in mind. I always connect my programming connectors, Micro VDD, and regulator output all directly together and never knew or experienced any potential problem. Sometimes power them both at the same time. I never broke a regulator before, but maybe I did cause stresses though. Probably it's wrong judging on what you guys are saying.
You can't back it up, but you stated that there was a 99.999% chance.

I'm not saying nobody should be wrong ever, it happens. But don't say stuff with such certainty if you can't back it up?
I was completely certain based on my experience. And I was wrong. Both were true.

User avatar
Jeroen
Posts: 1048
Joined: Tue Jul 03, 2007 1:49 pm

Re: How to design the PCB of PIC18f2520 microcontroller

Post by Jeroen » Fri Nov 20, 2020 2:26 pm

Ben Boldt wrote:
Fri Nov 20, 2020 1:57 pm
Jeroen wrote:
Fri Nov 20, 2020 11:42 am
That's like people who say you don't need bypass caps because "it worked for me".
I say that on purpose to show clearly that I don't have anything to back up my statements, even encouraging to look up the datasheet. It's just my experience, making sure you know that and not hiding anything.

I never heard of this before, will keep it in mind. I always connect my programming connectors, Micro VDD, and regulator output all directly together and never knew or experienced any potential problem. Sometimes power them both at the same time. I never broke a regulator before, but maybe I did cause stresses though. Probably it's wrong judging on what you guys are saying.

Edit:
I will be adding this diode in all future designs, thanks for the wake-up call.
7805.PNG
7805_2.PNG
Adding the diode never hurts, unless cost is an issue (But diodes are cheap, unless you're mass producing.)
Do note that you don't need the diode if your output capacitance is <10uF. Or if you feel it might get backfed with the input disconnected.
If you put two voltage sources that are active in parallel you need to use diodes to OR them together, or construe a circuit using MOSFETS. A good place to start is by googling "FET reverse polarity protection"

User avatar
Ben Boldt
Posts: 645
Joined: Tue Mar 22, 2016 8:27 pm
Location: Minnesota, USA

Re: How to design the PCB of PIC18f2520 microcontroller

Post by Ben Boldt » Fri Nov 20, 2020 2:40 pm

I'll be honest, I will probably keep doing it that way I used to. I won't tell anyone else to do it that way anymore through. Thanks for the advice.

Post Reply