Request for layout review of CAN to UART Unit (hobby project) - Page 1
Forum section: electronics / projects

author: johnny:Dumb
author_rank: Newbie
timestamp: March 16, 2019, 01:26:11 pm
content: HelloSeeking feedback and opinions on the layout of a CAN to UART (virtual COM port, USB, FTDI-chip) unit. Schematic is a bit messy. The main focus is to improve and harden my knowledge of good layout practice (And this is hopefully helpful for other people too).Appreciate your time.Schematic is included, here is how it works:An Atmega32M1 with an integrated CAN module acts as a translator between the CAN bus and the FTDI virtual com port. The communication between an the Atmega and the FTDI is done via an isolated level translator. A pass gate between the Atmega and the level translator ensure that the UART channels are not flooded with garbage and allowing the programmer to control the Serial clock during programming. The CAN transceiver is a separate chip.The reset line is controlled by:- The PSU chip, power good signal.- The programming header during programming.It contolls the MCU and the pass gate.The isolation does not follow any standards. I would have liked it to be 2.5mm at least, but the convenience of using jumpers to bridge the power domains was more important for this hobby project. If anybody knows a solution that is still as convenient but has a larger creepage, I am interested to hear it. In the long run, those bridges may disappear though.

author: Dave
author_rank: Super Contributor
timestamp: March 16, 2019, 03:10:38 pm
content: That fuse looks much bigger than it needs to be, considering that your power supply output current is limited to 120mA. You don't need a fuse holder for this sort of application, it's not like you'll risk regularly blowing fuses.The current return paths around the quartz crystal seem very long. The ATmega chip seems to have rather poorly arranged power and oscillator pins by itself, but the routing doesn't seem to benefit that. Think of how the current will flow from the amplifier inside the chip through the crystal/capacitor circuit and where the return paths will be. Then try to make that current loop tighter.Personally, I'd fit the termination components on board and just add a solder jumper in there. That way you just need to make a blob of solder to utilize the termination instead of having to find the right components and solder them on.As for the isolation slot, you seem to be defeating the whole purpose by adding those 2.54mm jumpers in there. Would it be that inconvenient to solder a wire jumper between the two sides if you figured out you wanted a shared power supply?Also, make sure you use a plastic standoff and screw for that hole that you have in the isolation area. Otherwise you'd just be bridging everything with metal bits in there (do not count on the solder mask to provide insulation - it scratches easily).

author: johnny:Dumb
author_rank: Newbie
timestamp: March 16, 2019, 05:02:51 pm
content: First of all, thank you for the great answer.Quote from: Dave on March 16, 2019, 03:10:38 pmYou are absolutely right with the fuse. I will leave it for now, feels more idiot proof (one could say myself proof) and 20x5mm fuses grow on trees. Easy to find, replace and reduces worries.Quote from: Dave on March 16, 2019, 03:10:38 pmCorrect, currently there for convenience during testing alone (Will power everything via USB). After testing a better solution will be found, but less convenience will then be acceptable. The idea with soldered jumper wires is actually a good one. If someone else ever comes to use the board, they have to have some equipment to put the wires in place and blow their 4000€ Laptop into low earth orbit.Quote from: Dave on March 16, 2019, 03:10:38 pmI am hopping to pull myself together and make some 3D printed housing. Probably not going to happen, but plastic screws are an (more expensive!) option too. In my head (although this may not happen) someone else uses this board too and then this is a real problem. The more I think about it, the more I want that screw head clear of copper by 2.5mm. This is also true for the mounting hole on the top right. If someone mounts the board with 4 metal screws on a piece of metal (The unit should also act independently on the CANbus). For the next revision, I may remove the top right mounting hole (If I consider the board stable enough), or bite the bullet and make the board big enough to fit a 2.5mm copper-empty ring around it. There are 3mm to the capacitor, so maybe I will consider that for this revision anyways. Moving the oscillator caps and a bit of the ground plane next to the USB connector, this should also be possible for the bottom right screw. All of this would bring the the unit closer to something that is "finished". There may be an update. Also reconsidering the supply bridges. The diode should actually prevent me from blowing up anything if using an isolated bench supply. I may not need the convenience of the jumper during testing. Hmm....Quote from: Dave on March 16, 2019, 03:10:38 pmYou are right, that seems to be way to go. Will change the PCB, i think it is worth it!Quote from: Dave on March 16, 2019, 03:10:38 pmNow we are into the meaty bits! I will need to check the oscillator circuitry and better understand it. From your answer I gather that the ground return path is more important than I give it credit for. If that is so, I would flip the caps 180 degrees and fill the areas above them with vias. Moving the RXLIN-SCK line out of the way should allow a few more vias as well.Thank you very much for your time and answer, it is tremendously appreciated feedback! Motivating to actually move the design to a more major state.

author: HwAoRrDk
author_rank: Super Contributor
timestamp: March 16, 2019, 05:14:33 pm
content: You don't need the cap on AREF if you're not using the ADC.Also, are you sure you have the correct value caps on the crystal? 8pf seems low - most common 16 MHz crystals require in the region of 20-30pf.

author: johnny:Dumb
author_rank: Newbie
timestamp: March 16, 2019, 06:38:41 pm
content: Quote from: HwAoRrDk on March 16, 2019, 05:14:33 pmAlmost forgot about that cap. I thought to "testfit" it. The next revision may have the possibility to measure the 12/24 volt input (should rename the power port). For now, I will leave the cap in place, even if just for the on board temperature sensor.Quote from: HwAoRrDk on March 16, 2019, 05:14:33 pmThe datasheet of the crystal specifies a load of 12pF. Now, when reading up on this a few years ago, I got the impression this is the total capacitive load the crystal likes to see. Estimations I found for the pin capacitance of a micro controller are up to 5pF per pin. There are also the pads of the crystal itself and the traces to it. Now, those are estimations, a rule of thumb, not concrete data. I simply decided to go with 8pF. If the requirements of the crystal would be around 20-30pF, the parasitic error would be smaller. The trace and pad capacitance can be estimated pretty well. If anybody knows more about the pin capacitance of an MCU, please let me know. I found oscillator design in general confusing and would like to learn more. In this case, I know that the oscillator works with the values (Had a similar board, the oscillator circuitry and how it was connected to this MCU was pretty much identical).For now, I will not change the capacitors and hope to get around to do proper measurements with different values. If someone knows of good material to learn more about this specifically, I would appreciate the pointer, it is definitely not a strong area of mine but very important. I was reading that oscillator designs with a too weak or to strong drive are common failure modes, as the quartz ages, it may not be able to start up or breaks down?It has been a few years. If I remember correctly, in order to measure the drive strength one needs to actually insert a resistor in the path to the crystal. An STM32FXXXX datasheet, I looked at, pointed to a guide on how to do this. I was rather confused back then, never learning much about about crystals, really.If someone is curios, the crystal is this one:Manufacturer: TXC CORPORATIONPart Number: AT-16.000MAGE-TDatasheet:http://www.txccrystal.com/images/pdf/at-automotive.pdfWould love to hear more thoughts on this, industry practice and, as mentioned, material to read up on about this (advice for books is also welcome).

author: johnny:Dumb
author_rank: Newbie
timestamp: March 19, 2019, 06:39:40 pm
content: Ok, a lot to learn:From this document, I learned that the load capacitance of a crystal is the total capacitance parallel to that crystal:http://ww1.microchip.com/downloads/en/AppNotes/DOC1740.PDFSince 2 capacitors to ground are a series coupling, those values need to be doubled. In other words, my crystal requires a load capacitance of 12pf. Two 22nF / 2 = 11 pf. The document uses in its example 3 pF of parasitic capacitance on either side of the crystal. This gives a total capacitance of 11nF + 3nF / 2 = 12.5 nF. The parasitics may be different in my case, but it will work, so I am moving on. I plan to improve on this in a future iteration, mainly by measuring the frequency and calculating the trace capacitance to ground (to see how significant those are).Oscillator layout:https://electronics.stackexchange.com/questions/39136/competing-pcb-crystal-layout-recommendationsAt this point, I am understanding the oscillator circuit to little to make a proper judgement, but the general ideas I get are:- Load capacitance is parallel to the oscillator. A single cap may however prevent the circuit form working (from first link).- The currents in the ground path are very small, no large trace at all is needed, apparently not even for inductive reasons.- A single isolated connection to the MCUs ground prevents the ground plane for becoming a center fed patch antenna (have little intuition with antennas, unfortunately).Luckily, Kicad offers so called net ties to have a ground isolated form groundThe above has driven the current layout of the oscillator circuit.The rest:Thanks to all the input, I believe the layout has improved significantly:- Solder bridges allow to connect and disconnect the termination resistors.- The power bridges across the isolation barrier are now as wide as the isolation channel.- The left mounting holes are connected to ground. The left mounting holes are isolated with a 2.5mm ring.Will send this soon to production. If there are more comments, I appreciate them, it is about the learning experience after all.

author: Smokey
author_rank: Super Contributor
timestamp: April 15, 2024, 12:27:46 am
content: I sure am glad this thread is here! it would be a shame if it disappeared some reason!