Tuesday, November 26, 2024

JTAG to SWD Converter

Readers: If you'd like to build the project featured in today's post, please go to PCBWAY's Community pages--gerber file, KiCAD files and a B.O.M. are here.  

You can also help out this site immensely by checking out PCBWAY using the link here. Thanks!

===== 

Hello again:

Another simple one!  

I use GDB to debug C based embedded system projects--I currently use a Segger J-Link EDU debugger with a JTAG interface:

Segger J-link EDU Mini

But! The development board I am currently debugging is a Raspberry Pi PICO that has an SWD interface:



JTAG is not difficult to turn into SWD, it's a "connect this pin to that pin" challenge.

However I got tired of fiddling with tiny fragile adapter cables so I whipped up a simple JTAG to SWD PCB; the focus of this post.

 


REQUIREMENTS

The J-Link EDU Mini's JTAG interface uses a 2x5 pin 50 mil pin header--1.27mm --extremely small--conforming to the "Coresight 10" JTAG pin specification



The Pico uses 3 x 100mil SWD pins for SWCLK, SWDIO (data), and ground:



The Segger J-Link EDU board, unlike Segger's more expensive debuggers, requires a 5V reference....there were may ways I could have gotten 5 volts to the adapter PCB, from a USB cable for instance? Or a battery? 

However I used wirepads and 22 gauge solid wire and connected a bench power supply for 5V; I may rethink this design choice down the road. 


DESIGN AND LAYOUT

Simplicity itself....took me maybe an hour to lay out the PCB in KICAD, very little thought went into design, perhaps it shows?


Did a very quick 3D check in KICAD....good enough--sure. Off the gerbers went to PCBWAY.



BUILDING/TESTING:


PCB's are back! Happiness is new PCB's from this blog's sponsor, PCBWAY. Please help this blog by checking them out.


Easy build. The SMD JTAG 2x5 connector was pretty small but I managed to solder it without needing my microscope.

For the Pico I used a 3 pin JST connector:

The more JST connectors I use the happier I get, they are inexpensive and extremely reliable. You can get them for next to nothing from Tayda.


To test I coded a simple C proof of concept program: "PrintRTT", which used the adapter board to bring printf() statements from the PICO to a Segger J-Link and then to my Linux system. 

Wired it up:
Pico needs power as well--use USB and/or 6V-9V and GND to pins 39 and 38. 



Worked--I dragged the UF2 file to my Pico and ran the Segger "JlinkRTTViewerExe" terminal app on my Linux virtual machine..

You can get the code from Github here

Instructions for using the Segger printf() overload and the Segger RTT app are covered in latter half of the post here and the Segger page here.

Adapter with a "stock" Pico....the red and black gator wires are 5V and GND from a bench power supply, needed to provide the JLINK with its 5V reference.

And to debug the rotary encoder experimenter's board....

The adapter board was a piece of cake and worked first time. Viola! No more fiddling with tiny fragile SWD cabling. 

I had a few ideas for improvements: clarifying the silkscreens and adding more diode protection.

But for now it's time to move on.  

I remain extremely happy with the Segger J-link Mini EDU. There are other PICO/RP2040 GDB debug options  (DIY "PicoProbe" and the offering here) but to me the Segger offers a good mix of simplicity, value, and useful software tools for a Linux-based toolchain.  

That said....I'm feeling a little tired of crafting embedded RP2040 projects and might fabricate a few analog EFM based circuits (will it work? it effectively frigging might?) in the next few weeks, a distraction.

And some analog design.  

Wait, analog? Math, breadboards, smoked parts. Sure, why not? Until then: don't breathe the fumes! 


 

Sunday, November 10, 2024

Rotary Encoder Expermenter's Board: Improving the Hardware

Quick one this time....I have posted a few projects lately that incorporated a Raspberry Pi Pico, rotary encoder, and .96" OLED: here, here, and here. To make it unnecessary to breadboard the hardware, I posted an "experimenters board"--a development board to enhance a RP Pico that adds a rotary encoder, an OLED, a buffered GPIO output, and other enhancements.

Just now I updated the KICAD and Gerber files on the PCBWAY community site salient to the posts: go here.


The 9-29-24 revision of the experimenter's board uses less components, incorporates the encoder debounce library here, superseding the less responsive CD4011 based hardware debounce discussed here

Good news: it all works.

Thanks to Wendy and the gang and PCBWAY for patiently providing revised me with PCB's. You can help this blog by checking 'em out. 

9-29-24 revision

To make sure the grounding issues I saw with earlier revisions was a function the PCB's layout, not the schematic nor code, I breadboarded the entire "dev board for a dev board":


The breadboard example worked every time, but some of the older experimenters PCB's didn't, so, for versions of the board prior to 9-29-24, I felt I proved that this was a hardware/PCB layout issue.

I thought trace layouts for low frequency audio wasn't terribly important--put things almost anywhere, thrown in whatever traces you want--it will work--we are the bottom feeders?

Wrong. Apparently the I2C traces (at the very least) needed to be treated with forethought. probably any digital traces? 

Previously: more narrow traces....no ground pour


9-29-24 design improves that. 

I found myself putting the 9-29-24 assembly on hold for a couple of weeks, partially because I was tired of revising the board, and also having a feeling (incorrect, fortunately) that the 9-29-24 revisions would make things less reliable, not more.


Word of caution: 1306 128x64 .96 OLED's are everywhere but there appear to be 2 different pinouts coming from Shenzen: GND far left, and VCC far left.  

My design requires VCC on the far left--make sure you get that style of OLED if you build this project.

Spinning the rotary encoder advances or diminishes the counter on the OLED as expected. Every time, without fail. Thank goodness.  

Next: I have augment the code to create a user interface for the frequency counter....yes, I will get to that someday, but it means a lot of code changes.  

For now it's back to my day job--for better or worse the Pandemic is over.

Saturday, October 12, 2024

Building a Moog T904B Inspired High Pass Filter--Using an SMD hotplate--Works!

Readers: If you'd like to build the project featured in today's post, please go to PCBWAY's Community pages--gerber file (main board); gerber for jacks board, front panel gerber, KiCAD project/pcb/schematic/library files, a B.O.M. and more are here.  

You can also help out this site immensely by checking out PCBWAY using the link here. Thanks!

=====

This is a continuation of this previous post...where I laid out and built a Moog T904B HighPass Filter homage, based on a schematic from DIY pioneer Tom Gamble.  

Revision one's design/build attempt was disappointing, since it "worked" but sounded, well, terrible.

After rewatching the Kristian Blasol video (here) I wanted to keep working. The filter in his video sounds--interesting.  

Really interesting. Nasal, but also shimmery and a bit phase-shifty? 

To get my version of this filter off DogDoo Island I redesigned two of Revision 1's PCB's, improving ground planes; REV1's ground and audio traces looked terrible on my oscilloscope.

Good news: after building a REV2 Moog/EFM T904B, with PCB's provided by this blog's humble sponsor, PCBWAY, then spending an entire Sunday fixing stupid mistakes and experimenting with different component values, the Moog ladder highpass VCF sounds (I think)--much better. Maybe even good.

 I recall back in the day Mr. Gamble posting that his designs and kits were for experienced builders--something like that. In this case he was right! This HPF is a complex build, in terms of parts count, design complexity, and need for modification. This is not a good project for a beginner.  

AN ASIDE: WORDS FOR MY SPONSOR

Happiness is a new batch of boards from PCBWAY....

Shout out to Serene and the nice people at PCBWAY for sponsoring this blog. It sometimes takes me 2 or 3 revisions to get something to work; the T904B inspired HPF has been no exception. 

PCBWAY has always been patient, friendly and extremely supportive as I work through design changes. 

PCBWAY also has done great 3D printing for me and offers other useful services. They charge low prices and fabricate quickly. They are an asset to the DIY world; please help out this blog and check 'em out.

Back to the post....

SMOKING HOT


What fun would DiWHY be without trying new (for me) fabrication techniques?  

For the Moog/EFM T904B VCF build I purchased a $39 "Amazon's choice" 100mm x 100mm hotplate and $10 worth of solder paste.  

Links for the plate and paste (hope these links still work):

 TLZBK 350W soldering Station Hot Plate

Wonderway SN42 lead free no clean solder paste

I got building--gooped the paste, not being too neat about it;

 



 I used tweezers to put the 1206 SMD parts on top of the goop, then dropped it on the hotplate.

Note: if you want to try out this fabrication technique, work in a well-ventilated area. This hotplate/paste/SMD process produced a lot of toxic smoke; you shouldn't breathe its fumes.

Baked the jacks board....


Marvey--what temperature to use? 

This chart shows the heat curve one should follow--"IPC/JEDEC J-STD-020C--impressive?--but the plate only had set/enter switches for temperature; inputting complex functions for heating/cooling wasn't possible.


Instead, I decided to heat the damn thing up, and after the parts were put in place and the solder had melted, cool things back down. 

To my surprise this approach worked. At about 195C the parts magically centered themselves to solder pads and the solder flowed where it needed to go. 

After the parts set I let the plate continue to heat up to about 210C, then told the plate to climb back down to 100C, which it did, slowly.  

At about 150C I removed the PCB and put it on my bench to cool down to room temperature. I noticed that at 150C components could still be jostled and knocked out of place, so, removal of the populated, soldered PCB from the hotplate had to done carefully.

Visually inspecting after cooldown: in spite of my heat curve being far from ideal, it worked! 


 

I was chicken at first to bake on an SOIC TL071, but successfully soldered 2x TL074's using the hotplate when I soldered the main PCB's SMD parts.

Overall, the process was far more forgiving than anticipated. There was a solder bridge on an SOIC TL074 that I fixed with solder wick, and one 1206 resistor baked on 90 degrees opposed to where it should have, which I corrected with a soldering iron and some tweezers. 

Otherwise--all good.

One byproduct--after the 1206 bake there was a lot of leftover flux on the PCB. I used "no clean"paste, meaning this leftover flux isn't conductive and can stay where it is, but I dislike spoojim all over my PCBs. I am still trying to figure out how to best clean the no clean: flux remover, isopropyl alcohol, and other attempts haven't worked...maybe I have to leave it.

Overall using the hot plate and paste was far easier and less time consuming than soldering 1206 SMD parts by hand, and I imagine with a solder mask difficult SMD parts (QFN's?) are doable for DiWHY'ers using this inexpensive setup.

I will keep working with this hot plate for upcoming posts.

HIGH PASS DRIFTER

OK, let's talk HP filter.

The original Moog patent design looks like this:




From this MW forum post  the EFM design resembles the Moog ladder filter patent...indeed:

Long Live Moog! Long live EFM! Interesting: this is a 24db/octave high pass filter, a lot of other popular audio HPF's are 12db/octave (the Oberheim SEM's for instance--a favorite); meaning the T403B can be driven to oscillate.


From here it was a VCF build like so many other VCF builds: design and revise PCB's with Kicad; send gerbers off to PCBWAY; solder SMD's first then add through-hole components...

As per a comment in the youtube video: I didn't have to match transistor Vbe's, so I didn't.

Before too long I had new PCB's, populated and ready to test.

Testing. I used an single 3mm nylon phillips screw, standoffs, and nut to secure the jacks and mainboard to each other.

Did it work first time (WFT)?  

Nope.

I spent a masochistically joyful Sunday (all pain, all day long) troubleshooting the REV2 build. 

There were a few stupid build errors, the biggest: I put .22uF caps in the resonance feedback subcircuit, where .22pF should be used.  

I had a cold solder joint in the 100mil V-- trace between main and jacks board--that didn't help.

EFM mistake? The EFM schematic showed the main frequency cutoff pot with V++ (I used +12) Vdc on one side and ground on the other. Nope. It needed V+ on one side and V- on the other--this is corrected on the PCB's uploaded to the PCBWAY community site:


Otherwise the VCF cutoff required CV values below ground....doable, but not "normal" as I see things.

I found the EFM resistor values for CV mod didn't work for me; for my rack's 0-5V CV setup I used 20K's and B50K pots as in the snippet below.... 

 

Fortunately incorporating 1206 SMD resistors made trying different values for R1/R2 easy: using a 700F soldering iron with a sharply pointed tip I heated up both ends of the tiny resistors, removed them, and soldered in something different. This was faster and easier than working with through hole resistors and posed less danger of damaging traces when changing out components.

MODS AND SODS

Besides messing with resistor values I made two semi-major modifications to the EFM schematic:

First to the jacks board I added an output buffer:

R6 adjusts output--try between 10K and 100K to get the output level you want; I started with 10K (shown) for R6 but later changed it to 47K.
 
Second: I added an audio input attenuator to the jacks board: 

 
I added the latter ("ladder"?) because in this cool Youtube video the filter sounded slightly distorted at times.

Looking at the EFM schematic I thought that high peak to peak input signals saturated the first stage of the PNP/NPN/op amp trifecta--just a guess.

To my surprise the additional input attenuator didn't only let me dial in appropriate audio levels to remediate distortion, in some cases, the attenuator changed the character of the filter's resonance.  Unexpected, but I'll take it!
 
One more tidbit: I didn't have 220K 1206 resistors in my junk box, so on the main board I used 200K for R11 and 30K for R21. I am not sure how common 220K 1206 SMD resistors are at retailers like Tayda--whatever--some resistor values aren't critical--just get them close.

IMPROVED OUTRO

Anything Moog and EFM are cool right?  

Sure, but: this EFM Moog HPF isn't a module where every setting sounds great. In general I found I had to experiment--it's an odd beast--messing around is a big part of what we do, so this is a feature, not a bug? 

If I were to continue working on this filter--I probably don't have time--I'd add a resistor in series with the V++ feed to the cutoff1 pot (current "jacks board" has a resistor for V--, but not V++).  

Why: a lot of potentiometer real estate for the frequency cutoff above 2PM was useless--turn the frequency pot above 60-70% and the audio at output was gone.   

The modification to the cutoff pot should look something like this:



Update: modified! I cut the "3" leg to Cutoff1 on the jacks board and kludged in a 12K THT resistor between it and the V++ rail. Big help! If I do a REV3 of the jacks board I will include this modification.

Also: since this is a high-pass filter, it might be useful to change one of the modulation inputs to invert the incoming CV signal and set its bias to somewhere above ground--2.5V perhaps. Even better: add a modulation attenuverter to get cool inverted highpass effects. 

Finally: would matching Vbe in the transistor pairs make this sound better?  A traditional LP Ladder filter doesn't have a buffer between each transistor pair, but this design does, so I am going to guess it doesn't need transistors to be matched. Just a guess. 

OK enough for now--this has been a maddingly fun project--to remain high, consider giving this filter a pass. Something like that. See ya next time.

Sunday, September 15, 2024

4 x 1 Mono Mixer--A Confidence Builder

Readers: If you'd like to build the project featured in today's post, please go to PCBWAY's Community pages--gerber file (main board); gerber for jacks board, front panel gerber, a 3D model of the dual pot (WRL and Freecad formats), KiCAD project/pcb/schematic/library files and a B.O.M. are here.  

You can also help out this site immensely by checking out PCBWAY using the link here. Thanks!

------

I've DIWHY'd many projects lately that don't work due to dumb mistakes and I thought, enough! I'm going to lay out and build something easy, useful and practical. 








Everyone needs more mixers right?

The "EZ MIX" was really easy; it took me an evening to lay out and about a half hour to build: a simple 4 input AC/DC unity gain active mixer in 6HP Eurorack format.





The star of the show: dual concentric pots; you get Eurorack's "fit every damn thing on the head of a pin" paradigm without needing extremely tiny hands to turn the knobs.

           

                              

I laid out a footprint for the concentric potentiometer in Kicad and 3D model in Freecad:  



                                                 

Piece of cake.

The project used 3 boards: front panel, jacks panel, and main PCB, centered around a single dual op amp IC.

Everything on the main board was through-hole; other than triple checking sizes, legends, and drills there wasn't a lot to go wrong. 

To remain old school: JST connectors were used between the main board and jacks board.

Main board

jacks board

Front panel....

Off it all went to this blog's honorable sponsor, PCBWAY....

Happiness: new boards from PCBWAY

Zoom, printed circuit boards were back, I gathered up parts from the junk box and got building.






I was fearful things wouldn't line up, thankfully they did....






Everything worked first time ("WFT")--pots went from no volume to full volume when turning them clockwise, audio signals got mixed, legends on the front panel were correct, and most all silkscreens on the boards were accurate.

One (big) mistake--the "Redstripe" (negative voltage) silkscreen callout was on the wrong end of the Euro power header. This silkscreen error was fixed on the 9-12-24 revision I uploaded to the PCBWAY community.

The only SMD part for the project: I added a 0 ohm 1206 resistor between Out1 and Out2. That way if I reused the 3.5mm jacks board in another project the 2 outputs could be independent of one another.  

But in the spirit of this build I soldered the 2 output wirepads together--who needs SMD?



 Finished!






So much fun I made two of them...

Overall, it was great to kick back and design then build something really easy. 

Getting stoopid from time to time is fun....but now it's back to debugging, dealing with cryptic IDE error messages, C++ that won't compile--all the usual things. I can't wait. 


JTAG to SWD Converter

Readers: If you'd like to build the project featured in today's post, please go to PCBWAY's Community pages--gerber file, KiCAD ...