Ever wonder if your USB C cable is USB2 or USB3? Do you have some charge-only cables hiding in a box just waiting for the right moment to spoil your project plans?!
Fear no more!
I’ve made a simple board to test most of the things!
Ever wanted to debug your microcontroller over USB-C?
(I'm talking JTAG/SWD, not just USB!) If you already have a USB-C connector, there's no need to have an additional connector to program (or tag-connect pads, which are super nice)
Here's one way to do it: 🧵
A few days ago, I found my dad’s college Digital Systems project notes. The task was to build a clock with 7400 series logic.
I decided to try and re-create the project with components we bought together many years ago.
I’ll do a quick thread explaining how it all works
Best part of all? It’s open hardware! If you want to make your own, here’s the kicad project:
I made a few, so if you know me and want one, let me know :)
Wanted to make your own game controller that works on iOS? You probably ran into issues since Apple requires them to be MFi certified. There is a way though! No jailbreak required ;)
Here it is running on my iPad with IPadOS 15.5. I’m using a Teensy LC for it.
Ever needed to measure a device's low power states (µA or nA level) while being able to flash/debug over SWD?
Ok, probably not... If you had, you would have probably noticed the extra 30-300µA (or more!) drawn by just having a debugger connected (even when not active!) 🧵
Today was my last day at work. I’ve decided to take a long break to focus on catching up with friends and family, working on personal projects, and traveling. I don’t have any specific plans just yet, but looking forward to the time off :D
New board to power most of my devices using USB-C PD power supplies :D
This way I’ll only need to carry one power supply to charge my phone, laptops, etc...
Voltage/current settings are set by the resistors on the back. 5-20V 0-5A. It’s using a Cypress CYPD3177 for the PD stuff
So
@Chris_Gammell
mentioned my home storage/inventory system on
@TheAmpHour
a few weeks ago hoping I'd make a video about it... Finally got around to it this week. Doesn't cover everything, but hopefully can give you some ideas about your own lab!
The USB-C specification() has a section B - Debug Accessory Mode. It explains how to "support" DAM. In short, if both CC1 and CC2 are pulled up (usually, only a single one is) a device can enter DAM. While in DAM, the following signals can be repurposed:
Got a chance to stop by
@GSGlabs
today :D
Expect another great
@unnamed_show
episode about USB RE with
@ktemkin
and
@Qyriad
in the near future! (Once I get around to editing it...)
New SWD over USB-C board!
✅ 1.6mm PCB
✅ Slightly wider board for easier assembly (and hopefully some sort of case/enclosure)
✅ New USB-C plug that’s (slightly) easier to hand assemble
✅ Flipped pinout on plug, making it completely useless
🤦♂️ 🤦♂️ 🤦♂️
Check your footprints!
New batch of USB cable testers arrived! After terrible yield issues with the last batch, I changed to use 0.8mm PCB instead of the standard 1.6mm. 95% yield! (100% after a small rework)
If you want to get your own, check out the release and ordering info:
Had a blast at
#ccccamp19
this week!
Here’s a few of us on our extremely well planned and definitely not winged train ride home :D
Looking forward to the next one!
If we chose to go this direction, the footprint/component requirements to do this are zero! You'll still need an adapter board to connect your debugger, but that's it! (Maaaaybe I'll start selling these soon if there's any interest)
Hope this was useful! :D
Any Bay Area friends want to try some homemade Brie? (Assuming I can get it to you)
There’s a few extra wheels that were meant to share with friends, so I figure I can distribute some of them around so folks can enjoy(hopefully) them at home!
Apparently TDI International is too cool to sell me their tweezers. (I’ve used them at work)
Anyone have good recommendations for alternatives? Mostly for smd work at home (0201s and up!)
Finally put together the SMD Challenge kit I got from
@oshpark
at the
@hackaday
supercon!
Didn’t think I could do it with my home gear, but luckily, I was wrong :D
DAM doesn't specify any standard pinout. It's up to the designer to figure that out. Here's what I came up with:
RX1- - SWDCLK
RX1+ - SWDIO
RX2- - SWO
RX2+ - NRST
SBU1 - VCC(target)
SBU2 - GND
USB D+/D- stay connected the usual way.
Made a simple calculator for my usb-c-power project to figure out which resistors to use for what settings.
Looks awful on mobile... which is why I'm going to stick to doing easy things like firmware/hardware instead of HTML/CSS. :/
I decided to make a test target with all these features. It's just an STM32L4 😎 with USB and a couple of LEDS (along with all the CCx detection fun). You can see how the LED is red when it's plugged in backwards.
After much pain soldering on those USB-C connectors, it all works!
Got the
#KiCon2019
badge up and running.
NOTE: The white USB cables that came with the battery pack seems to be charge-only, so it won’t work for programming.
@Chris_Gammell
dropped off a bunch of micro-usb cables by the
@digikey
area
I decided to make a board that passes through power and USB, but hijacks the CC1/CC2 lines to enable DAM. I used an attiny24a(in stock!) to read in the input CCx lines to determine the input charge currents and set the appropriate downstream CC1/CC2. I used the wrong footprint 🤦♂️
Made my first 3d part model for KiCad using FreeCAD! I should have picked a simpler one to start with, but got it working eventually :D
(Source drawing for reference!)
Normally, CC1/CC2 are used to determine orientation as well as power delivery information. For this thread, I'll just focus on "dumb" PD with termination resistors. Depending on the source's pull up resistor (Rp) value, the source can advertise various charge currents.
Before I continue, a quick shoutout to decoupling capacitors. They do wonders minimizing electrical noise (random glitches!) on your circuit.
It’s easy to forget to add them while prototyping, but just compare the first two scope captures to the last one, which had them.
Just spent an hour debugging an issue caused by the voltage drop because of cheap cables. Fixed by changing to nice ones.
HiLetgo ??? - $7.49 for 3 pairs. ~1.67 Ohms through both.
Pomona 3782-24 - $15 a pair. Total resistance through both ~0.12 Ohms
You get what you pay for🤦♂️
In order to do this "properly", we can use a two comparators(op-amps in my case), an AND gate, and a switch (TMUX1511, in this case). The comparators detect when both CC1/CC2 are pulled up. If both are, the AND gate enables the switches to connect all the signals.
Latest rev of my weather station board. Going to try out LoRa this time. Also split temp/humidity from pressure sensors since I’ve had issues with the BME280 and condensation. The SHT31 has a special membrane to protect it from that. I’ll have to protect BMP280 some other way.
🤦I should probably show the block diagram first.
In summary, we start with a 10kHz clock and divide it down by 10 until we have a 1Hz clock. From there, we have second, minute, and hour counters, display drivers, and 7-segment LED displays.
In order to test all this, I first used a USB-C plug breakout board with a few wires 😬
On the other side, I hooked up the circuit mentioned above. (I can't show the main circuit, unfortunately).
The setup worked though! Time to make some custom boards :D
USB-C cables only pass through CC1. In order to use DAM, we need to have a USB-C plug (or custom cable) to connect both CC1 and CC2. If the device is in DAM, how do you know the charge current? There's another table for that :D
New weather station prototype is working! Finally got wireless boot loader working so I can program the unit outside :D
Still have plenty of testing to do and a lot more mechanical/weatherproofing work.
So I made another programmer over USB-C 😂
This one uses SPI instead of SWD. I also got the MISO/MOSI lines flipped, so had to use some jumper wires to program.
Ok, so back to why I didn't want to make the pinout reversible. Following the USB spec is nice and all, but for hobby projects... 🤷
What if we ignore all of the CCx detection stuff and just permanently wire the SWD lines to the USB port? Saves us several components and space!
I hard-wired the CC resistors and it worked :D
Here's the fixed version. It uses the SBU1/SBU2 signals (VCC/GND) to light up a green or red LED to let you know if it's plugged in wrong. It has standard SWD pins for debugger. The only problem is... I have to program the attiny24!
Weather station progress:
It all fits and seems to work :D
~110uA average current (1 min sampling period) isn’t too bad either :D
Next step is to leave it outside for a while and hope it stays alive. (And future out where/how to mount the solar panel...)
A few days ago, I found my dad’s college Digital Systems project notes. The task was to build a clock with 7400 series logic.
I decided to try and re-create the project with components we bought together many years ago.
I’ll do a quick thread explaining how it all works
This pinout means that the connector is not reversible. Using the TX and RX lines in a particular way would allow for that, but I chose not to do that (I'll explain why later.)
Technically speaking, a device should not enter DAM unless CC1/CC2 are both pulled up.
Early prototype of weather station project box.
Oversized battery, case, off the shelf regulator and solar charger, and wiring mess.
Goal for the break is get fw/sw/hw working and make smaller, better, and more integrated system after that.