Do I need to move to a 4 layer PCB - Page 1
Forum section: electronics / general

author: newtekuser
author_rank: Frequent Contributor
timestamp: March 04, 2023, 04:37:52 am
content: Long story short, I have a project using a PIC16F887, some darlington transistors ICs, a schmitt trigger IC and a 16x2 LCD. All ICs are in TQFP format, lots of pins are used and I am unable to route the traces between all connections (using Kicad6) using a 2 layer board.There's always some trace, or more that overlaps another.Do I need to move to a 4 layer layout, or is there something I'm missing in PCB design to make this happen?Thanks!

author: ataradov
author_rank: Super Contributor
timestamp: March 04, 2023, 04:54:30 am
content: Can you post pictures of what you have so far? Overlapping traces are fine as long as you still have place for vias. I don't see why PIC16 and a couple other ICs would need 4 layer board.

author: fourfathom
author_rank: Super Contributor
timestamp: March 04, 2023, 05:12:49 am
content: You may not *need* a four-layer board, but (at least with JLCPCB) the cost difference is essentially zero. I have a few boards that I was able to route on two layers, and they worked fine. But I switched to four layers a few revisions back and got a much cleaner layout with good power and ground planes. It may not have been necessary, but I'm much happier with the layout, electrically and aesthetically. I used KiCad v6, and KiCad v7.

author: mariush
author_rank: Super Contributor
timestamp: March 04, 2023, 05:24:41 am
content: I'd also like to see what you have so far.Consider adding some 0 ohm resistors / jumper links to go across some top traces if needed, this way you wouldn't have to break the bottom ground layer or you could use both top and bottom for traces.If the 16x2 LCD wiring causes issues maybe you could add a serial to parallel IC and have the microcontroller push 8bits through 2 traces. It's a few cents, may be cheaper than going to 4 layers.

author: wraper
author_rank: Unknown
timestamp: March 04, 2023, 06:58:29 am
content: You only need 4 layers if you cannot route the thing on 2 or for signal integrity and EMI reasons if circuit has very fast signals. As of your description, sounds like it can be done on single layer with some jumpers.Quote from: fourfathom on March 04, 2023, 05:12:49 amOnly for small batch of tiny PCBs and only on special offer, so likely will change after some time.

author: newtekuser
author_rank: Frequent Contributor
timestamp: March 04, 2023, 03:32:46 pm
content: My routing situation can be seen in the attached picture. I do like the convenience of dropping vias to the ground plane and connect ground pins, so will stick with at least a two layer board and as fourfathom mentioned, the cost difference to move to a 4 layer board is negligible.Also like mariush's idea of using zero ohm resistors to jump across traces.

author: fourfathom
author_rank: Super Contributor
timestamp: March 04, 2023, 03:56:03 pm
content: Quote from: wraper on March 04, 2023, 06:58:29 amI assumed that given the OP's questions they were likely doing a small run of small boards. I could be wrong...

author: newtekuser
author_rank: Frequent Contributor
timestamp: March 04, 2023, 04:05:20 pm
content: Quote from: fourfathom on March 04, 2023, 03:56:03 pmCorrect, it's going to be a small batch for SW development, tired of keeping everything together on breadboards.

author: woofy
author_rank: Frequent Contributor
timestamp: March 04, 2023, 04:20:32 pm
content: Don't forget you can change the cpu pin numbers as you please to make routing easier. If you are using any specific peripherals then a newer cpu such as the pic16f18877 will give you peripheral pin select so you can move those too. You should be able to place all the lcd pins together and in the correct order. You could also move things around, the programming connector doesn't really need to cross over the transistor drivers.

author: Jeroen3
author_rank: Super Contributor
timestamp: March 04, 2023, 04:37:36 pm
content: Aside from the noise advantages a 4-layer board insignal-gnd-power-signalstackup offers, your design does not look like a difficult challage for 2-layer board design.First route the power, oscilliators and analogs, than just go up&down and zigzag the digital lines around all the obstacles.

author: wraper
author_rank: Unknown
timestamp: March 04, 2023, 04:41:21 pm
content: This can be done on singe layer with a few jumpers.

author: ataradov
author_rank: Super Contributor
timestamp: March 04, 2023, 05:05:08 pm
content: Quote from: newtekuser on March 04, 2023, 03:32:46 pmBut nothing is routed yet here. This is a trivial board that absolutely does not need 4 layer board no matter how cheap it is. More layers does not always mean better. Board with hidden layers are harder to debug and fix,for example.Quote from: newtekuser on March 04, 2023, 03:32:46 pmYou have a ton of space for the ground planes here. This is not even remotely a problem.Looking at the ratsnest is not helpful here. They always look like nothing will work. Start routing majority of the traces that you can route without interference on a single layer and then see how many unrouted nets you actually have left. Then use via to the second layer.Quote from: newtekuser on March 04, 2023, 03:32:46 pmThis is 100% not necessary here.

author: Doctorandus_P
author_rank: Super Contributor
timestamp: March 04, 2023, 05:29:43 pm
content: Footprint placement is a very important step during PCB design. If you do that wrong, then routing a PCB becomes a big mess easily, and it is a factor that beginners sometimes do not realize.For a project like this, It is often easiest to start with the output connector, and then connect it to the darlington driver IC (I assume its somewhat like the ULN2803) without wires crossing. Then from the darlington IC, you can draw the wires to your microcontroller in a convenient routing pattern, And as a last step, you adjust the software definitions to use the pin layout you created. KiCad does not have special functions for this "reverse design", but you can have both the schematic and PCB open at the same time, and there is cross probing which also helps.Another big factor is making the PCB too small, so there is not enough room for the tracks, but that is probably not the issue here.

author: SiliconWizard
author_rank: Super Contributor
timestamp: March 04, 2023, 06:54:45 pm
content: Show a schematic, and your goal. Is this going to be a product? Is this just a hobby board?Chances are you'd only need a single-layer board as some have said, I've certainly prototyped this kind of stuff on single-layer PCBs back when I prototyped boards making my own PCBs with the toner transfer method.Now if you're going to have the PCB manufactured, single-layer almost doesn't make any sense these days, as now only very few companies offer single-layer PCBs, at least for individuals at low quantities (only big companies making millions of products still use single-layer boards for the most part, even sometimes not FR4, for things like power supplies, panel PCBs holding buttons and LEDs, etc.)With a few exceptions and special deals, 4-layer PCBs unsurprisingly cost approx. twice what 2-layer PCBs of similar class do. And you probably don't need 4-layer here, but again if you can share a schematic and the application, we may have more accurate advice.

author: newtekuser
author_rank: Frequent Contributor
timestamp: March 06, 2023, 01:57:18 am
content: Problem solved! As suggested, I reassigned some pins and was able to route everything.

author: asmi
author_rank: Super Contributor
timestamp: March 08, 2023, 03:06:15 am
content: Nowadays I always go for at least 4 layer PCBs because my time and sanity is worth more to me than the price difference between 2 and 4 layer PCBs. Once you get power and ground out of contest for routing space, things tend to become much easier.

author: TomS_
author_rank: Frequent Contributor
timestamp: April 02, 2023, 06:57:45 am
content: Quote from: newtekuser on March 06, 2023, 01:57:18 amI hope you've checked the datasheet to be sure the functions you are using are available on the pins you have chosen.The 16F887 is an oooooold PIC that very much pre-dates remappable IOs, so not all functions are available on all pins...Newer families don't seem to have any peripherals that can't be remapped last time I looked, I was somewhat surprised. If you can switch to something more modern it would be very much recommended by a lot of people I'm sure...

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: April 02, 2023, 09:35:46 am
content: QuoteThis does vary between parts - some parts can map pretty much anything to anything some have restrictions, and restriction types differ between familiese.g. on the 32MM, only the second peripheral (UART2, SPI2 etc.) can be remappedOn the 16F1535x, most peripherals can only map to only two of the three port groups (porta,b,c) , and the useable ports vary between peripheralsOn the 32MX1xx each peripheral can only map to 1 of up to 8 pins. Except SCLKs Choosing which peripheral (Uart1/2 etc.) to use effectively doubles the choice, but if you're using a lot of peripherals, very careful planning is needed.PIC24F can map pretty much anything to anything ( except I2C)There is usually no reason to use the older PICs- the more recent ones are generally better in all respects and cheaper. Availability seems to be getting pretty good again.

author: woofy
author_rank: Frequent Contributor
timestamp: April 02, 2023, 11:06:51 am
content: PPS is great in the latest controllers, but if there is another feature I'd like to see its an internal matrix to route peripherals internally. In a recent design I needed to route a CLC output to a UART Rx. It's possible to route the CLC output to a pin and use the same pin for Rx, but an internal connection would have been nicer, saving a used but otherwise unconnected port pin.

author: newtekuser
author_rank: Frequent Contributor
timestamp: April 06, 2023, 03:50:08 am
content: I did try to move my project to a PIC18 family but had some issues getting things to work the same as on the 887 and gave up. However, I do intend to pick this up again with the 18F at some point as the parts are cheaper.

author: TomS_
author_rank: Frequent Contributor
timestamp: April 16, 2023, 08:06:03 pm
content: Peripherals tend to get more complex as you move up through the families. They'll have more options that need to be configured and/or different ways to be interacted with.It can take a bit of time to get used to the changes in a similar peripheral between something like a PIC16 and a PIC24 or PIC32 for example.

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: April 23, 2023, 08:39:01 am
content: Quote from: TomS_ on April 16, 2023, 08:06:03 pm