01/08/2020 at 19:06 •
Revision 2 of the PCB layout implements the changes needed to make rev 1 functional, plus some additional goodies:
- Added D5 5.6V zener diode on the PoE output voltage to limit the output voltage under no or low load conditions by providing a minimum load if the voltage goes too high.
- Changed C14 to 4.7uF in 0603 package to make the primary side regulation stable.
- Removed L1 ferrite bead and added C16 and R10 to reset the W5500 on power-up.
- In addition to the default-closed solder jumper that connects the W5500 CS line to pin 22 of the Feather footprint, as present on the Adafruit Ethernet FeatherWing, I also added a default-open solder jumper to connect the W5500 IRQ line to pin 24 of the Feather footprint. This keeps it 100% out-of-the-box compatible with the Adafruit Ethernet FeatherWing, while at the same time making it compatible with the Giant Board without having to run extra wiring, but by just bridging this jumper instead.
- As mentioned before, I had the desire to have a 24AA02E48 on the board to provide a globally unique MAC address since the W5500 doesn't come with one, but I ran out of space for it. I decided to add footprints for this chip plus I2C pull-ups and decoupling cap to the bottom of the board (U3, R8, R9 and C17). Maybe I can produce versions with and without the chip, or maybe I'll just leave them unpopulated so the user can add the parts if desired, or maybe it won't be a problem for the CM to always have it. Either way, it doesn't hurt to have the footprints present while I figure it out. I'd like to get feedback on how useful you think this is in the comments!
- Renamed the solder jumpers SJCS and SJIRQ to make it more clear what's what.
The resulting layout looks like this:
Time to get some boards made!
01/08/2020 at 18:25 •
In the last update I reported that I needed to find a way to reset the W5500 after power-up from PoE for it to initialize correctly. I found some time to work on that yesterday.
Resetting something isn't particularly hard, the main problem I had to deal with was doing it as simply as possible because I have no space for anything fancy on this tiny board. So I started out the simplest way I could think of. Since the W5500 datasheet mentions that there's a 77K nominal pull-up resistor on the RSTn pin, I decided to just add a 0.1uF capacitor from this pin to ground. The simplest reset circuit, the idea being that the RSTn would release with a little delay after power came on.
I scraped the solder mask off a GND connected via and soldered a cap to it on the bottom of the board.
It worked! :) Then it didn't. :(
The first time plugged in, the PHY came up correctly. Then unplugging and replugging, it didn't. What was going on? I decided to measure the voltage on the cap, and found that it was still at 2.5V or so after the power was removed. Discharging very slowly. I decided to short the cap and plug it in, and the PHY came up correctly. My cap was just not discharging when the power went away.
It seems the pull-up "resistor" is actually a highly resistive PFET that isn't active when the chip is off. This is a very common thing to do for pull-ups on chips, since FETs are much smaller than resistors on chips, and size equals cost. But I had expected that the cap would still discharge through the ESD diode that typically goes from a chip IO to the positive power supply. Turns out the W5500 has 5V tolerant IOs, which means the ESD protection has to be implemented differently (likely with zener diodes) and there is no diode going from the IO pin to supply. Hence no discharge path for the cap on RSTn when power goes away, only self-discharge.
Unfortunately this means adding another part, a diode or resistor. Resistor hopefully, since it's smaller and cheaper. I added a 680K from RSTn to VCC. As I had been considering where I could possibly fit this parts, I decided to get rid of ferrite bead L1, since that seemed like the only good place for these extra parts to go. Filtering the PHY power supply is a good thing, but likely not a make of break situation like the PHY not initializing correctly. Space-wise, I was going to have one or the other and that made an easy choice, but I needed to check it would indeed work without the bead.
Tried it and... success! The W5500 would initialize correctly every time!
I implemented this on both prototypes and it works good. When L1 is gone, I can fit this new capacitor and resistor in 0402 package on the top side of the board where L1 was, keeping it single sided. Time to implement all changes in a rev 2 PCB layout!
12/17/2019 at 05:24 •
Getting the PoE to work
Found some time to do more testing and tuning.
The first thing I worked on was trying to get the low load control better. I'm not so used to how primary side control flyback controllers work, the only other experience I've had with them had a chip that sampled the AUX voltage at a specific point in the PWM cycle. Turns out the chip used here needs a continuous feedback signal from AUX and requires a good deal of filtering, more than I was doing. I needed a bigger filter cap and things worked better once I hacked it on:
C14 was a 0.1 uF cap, now it's a 4.7 uF. Which (to keep things affordable and performant) requires a bigger package, 0603 instead of 0402. It worked fine to hack it on here but I'll have to change the footprint. I checked the layout and there's enough room to do so in a rev 2.
Making this change made the control loop work better, but the output voltage would still go too high at no load and low load. The AUX winding would stay nicely regulated but this was not reflected on the secondary at low load. Primary side control works best with specially designed flyback transformers that have excellent coupling between the secondary and auxiliary windings. I am using a cheap generic flyback with no such "expensive" requirements. I don't really want to make the system more expensive for a use case that isn't really useful: there is going to be enough load if a Feather is connected. We just need to make sure nothing breaks due to overvoltage when nothing is connected.
If only there was a simple way to put on a load when the voltage gets too high... wait, there is of course! A zener diode will do just that: no load when the voltage is low enough, drawing more and more current as the voltage increases. This will be self-regulating: as the voltage increases, current will start to flow, which will present a load that will help the system regulate. Since just a small load is enough to help the primary side regulation system regulate, the current through the zener and its power requirements will be minimal.
Time to hack in a 5.6 V zener:
Testing shows it works very well. Under no load, the output voltage is ~5.5 V.
So now that the power system was safe to hook up to a Feather, it was time to test that, and the Ethernet PHY. Since the PHY is powered from the Feather's 3.3 V regulator, none of that had been tested yet.
Getting the W5500 PHY to work
A Feather was connected, successfully powered up from the PoE or USB, and could be programmed. Following the directions from Adafruit I loaded the Arduino Ethernet WebClient example. It didn't work. The micro could communicate with the W5500, but it reported no cable was connected. The LEDs on the Ethernet jack would light up in a pattern where one would turn on, then the other, then both went off. Over and over. I searched for an explanation of W5500 error codes but couldn't find anything.
I tried all kinds of variations of the Ethernet side components but nothing made a difference. Tried adding decoupling caps, nothing. Eventually I decided to try to connect it up to a non-PoE cable running from USB and... it worked!
I wasn't certain if this was good news or bad news. More information and understanding is normally good, but this information seemed to indicate that there was a fundamental problem with the PHY when the PoE section was active! Not something I liked to learn. If the PHY just wouldn't work due to interference from the PoE, this project would be dead in the water.
I did a bunch more stuff trying to limit interference, adding bulk caps, etc but nothing made a difference. At some point I decided to try to reset the PHY. This did work: the PHY would come up and the Ethernet WebClient example would correctly load the data!
So, it looked like the PHY would work with an extra reset? I decided to connect the PHY reset to a GPIO and automate the process:
Adding code to do a reset, the Ethernet would come up and work correctly every time!
What is it with Ethernet PHY chips???
To be honest, this situation feels way too familiar. I ran into similar issues with initialization of the PHY on my #wESP32 project. Why do Ethernet PHY chips all seem so finicky about their initialization?
Oddly, the PHY only has this problem if powered on when PoE is active. When powered up from USB, it works without doing anything more, even when PoE is connected later on. It's just if PoE is operational during the PHY powerup, it doesn't initialize correctly and needs a reset.
While it is possible to solve it with this reset-the-PHY-with-a-GPIO system, it still feels like a hack. I was going for 100% compatibility with the Adafruit Ethernet FeatherWing, and having to use up a GPIO to reset the PHY and add code to do it kind of trashes this goal.
If I had more room I could add some parts, possibly even the same PMS150C I use on the wESP32, to make sure the PHY initializes correctly without having to burden the user with it. But there's no space if I want to keep the board single sided. I could make it bigger, but that would also trash the 100% drop-in compatibility with the Adafruit Ethernet FeatherWing.
So I'm trying to figure out what's the best approach, the lesser evil, to make this work. I would appreciate user input on what would be more acceptable to potential users: using a GPIO pin and code, or growing the board bigger.
Meanwhile I'm still investigating if there's anything else I can do. I checked the 3.3 V supply to see if there was anything different between USB and PoE power, whether in noise or rise time. I couldn't spot any difference. Maybe EMI is a problem but only during startup? This is possible--the board is tiny, which crams the PoE section right next to the PHY. During power up, the PWM and currents are the highest, while the PHY chip may have more high impedance nets right at that time? I may play a bit with the soft start of the PoE chip to see if this may make a difference.
All in all, I am happy that everything works, even if it requires a hack. :) Hopefully I'll be able to make it work without the hack, but if it needs it I'll just go ahead with it. Hack or not, winning or not winning the Take Flight with Feather contest, I'm pretty confident now that this will eventually become a product!
12/11/2019 at 18:09 •
The PCBs arrived from JLCPCB, looking excellent as usual:
Time to build some prototypes! So I headed to the Tinkermill to assemble two of them:
Then through reflow:
Looks pretty clean, except for some shorts on the Wiznet W5500. Also, odd that the tape on the flyback transformers was adversely affected, since it's supposed to be able to deal with lead-free reflow. This was not the case with the professionally built LiFePO4wered/ESP32 prototypes that use the same flyback transformer, so I'm chalking it up to the lower quality desktop reflow oven I used.
After cleanup and final through-hole assembly, I had some prototypes to test!
First thing to try: do we get PoE power?
The answer is yes, we are getting power! The output voltage shown on the load is low because I'm measuring through the wiring, at the PCB the voltage was above 4 V at 1 A load.
Heat generation is reasonable, concentrated on the secondary side Schottky diode, while the PoE controller stays pretty cool:
Oddly, things are worse at low load. It looks like the primary side regulation control loop isn't working great and the output voltage would go way too high (around 15 V) at low and no load. The picture below shows the situation with just enough load to keep things in control:
Low load makes the PoE controller run way hotter. Turns out this is because just like the output voltage went way high, the auxiliary voltage that feeds the chip does the same thing, and it was actually exposing the chip to out-of-spec voltages. More testing at no load eventually killed the chip.
Looks like I still have work to do to get this to behave properly. :) Tuning the control loop tends to be a slow, labor intensive process of trial and error. Still, I find this a promising start.
Only after I get a stable output voltage will I hook this up to a Feather to test the Ethernet controller part, since this is powered by the Feather's 3.3 V. Since most Feathers from Adafruit seem to use an AP2112 LDO, I'll have to make sure the PoE voltage doesn't go above 6 V since that is its maximum operating voltage.
11/21/2019 at 20:22 •
I managed to cram it all into a layout the same size as the Adafruit Ethernet FeatherWing!
I had to go to a 4-layer board with 4 mil trace/spacing, 0.2mm minimum drill and 0402 size components to make everything fit. But that's OK, there isn't anything bleeding edge about it that board and assembly houses would have trouble with nowadays.
I managed to pretty much keep the same functionality as the Adafruit Ethernet FeatherWing. It uses the same SPI signals, with an option to cut SJ1 if it's necessary to move the chip select to a different pin. CS, RST and IRQ are still available, but they are on surface pads instead of through-hole. One thing I didn't keep is the mode selection solder jumpers, but I don't think that's a big loss. The WIZ5500 will just auto-negotiate the correct speed and duplex settings.
I unfortunately did not find the space to add a 24AA02E48 chip to solve the issue of having to get your own (or make up your own) MAC address. It's the same as the Adafruit Ethernet FeatherWing in that respect as well. :) It's unfortunate the Feather spec doesn't integrate I2C pull-ups on the main board but they are expected to be on the FeatherWings (wrong in my opinion). Maybe I would have stood a chance if I didn't also have to add the pull-up resistors. Still, it would be tough no matter what, due to the location of the I2C pins next to the Ethernet jack.
I managed to keep reasonable isolation between the local power and the remote PoE power. I'm not going to make any claims about how much voltage it can withstand, but the Ethernet side is completely isolated from local ground and power.
I have uploaded the schematic so you can see what's going on. This is the first time I've used the TPS23758 PoE chip in a project so it's entirely possible I screwed something up. PCBs are on order with JLCPCB, so we'll find out if it actually works after I get the boards and build up some prototypes! :)
11/11/2019 at 21:09 •
I got the project far enough to come up with a rough floorplan:
It took quite a bit of fiddling with combining loose parts into resistor and capacitor arrays, reducing resistors to 0402 size and throwing out optional parts, but I think I have enough confidence to say now that this might be possible!
The design will be isolated, but things are just too tight to be able to keep recommended clearances and make any claims about the isolation voltage. I will have to go to smaller via sizes and trace widths and clearances than I usually do, but that's alright. Most board houses nowadays have no issue with 4 mil traces/spacing and 0.2 mm via drills.