Test #1

Open
ivanxblue wants to merge 0 commits from archived into main
Owner

Test

Test
ivanxblue added 97 commits 2026-07-29 22:36:41 +00:00
This contains the skeleton beginnings of a new guitar pedal project.

This initial commit only contains some basic symbol and footprint
definitions brought over from the previous project.  Actual boards to
follow.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This is the re-done base board from the 1590A project, but organized
differently: with the 1590A you had to have the audio jacks side-mounted
and the resulting 'base board' was the size of the whole enclosure and
also dealt with the stomp switch.

In contrast, in a new bigger 125B enclosure it makes a bit more sense to
top-mount the jacks, and the base board thus becomes just the 'jacks'
board that only deals with power and audio jacks.

The jacks board still deals with the signal switching, but it is now a
'soft switch' controlled by a logic-level signal.  I did explore that
option in the 1590A project, but now it's an integral part of the
design.

This only contains this 'jacks' board with some very basic power supply
reverse polarity protection, the high-impedance input signal buffering,
and the MOSFET switching logic for the output.

Note that you can choose to ignore the MOSFET switching, and do the
pass-through entirely on the effect board (for example by just having
the digital effect be the NULL effect with the resulting slight delay).

But an actual "true bypass" mode is not supported by this design: it's
not only not very interesting from an analog circuit design standpoint
(which is why I'm doing this all), it also would require passing off the
raw signal handling entirely to the other boards.

But I do expect the JFET buffer and the MOSFET switching to be quite
good based on previous experiments - it looks like complete overkill for
a guitar pedal.  Famous last words: I've only built a single LS844-based
JFET buffer so far, and while that one showed excellent results, maybe I
happened to be lucky.

The effect is expected to be handled by the Electrosmith Daisy Seed
board:

    https://electro-smith.com/products/daisy-seed

and the result is at least initially designed to be compatible with the
Hothouse pedal kit by Cleveland Music Co:

    https://clevelandmusicco.com/hothouse-diy-digital-signal-processing-platform-kit/

so none of this is in any way novel or interesting except as my
continual journey to learn electronics.

As part of that, the implementation is quite different from the Hothouse
pedal.  Part of it is in the switching logic, which the Hothouse does
not do, instead always going through the Daisy Seed (with the resulting
5.2ms latency even with effects disabled).  And part of it is in the
analog circuits, where the Hothouse pedal uses a regular (sane) op-amp
based buffering, while this uses discrete components.

I actually would like to learn the mixed signal side too, so one
possible longer-term plan is to actually integrate the STM32 and the
PCM3060 from the Daisy Seed onto the main board itself.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Look, with the larger 125B enclosure, this is pretty trivial, and I'd
rather have the electromechanical side separated out from everything
else.

And while the larger enclosure means that there's more room, I still
detest the fact that the 9mm pots are 10mm high with unused space below
them.  On the old 1590A boards I would place SMD components under them,
but here there's no point to even that.

So despite having more room, I'm trying a "low profile" configuration
where there are NPTH holes for the standoffs, and the through-holes for
the legs are big enough that it lays flat on the board and is only 7mm
high as a result.

Why? Just because.

If all goes well, I won't be messing with this board very much -
although I will have to think about the connector placement more when I
put the boards together and try it out.

Right now this just puts a SWD pin header (10-pin 1.27mm IDC cable) in
the middle of bottom of the board, which kind of defeats the point of
the whole "low profile" thing.  I might end up with a board-to-board
connector eventually.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This is almost embarrassing, but I don't like solder lugs, and while all
it does is have a LED and a compact stomp switch, it's actually trying
to be subtly useful: you can populate one side or the other to change
the "handedness" of the connector, which is useful for dual stomp
situations.

And the 12mm LED distance should work for both the 1590A and 125B
enclosures.  Of course, that would require a 1590A board that does soft
switching.  To make that 1590A an option, this uses a 1.5mm JST-ZH
connector.

But for now it's hopefully useful at least as a "let's try this all out
by just wiring things together" thing.  Maybe I'll integrate it some
other way eventually, but at least for now I'm just doing this in small
modular pieces.

This just happens to be a particularly trivial modular piece.

NOTE! Despite being particularly trivial, the actual footswitch needs to
be attached the right way around, and the orientation isn't obvious.
Yes, there is a keyway slot on the footswitch that shows the
orientation, but it's easy to get wrong.

And perhaps more importantly, while the footprint is for the E-Switch
FS5700 footswitch that has good documentation, other footswitches seem
to have the same PCB layout but apparently different actuation.

For example, it appears that the Tayda A-1884 has the same footprint,
but numbers the pins differently (1-3 twice, rather than 1-6), and that
particular (bad) datasheet says that 2-3 are normally on, while pressing
the switch will connect 1-2.  Of course, the datasheet I found doesn't
make it clear which way is pin 1, so...

On the E-Switch one, it looks to be the other way around.

So be careful out there. Measure twice, solder once.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This just connects the jack and pot connector to a board with the Daisy
Seed on it.  Those connector locations need to be re-thought, and the
LEDs are basically randomly placed.  This is not going into an
enclosure, it's just getting tested next to the other boards with IDC
cables randomly hanging between them.  I'm not proud.

Note that routing could be improved by picking different pins from the
Daisy Seed, but this intentionally tries to be pin-compatible with the
Hothouse pedal, at the cost of making the routing trivially uglier.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1590B enclosure, for manufacturing via 3D-printing, including the assembly hardware.

In a next PR, we can add the mounting posts and cutouts for the PCBs, make a FreeCAD assembly, create a BOM for all the components and create a screenshot of that for the README.

Signed-off-by: Aleksander Sadowski <aleksander.sadowski@alsado.de>
The notes also have some pictures of the test boards (I don't have the
current design in hand yet) to give some idea of what the heck this is
if you don't read KiCad files.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
I didn't even realize I lost this when I did the project reset, until I
started looking at pull requests that didn't have sign-offs.  Oops.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Fix some link issues, add some commentary on part choices.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This does the +VA net a bit differently: by using a common collector
series follower transistor I can use much bigger resistors in the
lowpass filter because the current through the resistor is just the tiny
base current.

In fact, let's just make it the main filtering stage, and share the
resulting +VA rail for both the input stage and the output bias.  They
both need on the order of one mA of current, so assuming a DC current
gain (whether you call it h_{FE} or Beta) of roughly one hundred, we can
easily use a couple of 2k2 resistors and make it a 2nd order filter.

(The original used a single 220 Ohm resistor, so this increases that by
a factor of twenty, but then the h_{FE} will more than make up for it)

Of course, the small viltage drop over the resistors will now be almost
entirely dwarfed by the V_{BE} voltage drop of the transistor.  But if
it gives us a nice stable analog voltage rail, it should be worth the
small voltage drop.

I use a MOSFET for reverse polarity protection because I don't like the
voltage drop of a simple diode, but that's because the voltage drop
there would be just a negative.  Here there's a _reason_ for a voltage
drop.

Of course, I don't know how much it really helps with noise, but it
looks good in simulation, and I'm willing to at least do a test board
for this.

I'm just using the BC846 BJT I already have around.  It's a very average
cheap general-purpose transistor, I have no idea if this is any good.

Live and learn.  That's still the point of the whole project, after all.

While doing random trials, this also ends up DC-coupling the input side.
I probably shouldn't do two independent changes like this, but I'm too
lazy to do two separate boards.

Talking about separate boards: I wish KiCad had some good way to share
common circuits (some kind of "combination symbol" concept or something)
so that you could do explicitly different boards without having to
either do duplicate boards, or like this, just change an existing one.

I guess I could use different git branches for trial runs like this, but
with all the random noise that any small change makes, merging things
when they work would probably be a nightmare.

Anyway, just random musings when doing random testing with things that
may or may not be a good idea.

In another news: when laying out this change, the resulting board is
just a single layer.  The bottom copper layer is all ground.  Not that
it matters, but I like how clean it looks.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
I'm not loving how KiCad does 'projects', but I made it worse by just
dealing with this all wrong.

To me, a "project" is the whole thing, so when I've split things up into
multiple pieces, they are all part of one big project.  But that's not
how KiCad thinks of things.

To KiCad, a project is just a single PCB, and while there are plugins to
deal with that (from a quick look, KiKit would be a great idea), I'm not
quite ready go there.

So my "project" is a collection of several KiCad projects, and then I
used global symbol and footprint libraries that I just pointed at the
directory they all share.  That seemed like the simplest solution to the
disconnect in what "project" means.

But simple or not, it turns out to be a horrible model because the
disconnect means that now your (to you) project-specific libraries end
up being in the global KiCad setup, and makes it all painful to move
between machines etc.

It's also nasty because KiCad only understands about it's own local
project root ("${KIPRJMOD}"), and to get to the "real" project root I
then had to use "../symbol" to go up to the top-level symbol.

And that then causes more problems if you want to have a different
directory hierarchy and have sub-projects that are deeper in the
hierarchy.

In other words, there's just a bad impedance match between the KiCad
notion of "project" and the actual real project notion.

This improves on the situation by making the libraries local to the
KiCad project, and then just pointing them at the global project
libraries individually.

Sadly, while that takes care of loading symbols and footprints - because
they have their per-project path configuration, it doesn't solve the
simulation file paths.  I can't find any per-project path for loading
simulation files, and the whole "${KIPRJMOD}/.." approach has the same
issue with nested hierarchies.

The best I could do is to introduce a per-project 'TOPLEVEL' text
schematic variable, which then does work in simulation path, and I can
use "$(TOPLEVEL}/symbol" for those.

There might be better ways to do this, but this seems to work for now.

Now you have to make each subproject have those pointers, but it should
mean that I can have hierarchical projects, and this "my project" vs
"kicad project" thing is at least a bit more explicit and should travel
between machines as part of the whole git tree better.

Maybe some day kicad will support this kind of higher-level project view
natively (while googling this I found that I'm definitely not the first
person to have wanted kicad to better support multiple pcb's), but for
now I think this is at least better than my previous (dis)organization.

Also make the pointer to external spice library directory be a symlink
rather than more explicit ".." hackery.

I wish I could just put those external spice files all directly in the
git tree, but for some unfathomable reasons some manufacturers limit
sharing of their spice files even when they are public and used to
support the hardware they sell.  Cray-cray, but I suspect some people
were dropped on their head a few too many times as babies.  Maybe they
were too ugly and their mothers recoiled in horror?

Anti-moral of the story: don't be ugly.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This is *not* the same as the old 1590A project.  Instead it's basically
the 'Jacks' board, but in a 1590A form factor.

There is one big difference, though: the jacks board expects the effect
board to do the on/off toggle logic, since that's how the Daisy Seed is
set up.  But this 1590A board has the old effect board model where the
effect board only does the effect.

In fact the connectors to the effect board are the same, so old effect
boards should just work.

As well as they ever did, that is...

To handle the stomp switch, this re-introduces the on/off toggle circuit
I was toying with in the 1590A repo but never used, with the intention
of using the shared stomp switch board.

... except I didn't think this all through when I did that board, and
right now that board is set to always make the switch and LED connect to
GND, and so has only three wires.  That's what the Daisy Seed does, but
it's not what this "resurrect the 1590A form factor" board wants at all.

So this has a completely made-up four-pin connector that is most
definitely not the final one, and is not one that matches the current
stomp switch board.  It's a place-holder for when I make my mind up
about what I'll do.

But while the physical connector is wrong, it does have the right model
for the stomp switch connection: just two pairs of wires for the switch
and the LED respectively.

You could just solder individual wires like some kind of animal.  But
that's not how we roll, is it?

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Despite the README.md mention, this wasn't the enclosure I was thinking
of: the one I actually used for the jack board design was the slightly
bigger 125B enclosure (aka "Hammond 1590N1" - the naming really isn't
wonderful, which also explains my confusion).

However, there's a really nice 3D model STEP file for the 1590B that I'm
about to pull in by Aleksander Sadowski, so let's add the symbol and
footprint.

I've put the potentiometer and stomp box holes kind of randomly in here,
and I think that I might have to shrink the Jack board too to take the
smaller 1590B size into account.  But it would be good to aim for parts
that can fit in _either_ the 125B or the 1590B form factor.

Put another way: this all will likely result in more random layout
noise.  But I'll have to modify the stomp switch board anyway, so I'll
chalk this up to "early days yet", in addition to the usual "Linus is
disorganized and not very competent".

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Pull 3D model for 1590B enclosure from Aleksander Sadowski.

This looks nice in the 3D viewer, and shows that no, the Jack board
doesn't _quite_ fit as-is when you switch the 125B box to a 1590B one.

It's close, but no cigar.  The jacks are a bit too far apart, so the
board ends up hitting the screw posts (note that without 3d models for
the jacks, you only see the board there).

I'm not sure I'll use a 1590B enclosure, but having the model certainly
makes it a more interesting option.

And it's going to be easier fitting something designed for a 1590B into
a 125B than the other way around, so it might be worth it using the
1590B as the design target just for that reason.

Sadly, the obvious fix - to just bring the jacks in closer together -
would mean that the shrouded 10-pin IDC connector no longer fits in
between them.

Yes, KiCad already complains about the IDC connector and the jacks
having overlapping courtyards when you run the design rule check, but
that's because the standard KiCad IDC connector footprint has pretty
lazy courtyard.  It's not even a particularly tight fit, but it's
certainly close enough that I can't just bring the jacks in without
having to change connectors.

That said, changing connectors is certainly an option.  I _really_
should look into FFC connectors: the IDC connector (and the smaller
1.27mm version SWD connector that I ended up using for the potentiometer
board) are convenient and easy to make connectors with, but FFC would be
even better.

Except I've never used FFC and I worry about bending/kinking those
things.

* 'main' of https://github.com/alekssadowski95/GuitarPedal:
  Added 1590B enclosure STEP files
Note that I picked the Z offset as just a random number that looks
roughly right for the jack board, but with the different boards at
different offsets, I don't know that you can ever get it right.

But it's all a pretty visualization of how the board doesn't quite fit
in a 1590B.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Ok, I admit it.  I'm not a designer, and I never will be.  But I like
openscad as a way to generate simple models from a simple textual
description.  And no, openscad doesn't spit out STEP files, but FreeCAD
does take openscad files and can export the result as a step file.

"Why don't you just use FreeCAD natively?" I hear you ask.

I find mousing around annoying.  I'd much rather write a simple text
file that specifies a few 3D shapes by where they are, and then generate
the 3d models from that.

And yes, they'll be ugly.  But they'd be ugly if I tried to use FreeCAD
too.  Because there's a common theme here.  Me.

Now, the FreeCAD import of openscad files looks fine inside FreeCAD, but
when it is then exported as a STEP file, the result is not great.
Instead of the "hole" for the 6.35mm jack, it's exported as a plug.

I suspect that what is going on is that it's probably done as a
"transparent plug", and then the transparency is lost at some point and
it just ends up being a solid plug rather than a hole.  But don't quote
me on that.

There's probably some trick to fix it, but I can't find it in myself to
care too deeply.  It makes a rather ugly part unnecessarily uglier, but
not enormously so.  The 3d model still works as a "this is the layout".

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
It turns out that the STEP file generation is subtly influenced by odd
openscad file parsing issues.  I can re-organize the part to make it all
JustWork(tm).

So this avoids the "hole in the jack turns into a plug" issue by just
organizing the openscad file a bit differently.

In another iteration of trying out variations of a theme, things looked
fine in both openscad and freecad, but the STEP file export had the hole
not just as a plug, but missing the rotation.

So this is all a bit fragile and I'm not sure what the exact pattern to
the problem is, but at least this version seems to look reasonable.

"It compiles? Quick - ship it!"

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Based on the Würth datasheet:

   https://www.we-online.com/components/products/datasheet/694106301002.pdf

and my stumbling attempts at generating a STEP file with openscad and
freecad.

This time I couldn't get rid of the "hole turns into a plug" problem
with the freecad STEP file exprt, so once again the model looks fine in
both openscad and in freecad, but the STEP export just looks wrong with
no hole for the power plug.

There's some subtle order of operations bug thing going on.  But I'll
use it as a way to distract from the ugliness of the model: everybody
will just look at the lack of hole for the plug, and overlook the harsh
edges.

Also: dazzle them with colors.  That's the trick.  Nobody will question
my mad design skillz when it's colorized and there are obvious freecad
export issues.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
When doing the 3d model for the Würth 2.1mm DC power jack, I took the
leg widths from the datasheet, which says that the center pin is
connected to a leg that is slightly wider than the other ones (2.8mm vs
2.4mm).  So the 3d footprint reflects that.

And when then looking at the 3d viewer, the resulting 3d model leg then
didn't fit in the hole of the footprint.

Now, in reality that was becasue the 3d model legs were artificially
rather thicker than reality (at 0.6mm, when reality it is more like just
0.25mm thick), and the pcb footprint actually matched the recommended
hole pattern in that same datasheet (3mm x 0.8mm).

But looking around, the regular KiCad footprint for this thing does make
the hole for pin 1 bigger.  So this just makes my footprint match that,
since that's what I actually used to use on the PCB anyway (ie I
switched back to my own footprint only now that I added a 3d model for
it).

When I measure the actual DC jacks I have, they don't actually have that
pin as wide as 2.8mm.  But I have a mix of random DC jacks, so the one I
happened to measure may not even be a Würth one.

Put another way: this doesn't really matter, but for "match with
previous footprint" let's just fix it up.

In the new 1590A board I had randomly decided to test a surface-mount
version of this thing, so that doesn't have the same issue (and doesn't
have a 3d model at all right now as a result).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Some of the footprints didn't have easy pointers to available
information.  Add them.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
I really wanted to use the stomp switch board, but I didn't find any
sane connectors that are convenient and fit.

So I just updated this board to have the stomp switch directly on the
board instead.  I'd love to re-use stomp switches after I have made a
(bad) design and tested it, but the pain just doesn't seem worth it.

That means that I could just have used a traditional latching 3PDT, but
instead this sticks to the electronic switching with a momentary switch.
Because the whole point is the circuit, not sanity.

Add another openscad 3d model for this stomp switch thing.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This also shows how the 'Low profile' footprint uses the same model,
just shifted down by 3mm.

I hit more STEP file export problems, but seem to have worked around
them by saving in the AP242 format.  Or maybe it was some other random
change - the freecad STEP file export of OpenScad imports really is a
bit hit-and-miss.

This time the export randomly added another leg at 0,0 that didn't
actually exist.  I would expect that lots of people use the STEP file
export functionality, so I have this suspicion that it's the openscad
import that leaves some odd stale information around that then confuses
the export.

I was expecting to not hit any problems this time simply because there
was no 'difference()' operator, and that seemed to be what caused issues
before.  But clearly it's something else going on.

Whatever. The model looks fine now. Knock wood.

(And by "looks fine now", I obviously mean "it's as pretty as you could
ever expect my models to be")

I'm doing silly 3d models just to distract from the fact that I'm
frustrated with just physical layout issues.  I really don't love how
boring the 125B box is, and the 1590B box is actually smaller in the Z
dimension than a 1590A is.

The "Low Profile" use of the pot helps with the box height issue, and I
can easily fit things in a 1590B enclosure using the same model of
stacked PCBs that I used in the original 1590A setup.

But sane connectors are eluding me unless I just use pinheaders again,
and I was really hoping for a modular setup.  Some frankenstein thing
with 90-degree pin headers / sockets connecting boards side-to-side? In
addition to the vertical stacking? The mind boggles.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
I've been using that Tayda mono connector that is very compact, but I'm
playing around with this Neutrik version as a more robust component.  It
also happens to be stereo, which is irrelevant to me for now, but maybe
that will change some day.

Yes, there's already a footprint for this in the standard kicad
footprint libraries, but it's centered on the tip pin.

I find those kinds of footprints really annoying when the placement of
the component is about the physical placement of the _connector_, not
the pin, and that's what you really care about (ie for enclosure drill
files).

So this just does that Neutrik connector and centers it on the barrel of
the connector, so that you can just specify the component location by
where you want the barrel to stick out.  Which I feel is much more
relevant to any placement than where the pins then happen to end up.

Is it just me that does this? I've done the same for pots too: make the
footprint center on the shaft of the pot, not some random pin, and now
you can rotate the part around without changing the physical location of
the thing that actually matters, or just edit the exact placement in the
properties window.

I often wish many other components would be done that way too: I find it
annoying when I rotate a LED around to switch the legs around, and then
suddenly the LED is in a different position - because the part was
centered around a random leg rather than the part that matters.

Maybe there's some trick that real designers use that I'm missing, which
doesn't involve a calculator or eyeballing it.  But my solution has been
to just re-do the footprints the way I think they should have been done.

Also add a simplistic 3d model for this thing.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Ok, I have one of these in hand now, so I could verify the polarity of
the switch.  So rather than have holes for either orientation, just do
the correct side.

I probably actually want to use this switch, since a full-sized switch
is actually what I want for the double-decker model that I used for the
1590A enclosure, and I think that's the model I will go for in a 1590B
too.

Also do a 3d model for it.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This updates the 1590B footprint details, and adds Tayda-esque drill
patterns and a 3d-printed drill template for that layout.

The new layout uses side-mounted jacks rather than top-mounted ones,
kind of like the 1590A, except the jacks are symmetric rather than
offset (the 1590A required offset jacks just because they wouldn't fit
otherwise).

One reason to use side-mounted jacks is that the Neutrik jack wouldn't
fit top-mounted.  But I kind of like how it also separates the power
from the signal on the board instead of having everything crammed up
together at the top.

But I'm still playing around.  The drill template is good for
visualizing things, and I was even able to drill a passable enclosure
manually with it.  I'm still thinking about physical layout so this may
not be final, but it doesn't feel wrong.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
I tried to deal with the kicad path handling with a 'TOPLEVEL'
environment variable, but it worked horribly badly and got out of sync
because kicad didn't really integrate very well with it.

So just live with the fact that you can only have per-project paths for
the symbol and footprint libraries, not for the 3D models.  kicad does
have the notion of "3D model paths", but they aren't per project.

It looks like the way to keep kicad happy and avoid too much confusion
is to just make the 3D models be part of the footprint library, and put
the STEP files in the same path.  I'll keep the original openscad models
in the 'Models' (and 'Enclosures') directories.

Let's see if this fixes my issues.

Also, this mixes in various other edits to the 1590B footprint in
particular, since I couldn't keep the regularly scheduled kicad noise
separate from the 'move things around' noise.  kicad likes to randomly
update the uuid's of various parts as something changes (or, as I
sometimes feel, even if nothing changes).

So this is not a particularly clean commit: this also moves the pot
locations up by 5mm in the 1590B enclosure because that's what I was
looking at when the potentiometer board stopped showing 3d models due to
path confusion.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This uses the models to populate a rough copy of the actual board
layout, so that you get both a drill guide for drilling out the aluminum
enclosure, and a test print to add to it.

It also adds a model of the Daisy Seed to get some idea of placement.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
.. and also fix up the STEP file for the PBS-24-102P momentary stomp
switch.

It turns out that the trick for making freecad do proper STEP exports of
OpenScad imports seems to be to not do "select all" - which appears to
end up selecting some stale left-over results from the import too.

Instead do an OpenScad import, but then use the FreeCAD "box selection"
to select the 3d model, and then export that selection as a STEP file.
That seems to avoid the random odd stale leftovers from the import.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
These were both just freecad re-imports of the openscad file, with "box
selection" and then re-export as a STEP file, and now the stomp switch
has a proper key slot and the DC jack isn't plugged up, so the 1590A
render looks nicer.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
The removed TOPLEVEL hackery also tried to deal with the problem of
finding the spice models for simulation, which had the same confusion
with project-specific files and no sane kicad model that I could find
for it.

This attempts to deal with it by just making a 'spice' symlink from the
"kicad project" directory to the "real project" directory, and dealing
with the spice model paths that way.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
I didn't think this through: it looks superficially fine only because
the circuit doesn't make the _other_ side of the JFET gate connection
obvious.

Without the AC-coupling capacitor, the input gate of the LS844 now has a
relatively low impedance path to ground, going through the instrument.
So the self-biasing to ground with a high-value resistor doesn't work at
all.

To do DC coupling, I'd need an actual negative rail.  I technically knew
that, but I clearly hadn't really internalized it and so just overlooked
this obvious (in hindsight) fact entirely.

I do have the simulation infrastructure for this and when you look at
the results you see that the biasing is all wrong without the
DC-blocking capacitor in place.

But to see that you do need to look at it, and I hadn't bothered since
it all used to work fine and I didn't think about this.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
I think I have decided on 2x04 connector to the potentiometer board, at
least for now.  It's a bit more mechanically stable than a 1x08.

So redo the routing, do some via stitching, and put that thing in the
middle of the potentiometer board.  I think I'm almost ready for a 1590B
Daisy Seed board.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This integrates the stomp switch and the Daisy Seed with the jacks on
the base board, because connecting things up was a bigger pain than just
integrating everything.

The end result mostly matches the 3d model in the Template directory.

As a result of the integration, this also removes the separate Jacks,
Daisy Seed and Stomp boards: they are all parts of the board here.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
It's 6.5mm up from the base, not 6mm. See

   https://www.neutrik.com/media/8570/download/st-nrj6hm-1-pre.PDF?v=2

for details.

I'm just checking this for drill patterns, and updating the drill
pattern text as well.  I'm doing a test enclosure run, because it takes
2+ weeks to get any back, and I have the merge window coming up.  So
when it's done, maybe I'll have boards and enclosures to actually test.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
The bigger one probably fits better, since we have to reach up past the
audio jacks anyway.

I suspect I will go back to the actual 3PDT true bypass model for this
board, though.  The electronic switching is more interesting, but let's
face it, the simpler circuit with a physical switching of the signal is
simply more practical.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
I didn't have a plain PNP BJT for some reason, and the dual transistor
packages I do have were a bit inconvenient when I wanted to use one
transistor on the signal path and another on the power path.  So add
another transistor to the list of transistors in my library.

And since I had looked at a high-h_{FE} version of the BC846 NPN BJT
that I already have, I decided to just go for it and add both a NPN and
PNP version.

The BC847C is a higher-h_{FE} grade of the BC847 series, which in turn
is similar to the BC846 but with lower V_{CEO} (45V vs 65V - irrelevant
for my use).

The BC857C is then the PNP version of that.

Do I need the higher DC gain? No.  I had looked at it due to my use of
the BC846 in that analog rail filter trial using the common collector
series follower setup.  But they are pennies, so why not?

Also add in the spice model for the NMB2227A, which was missing.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This is the one that uses a traditional 3PDT stomp switch with true
bypass and thus avoids the whole soft-switching MOSFET games.

But to not make it too boring, I'm trying a different input buffer,
which is a bastardized Sziklai pair with a JFET and a PNP BJT.  It
simulates quite well, which obviously means not a whole lot.

This also uses a high-gain BC847C signal transistor to push the whole
attempted low-pass filter on the power rail even more.  That, in turn,
it driven almost entirely by the crazy simulated 60Hz ripple at 100mV
PtP.

Honestly, if you have 100mV ripple on your guitar power supply, you have
bigger issues and should just get a different power supply, but it was
fun to simulate this down to a 10uV signal with that 100mV power supply
ripple.

Of course real noise is very different, and no longer at 60Hz.  Modern
power supplies have that 10mV noise at a few hundred kHz (or in the MHz
range) instead.  So this is all pointless except as a trial simulation.

That JFET/PNP Sziklai pair also may not actually work in reality, but
hey, it's interesting enough that I think I'll at least try it out to
see.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Fix up the CK-6.35 footprint for the correct symbol

Ok, annoyingly, I've been using the wrong audio jack symbol for the mono
case.  It works fine, but it wasn't really right.  I need to go back and
fix the schematics, but here's the right S/T/TN footprint, at least.

This also adds a "no non-plated through holes" version of the footprint:
it uses the small plastic legs as actual legs instead of as positioning
nubs.

That makes the part take a bit more vertical space (or you have to just
snip the plastic extrusions off, like I used to do) but can make it
easier to fit other components on the other side when there is no NPTH.

Finally, related to that "actual legs" change, this updates the 3d model
to have the right height for those feet and does a new freecad STEP file
export, and then adjusts the Z offset for the model in the footprint
version without the board holes.

This is just prep-work for any tight boards.  I'm looking at you,
1590LB.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Several slightly different datasheets for this one, but they are within
0.1mm of each other so they all probably work.  The one that looked best
was the one from LCSC, so that's the one this is based on.

This obviously works for audio, but I'm actually primarily considering
it as a "remote stomp switch connection" jack in a 1590LB enclosure.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Pretty bare, but usable as a starting point.  I'm just playing around
with the remote stomp switch thing, and possibly putting a simple effect
in a second 1590LB.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
My 1590B test board works fine, but I was confused about the behavior of
the pots.  It turns out that for about the fifteenth time, I had them
the wrong way around.

Obviously the real cause is my incompetence, but I think it's made worse
by how the default symbol is laid out, with pin 1 at the top.  I then
mindlessly hook it up with positive rail at the top and ground at the
bottom, and the end result is the opposite of what the trivial
expectation is.

Not a biggie, this doesn't matter for my testing and could have been
fixed by just reprogramming the Daisy Seed too, but it's obviously a
"D'oh" moment.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
I already had the PMV250 P-MOSFET, but didn't have any single N-MOSFET's
to play with.  Until now.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
I had entirely forgotten the activity LED, which was really annoying
when testing.

Also, while the transistor follower / capacitor multiplier on the analog
power supply was interesting for some low frequency power supply ripple
removal in simulation, it doesn't actually make any sense with any
modern power supply, so just do a regular RC filter for high
frequencies, which is what actually matters.

Together with the fixed potentiometer board, I think this should now
work nicely.

Famous last words.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
I had decided that the effect board didn't need the input to be
ground-biased, and that was very wrong, and made some of my old effect
boards not work.  So add the AC couple capacitor and resistor to ground.

Also do the same boring RC power smoothing with the voodoo ferrite for
the +VA line.  Let's keep it simple and realistic - the noise isn't some
60Hz ripple, it's all SMPS high-frequency stuff.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
I hadn't done this one for some reason..

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This allows me to include the FS5700 openscad model into other models,
which helps visualize (and 3D print) the full board.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Yes, yes, I know I said I was thinking of a remote switch pedal in that
1590LB enclosure, but what a boring thing that would be.  So instead,
this fits an actual boost pedal into a 1590LB enclosure, using what is
basically a discrete component op-amp circuit.

It is not unlike my original boost pedal in the 1590A enclosure, except
the soft-clipping diodes are hardcoded - no room for a switch - and it's
a discrete JFET input buffer with a discrete op-amp-like thing instead
of using an actual op-amp.

Actual real op-amps are both simpler and much more powerful.  This just
approximates the real thing as a proof of concept.

It's going all out with a long-tailed pair, current sources, and a
push-pull output stage.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
I'm not sure this fits vertically in a 1590LB, but the "everything on
top" model means that the audio jacks are very high up.  Which is not
great from a hole drilling standpoint.

So try putting the audio and DC power jacks on the back of the board,
moving the surface-mount components to the front.

And to make things fit - and because I feel like having done an op-amp
using discrete components - go back to just using an actual op-amp now.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
The actual real spice file needs to be downloaded from TI, but this is
the "make that oddly formatted file JustWork(tm)" wrapper thing.

And yeah, ngspice has tons of issues with the TI opamp spice files, and
this all simulates much less reliably than the discrete component
version.  That's not a new issue.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
I've uglified the openscad 3d model to make freecad happy and do the
STEP file export.  Who knew that I could make my models even _uglier_?

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
I wanted to do some mixed-signal board, and decided that the RP2354A was
the thing to use, since it doesn't need to bother with external flash
etc.  You'd probably still want external PSRAM, but that's not a hard
requirement either.

The Raspberry Pi is well documented and this largely uses the design
from the "minimal board" reference docs.  That includes the KiCad symbol
itself for the RP2354A, which is in the example RPI schematic.

The codec is the TAC5112.  Not because I know what I'm doing, but
because it looks like a reasonably simple-to-use single-supply audio
codec that can use the same 3.3V supply that the RP2453 uses, keeping
things fairly simple.  Famous last words.

And no, none of this is really wired up yet, so there's no real PCB
layout yet.  I've not verified that any of the GPIOs make sense etc, and
all of that will presumably change when I do, and when I try to actually
lay things out.

I'll also need to actually do a proper job of picking footprints.  This
is mostly 0402 components with some larger caps randomly other sizes.
Very rough kind of "maybe something like this will fit and work"

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
That's the external polarized inductor that is suggested for the RP2453
1.1V voltage regulator.

Footprint based on recommended land pattern in the Abracon datasheet,
which appears to be a bit different from the one the Raspberry Pi
minimal design one, but whatever.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
.. and fix up the LED simulation a bit too.  I simulate LEDs with the
built-in diode model, but with N ("emission coefficient") set to 3,
which gets me a forward voltage around 2V.

But I think I should change RS ("series resistance") instead (or in
addition to).  See

    https://led-ld.nichia.co.jp/api/data/spec/tech/SP-QR-C2-210932-2-E_The%20SPICE%20Model%20of%20LEDs.pdf

which talks much more about this.

I guess I don't care that much, I just wanted the current simulation for
the power LED to be in roughly the right ballpark.

The inductor change is the relatively important thing here.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
The size choices were a bit random, this standardizes on 0402 for
resistors.  Also, optimize the BOM by just sharing values where they
don't matter that much.

For example, we need those 5k1 resistors for the USB CC pulldowns, and
we might as well then use that for the i2c pullup resistors too.  And
the self-biasing source resistor for the JFET input could use the same.

For similar reasons, just standardize on 33R for the low value resistors
that we use for the USB data line serial termination and the analog
voltage RC filtering.

Capacitors are 0402 for small values (0.1uF and smaller) or 0603 for
bigger capacitance values.  That seems to match availability.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This is a long time coming, but it was triggered by jlcpcb not stocking
the MMBF5103, and all the alternatives looked worse.  So I guess sanity
has to prevail, and I should use an opamp rather than a discrete JFET
input stage.

I looked at the J201 - which I have tested and works, but has a
potentially very low V_{GSOFF} that will cause clipping.  And the
MMBFJ309L looked good in simulation and had better parameter values, but
I've never tested it, so it seemed a bit risky particularly since the
intended market seems to be for much higher frequency circuits.

I even looked at the JFE150, which is another silly-expensive thing sold
to audio markets.  I guess that tracks.

In the end, a plain simple opamp is definitely the sane choice.

To rebias the incoming signal, this uses the MICBIAS from the TAC5112,
which is typically 2.75V (but can be programmed to 2.5V or turned off
entirely etc).  It's there, it's almost what it is meant for, so let's
use it.

The OPA365 looks fine, and does rail-to-rail input and output and can do
single supplies down to 2.2V, but rather than put even more on the 3.3V
rail (and limiting the voltage swing), this just uses the 5V USB VBUS
power supply.

This does have some minimal caps for filtering (replacing the old +VA
supply to the JFET) but the OPA365 also claims good PSRR.

This all does seem like the right thing to do, but I'm still a bit sad
since the discrete JFET was just more interesting.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
... for the most ridiculous of reasons: it frees up some board space
without altering the physical layout of knobs.

I can't replace all the pots with the basic ones, because the pots
themselves are physically bigger and won't fit, but this odd mix of
potentiometer types works, even if it's all kinds of odd.

Does this board need to be this form factor? No.  I could just move
things around.  But I like the size, I like the bigger 20mm diameter
knobs I'm planning on using, and I'm just doing this ridiculous thing
for fun in the first place, so having a fun form factor is part of it
all.

The ridiculous reason for having four knobs in the first place? That's
how many ADCs the RP2354A has. So this is all very random.

Next up: do a 4-layer stackup and actually start laying things out.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This is an insane 6-layer stackup, not because I need six layers
(although it does allow me to be even lazier than usual), but because I
want to use via-in-pad and at that point jlcpcb pretty much ends up
doing the whole precision 6-layer thing anyway.

The minimal RP2354A board makes do with just a simple two-layer stackup,
and I'm sure this could have been done that way too.  But with four
layers it's easy to just use one layer for the +1V1 zone and one for the
+3V3 zone under the RP2354A, and just bring things in with the vias.

This is all connected, but with some ERC noise. Mostly harmless (tm).

Also add JLCPCB part numbers to things, although I need to check them
all several times.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Also cross-verify the JLCPCB numbers.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
That's apparently the standard way for the 'JLCPCB Fabrication Toolkit'
scripting.  At least for the first time, I want to cross-check with the
scripting, even if I might not necessarily use it as-is.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
The clean boost with some clipping was very boring, both from a sound
and a circuit standpoint.

This one isn't any better from a sound standpoint, but at least it's a
bit more interesting.  Instead of a boost pot and clipping diodes, this
has a pot that affects the biasing of the input JFET, and a fixed 10x
voltage boost with a final volume pot.

End result: it also clips, but the clipping is based on how badly the
input transistor is biased, so now you have a bit more control over the
result.

Useful? No.  But I'm back to using discrete components, because the
whole op-amp thing was just too boring.  If I want to use pre-made
circuits, I can do that on the MCU board, let's keep the analog boards
discrete.

That said, I've made the resistors and capacitors small, because I'll
just use this one for the JLCPCB assembly testing.  I did send off a
copy of the MCU board too, which is probably completely stupid - the
first PCBA board I do shouldn't have been that complex.  But maybe it
works (after I figure out the programming - even if the board is fine,
I'll have to do the SW side too to even test it).

Anyway, this one I can have assembled - and test - without then having
to write any code for various i2s things that I have no idea about.

Oh, and I still call this a "1590LB" boost board, even though I actually
ended up deciding that I'll just 3D-print the enclosure.  So it's not
really a 1590LB, it's a 45x50mm board that I'll just print a custom
enclosure for.  I actually really liked how one of my test enclosures
ended up looking, and not being limited to standard aluminum boxes is
liberating.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
The PMV250 PNP high-side MOSFET is now a AO3401A, and the BC847C is now
a BC849C instead.  Because those were what I went with at JLCPCB.

It's kind of stupid to have this assembled by machine, since it would be
easy to do by hand (admittedly with slightly different size choices),
and this is not a particularly good design for JLCPCB anyway since all
those matched dual transistors are extended parts etc.

But the point was mainly to do PCBA with a simple board so that I can
actually verify that I did it right.  When the RP2354A comes back, it
will take some coding to get it to do anything at all, so if I screwed
up the hw, it's not going to be as obvious (unless I did it really badly
and the magic smoke escapes).

With this, it's going to be pretty obvious when it doesn't work that my
hw design is just wrong.  Or maybe it works fine - it _should_.  I've
successfully tested a very similar basic circuit, but this does have a
different JFET and some other changes.

Anyway, it's sent off.  When I get back home from travels, I should have
something to test.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
The boost board is back, and "works" for some definition of working.

And by that I mean that it is a bit too clean even when actively trying
to mis-bias the signal: I can definitely see it clipping on the
oscilloscope, but it doesn't really change the horrible noises I make on
the guitar very noiticeably.  Except when I crank up the volume, at
which point it makes the horrible noises much much louder.

So it very much works as a boost, and the signal seems to be quite
clean.  I can easily see a 2mV PtP signal on the oscilloscope.  It's all
just _too_ clean to be interesting, despite me trying to mess up that
biasing.

But hey, I printed an enclosure for it.  And it looks very festive with
a green LED and knobs, with the enclosure done in red PLA.  Very
Christmas - this is the sound equivalent of a "ugly xmas sweater" thing.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
The rp2354a board is back too, and I soldered the pots and other
through-hole hardware up.  And at least some of it works.

This is literally just a silly 'blink' program that tests all the
potentiometers and the stomp switch, and blinks the activity LED in a
pattern based on them.

That verifies that the board seems to work, although the most important
part - the TAC5112 CODEC and the analog side - is entirely untested and
may be completely broken.  We'll see.

But hey - it does show that my RP2354A itself is alive.  The USB
connector works, the power supplies - both 3.3V and 1.1V - work, and the
12MHz crystal works.

Admittedly that was all just per the minimal board schematic, so it
*should* all have worked and I shouldn't be surprised, but the fact that
it all came alive on the first try is still very heartening.

And the stomp switch acts as a BOOTSEL switch, so programming this thing
is as simple as holding down the stomp switch when plugging in the USB C
connector.  I have a TagConnect SWD setup, but if I never need to use it
I'll be perfectly happy.

Let's see if I can get the TAC5112 to work too.  The initial goal is to
just set up enough of it with i2c that it goes into passthrough mode.

Doing the DMA for the actual I2S data stream is going to be a much more
complicated thing, involving actually learnign how not just the codec
works, but the rp2354 GPIO and DMA engines too.

Baby steps.  But at least the basic rp2354 itself is working.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This blinks the LED with PWM, and deals with the stomp switch using
interrupts and the watchdog timer.

That allows us to do debouncing on the stomp switch logic, and also have
a "long-press" mode using the watchdog timeout for some future thing.

But more importantly for right now, a really long press will cause the
watchdog to fire, reboot the rp2354, and - since we're holding down the
stomp switch - it will go into programming mode.

End result: you don't have to disconnect the USB cable, you can just
hold the stomp switch for 5s to reprogram.  I didn't want to add a reset
switch for the board, although the TagConnect SWD setup does have that
capability.

This also does a dummy i2c read from the TAC5112, so now that is
"tested" too.  The TAC5112 is indeed at least somewhat alive and i2c
works too, although I haven't actually made it do anything real yet.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
.. make it come up with the LED enabled, and shorten the reboot watchdog
to just two seconds to make the programming iteration quicker.

Also start trying to program the TAC5112 for pass-through mode.  The
keyword here is "trying".  It's not doing anything at all yet.

I'm probably not setting up the right registers, but it's also rather
possible (nay - likely) that it needs some clocking (with BCLK/FSYNC)
even for the passthrough mode.  Which would mean that I need to get some
initial rp2354a PIO programming for that whole i2s side started.

I was admittedly hoping to start seeing some TAC5112 life - more than
just it being active on the i2c bus - before getting to that.  Of
course, I may also have just messed something up on the analog side,
simple though it is.

"If wishes were horses.." and all that. I'll continue to look into this.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
.. not that it makes any difference in behavior.  I'm pretty sure that
even in analog bypass mode it's all clocked by the signals that I
haven't set up yet.

I should probably set up a 12MHz BCLK and run FSYNC at a 1/256 fraction
of that, and even without actually doing anything actual data transfers
on DIN/DOUT it should just all work.

I think the TAC5112 could just generate the FSYNC itself, and all we
really need is BCLK, but I think we're better off just doing everything
on the rp2354 and relying on the automatic clocking mechanism of the
TAC5112.

I now need to start reading up on the RP2354 PIO details, I guess.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
It's supposed to be a 1.536MHz square wave on pin 8 (BCLK).

It's close enough.

Except for actual i2s I'll need to do FSYNC even with my mono signal,
which means that I'll presumably will need to make the frequency be
3.072MHz: 64 * 48kHz.

But this was my "let's show some life on that pin" work.  I'll have to
think about how I actually want to do that whole FSYNC generation (and
eventually DIN/DOUT too, of course).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This actually seems to work: BCLK is done with a 'side-set' pin on each
instruction, while FSYNC is done with a 'set' and a loop.

I'm sure there are smarter ways to do this, but my oscilloscope actually
says that I get the right 48kHz FSYNC square wave, and BCLK at 64 times
that (3.072MHz). Ergo: the two clock pins wiggle at the expected proper
frequencies.

I was hoping that the TAC5112 would then autoclock and start doing the
analog passthrough, but that was not to be. So I'm clearly missing
something very important.

Still, it's cool to see the clock signals.

One thing I might have missed is that I2S seems to needs some slop and
idle BCLK cycles, because of how FSYNC works. I've changed the TAC5112
programming to expect 24-bit data (plenty, plenty), or I could have
perhaps decided to use TDM mode instead that has a saner FSYNC model.

But my oscilloscope probes have in the meantime also messed up the
closely spaced BCLK and FSYNC pads, so now they are connected, signal
integrity is gone and that board is toast.

So while I saw nice FSYNC/BCLK signals for a while, now they are all
mixed up and I can't actually test whether that 24-bit mode might help.

There's a reason competent people put explicit test-points on their
boards. I stupidly thought I could just probe the pins directly. And
admittedly that did indeed work for a while.

I've got a few other boards, but I haven't populated them with the TH
components yet, so this is it for now. I guess I should do a board spin
so that I'll have new boards back by the time I've messed up everything,
but I was hoping to get further in debugging and finding readl design
problems with the boards.

So far, the only problems I've had have been ignorance and me having to
figure out how all this works. And that lack of test points. But I'm
sure some actual board design problem is lurking, and I was hoping to do
a board rev only once I'd actually found something worth fixing.

Oh well. I'm still feeling fairly good about PIO actually doing
something for me now.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Note that the DIN/DOUT naming is from the standpoint of the TAC5112, so
DIN is input to the codec, and is thus an output for the RP2354.

I fixed my board damage with a soldering iron, so I can look at the
signals again, and it all looks very reasonable.

This feeds just silly pattern data to the PIO engine for the codec
input, since I'm just looking at oscilloscope traces.  And since I
haven't read up on how the DMA engines work yet, it does so manually
with the ARM core just writing to the PIO FIFO.

Also, I realized how stupid I was to do the FSYNC bit manually with
'set' instructions, when it's all entirely static.  Just use 'sideset'
for FSYNC too - exactly like the BCLK output does - which avoids using
any actual instructions for the clocking.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Since I now have data input for the DAC, let's change the output source
to be that DAC data.

And what do you know - it works.

I made the test data be a 480Hz sine-wave (100 samples), with POT1
controlling the volume.  Full volume is supposed to be 1V rms - 2.83V
PtP.

According to the oscilloscope I'm actually getting 2.86V PtP output (and
it's really a bit more, the pot multiplier doesn't go to 1), but it does
otherwise look exactly as expected: a proper sine wave with the right
frequency.

The discrepancy is probably just that there's a slight headroom on the
output.

This is all very good.  It is the first actual sign of life from the
TAC5112 outside of responding to the i2c bus, and it means that my i2s
PIO thing is actually working, and apparently I got the bit clocking
right too.

Now, I don't know why the analog bypass didn't work, so it's entirely
possible that I've screwed up the input side to the TAC5112 somehow.

But at least the output side is clearly working, even if it's not
actually useful in this form except as a particularly stupid and limited
signal generator.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
It turns out that i2s worked fine at the full 32 bits data width, but
since 24 bits is more than enough for this thing, let's reduce the BCLK
frequency down instead of widening the bit width of the data.

The sample rate remains the same 48kHz, but at least the PIO engine can
run at a lower frequency (that might reduce clock jitter too: the PIO
frequency is all based on the 150MHz sysclk, and while the clock divisor
has a fractional part, the result is still presumably quantized).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This works to copy the incoming signal to the outgoing side (scaled by
the POT1) although without DMA the software busy loop is just horribly
hacky and the CPU is 100% busy.

But importantly, it means that the input side of the TAC5112 does
actually work.

With this code, the latency seems to be about 800uS, fwiw.  Which sounds
a bit odd, the FIFOs involved on the RP2354 aren't that deep (it
translates to a delay of about 42 samples at 48kHz).  But there are
presumably buffers on the TAC5112 for all the digital processing it does
that I haven't read up on, so ...

Is the result a super-clean signal? No.  I see a fair amount of HF noise
on the oscilloscope, but this "digital passthrough" seems pretty quiet
and accurate with an actual guitar and amp.

The bass response seems fairly bad: looking at the oscilloscope I'd
estimate the -3dB point at around 30Hz.  Which is obviously fine for
guitar, but not if you were to use this for bass.  Again, this might be
partly a TAC5112 programming issue, but I think it's likely at least
partly my AC coupling capacitors.

Increasing the input impedance on the TAC5112 may or may not matter.

Anyway, those are pretty minor details compared to the "input side is
alive and well".  I still think I should figure out why I didn't get the
analog passthrough mode working - it would be good to use that for the
stomp switch - and obviously I need to do DMA and actually make up some
random effect too.

But it now works as a bad guitar pedal with POT1 as an attenuating
volume control.

And "bad pedal" is par for the course for me, so it's unlikely to get
better.  Just hopefully it will eventually get _different_.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
The reason - after reading the datasheet - seems to be that IN1 <-> OUT1
ends up switching polarities when bypassed.  So IN1P is bypassed to
OUT1M, and IN1M is bypassed to OUT1P.

It appears impossible to just bypass IN1P to OUT1P, which was my naive
expectation.

I'm stumped as to why it was done that way, but it really seems to be
the case (that odd cross-bypass also shows up in Figure 7-1: "Functional
Block Diagram").

And it certainly explains why I get only silence when trying the analog
bypass: there's no signal on IN1M.

There's probably a good reason.  Probably.  Maybe there's some trick
people do with it.  And I guess I could have worked around it all by
just using IN1M as the input.  Or even just tying IN1P and IN1M together
(but I expect that would reduce the inpuit impedance further).

I can rework one board to try that "tie IN1M/IN1P together" thing just
to check that out (just a solder bridge between pads next to each
other), but for now I'm just adding a note about this oddity.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This is likely not what a flanger should sound like, but it certainly
does *something*.  It is very loosely based on looking at what the Daisy
Seed flanger code does, but simplified and without the C++ horrors.

In other words: it's definitely more interesting than the plain volume
control I used to have, but I'm not sure it is a flanger.

And I really should do the whole DMA thing, but I got distracted by
trying to make some half-way interesting effect sound instead.  So it's
still all busy-looping.

This is also when I notice that four knobs are a bit limiting.  I'd like
to also change the LFO frequency, but right now the knobs are volume,
delay, depth and feedback respectively.

The LFO is also kind of simplistic.  It's a triangle wave, but I wonder
if it should be a sine-wave.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Not only couldn't it be modified, it was set way too high at roughly 16
samples.  It gets much more interesting at lower frequencies, but that
also requires a much bigger delay buffer.

So get rid of the volume adjustment, and replace it with a LFO frequency
knob for roughly 0 ..  10 Hz (although anything below 1Hz ends up being
limited by our delay buffer: the RP2354 only has 520kB of RAM, so I'm
using 256kB for a ~1.3s buffer, so about 0.75Hz).

This makes things sound much better.  I think this may be what a flanger
is supposed to sound like, but what do I know? I'm just making random
feedback sounds.

Also add a random smooth limiter to the feedback so that you don't get
overflows and nasty crackle when there's too much feedback.

This is all completely made up.  And I wish I had a 'wet-vs-dry' mixer
setting too, but I just don't have the knobs for it.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Silly cut-and-paste error where the fractional part of the interpolating
array read was done as an integer, which obviously defeated the whole
point of that code.  I think that error was even audible, but maybe
that's just my imagination.

Also, while looking at the generated code to make sure it's not doing
something stupid, I noticed that it's indeed doing something stupid: all
the constants end up forcing double arithmetic, which was against the
whole point.

Now, I could do the mindless thing and write everything as explicit
single-precision (eg "3.14f") but let's just make the compiler do it for
us, and warn if some double aritmetic happens unintentionally.  Because
there is not a reason in the world to ever do doubles here.

That does then cause warnings about the pico-sdk code itself doing that
(probably not intentionally, but I didn't check).  But that warning only
happens when rebuilding the sdk itself.  So it's a slight annoyance, but
only an occasional one.

This makes the generated code look a whole lot saner.

Of course, I'm pretty sure my actual math for the delay is still
entirely broken, even if the effect doesn't sound bad.  And I still want
to make a better LFO, maybe with an option to choose triangle vs sine vs
whatever.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This does a nice sinusoidal LFO, which makes the flanger sound nicer,
imho.

Of course, it might be partially also due to some improved delay math
related to the use of said LFO.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
... rather than when the stomp-switch is eventually released.

This is just prep-work for making the long-press change the effect, so
that you actually get feedback of when the long press has taken, rather
than have to just "feel" it.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This allows switching between effects with a 1s long-press of the stomp
switch.

To demonstrate, this adds a echo/delay effect (and a quick beep effect
when switching effects).  It's a hacky echo/delay just to demonstrate
the multi-effect thing, but it kind of works.

I really need to more cleanly separate out the delay-line code, right
now it's unnecessarily tied to the flanger code.  And while I did
abstract out the LFO code, I think I need to improve on that abstraction
too so that you can have multiple active LFO's going (and maybe even
chain them into a frequency modulation thing).

That cleanup is a separate thing, but the multi-effect code really makes
it obvious that some of the infrastructure is a bit lacking.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
In order to be able to have multiple independent LFO's, we want to have
a notion of LFO state.  That cleans up the code too.

And to give an example of that, this adds a silly "frequency modulated
signal generator" effect, which ignores the input and just generates a
frequency-modulated signal using two independent LFOs.

I'll clean up the delay line handling next, I think.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Not only should it limit the mid frequency to 10kHz (so that we get a
reasonable modulation range from 20Hz..20kHz), but it should use a
proper exponential for the potentiometer reading.

That makes the pot midpoint be roughly 220Hz, and the exponential is the
right function from a UI standpoint: moving the pot equal steps will
change the frequency with equal fractions - which is basically how
humans percieve sound.

Also change the modulation itself to be done as a fraction of the
frequency rather than linearly, for the same reason.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
There's little reason to care about "standard" audio rates since none of
that is visible externally, and the TAC5112 PLLs will lock to whatever
i2s frequencies we use (at least as long as they are in any reasonable
range).

So go for a nice round 5MHz PIO clock instead, which gives an integral
PIO frequency divisor from the 150MHz standard system clock.  That then
results in a 52.08333kHz sample rate.  Which may be an unusual sample
rate but absolutely nothing in our code cares outside of the LFO and
delay conversions.  It's just a number.

We could also tweak the rp2354 system clock if we cared and needed more
CPU headroom, since people apparently overclock it easily.  But no need
for any of the silly effects I've done so far.

[ Note for later, since I looked into it: use the 'vcocalc.py' script
  from the pico-sdk to generate the PLL programming settings for the
  rp2354, eg:

	pico-sdk$ ./src/rp2_common/hardware_clocks/scripts/vcocalc.py 180 --cmake

  resulting in

	Requested: 180.0 MHz
	Achieved:  180.0 MHz
	REFDIV:    1
	FBDIV:     120 (VCO = 1440.0 MHz)
	PD1:       4
	PD2:       2

	target_compile_definitions(<program> PRIVATE
		PLL_SYS_REFDIV=1
		PLL_SYS_VCO_FREQ_HZ=1440000000
		PLL_SYS_POSTDIV1=4
		PLL_SYS_POSTDIV2=2
		SYS_CLK_HZ=180000000
	)

  giving the CMakeLists.txt setup for a slight 180MHz overlock. Then you
  obviously need to also change the PIO dividers etc. ]

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
.. because it really is entirely generic, and already used by the
'delay/echo' effect too.  Rename things to be a bit clearer, and also
fix the delay feedback which ended up having been entirely broken at
some point.

I'll split out the delay code into its own file too, and probably make
all the simple effects be just header files included by the core code.

There really isn't much to these basic effects, and having both a C
source file and a header to expose the interface almost doubles the code
footprint once all the generic helpers have been split out.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Put these into headers of their own, just to keep things clearly
separate.  I'll put some more of the generic effect helpers into the
core C file, but I wanted to clean these things up first.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This just makes the effects be small header files of their own, which
just makes it really obvious how simple the actual algorithms are.

Maybe I'll do a more complex effect at some point that will merit having
a separate header file and C implementation file, but for now I think
it's clearer to do them this way.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This is just doing a silly deep 330Hz notch filter on the input, just to
see the biquad filters work.  That notch filter is not useful in itself,
but you can see the signal disappear when you set the signal generator
to 330Hz, so it's a good way to verify the filter works.

Note that because the filter is done by the TAC5112 hardware, it's
active even when the pedal is "disabled" and we're just passing the raw
i2s data through.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Also enable three filters on both the ADC and DAC side, so that for
testing we can have the 330Hz notch filter enabled at the same time as a
220Hz high-pass filter, and a 1kHz low-pass filter.

Useful? No. But very visible on my signal generator / oscilloscope.

I guess I should test the ouput side biquad filters too, and maybe
attempt to make a phaser using purely the builtin TAC5112 filters.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
.. and put one peaking bandpass at 400Hz on the output, just to test
that the output filters are also active.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Yes, the TAC5112 does that biquad in hardware, but let's add a software
version of it too, because the hardware only does it on input and
output, and some effects will want to do it as part of the effect
itself.

(And I haven't gotten to the hardware mixing yet, so any time you want
to mix the result of a filter, you'll have to use this sw version).

And it's actually nice to have the flexibility, and use the same
"calculate biquad coefficients" code and verify it with the software
implementation too.

So this adds the same truly stupid "notch" effect that just does the
same digital 330Hz notch filter we tried in hardware, except as a silly
effect.  For exactly the same testing reason.

And now the stomp switch actually turns off the effect (when the crappy
sw debounce logic works - I really need to spend more effort on that
garbage).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
We can calculate sine and cosine at the same time using the same table
that we already have for the LFO, so let's just do that.  It's literally
just a couple of multiplications and float to integer conversions, and
if we start doing dynamic biquad filters (hint: we will), the latencies
involved in recomputing the coefficients may matter.

This does expand the lookup table from 64 entries to 256 entries,
because that improves precision from roughly 3.3 digits to 4.5 digits,
and while it's unlikely to matter hugely for audio, it does end up being
noticeable in the filters when you have known frequencies.

Even with this, the test filter - a notch filter at 330Hz - seems to
really be a notch around 327.2Hz (less than a percent off, but still
noticeable).  With a proper sin() implementation, it actually hits 330Hz
as near as I can tell on the oscilloscope.

From a quick test, using a 12-bit lookup table (4096 entries) would give
me 6.8 digits of precision and be indistinguishable from the real thing
on that fairly simple test, but I don't think we care enough.

We do have plenty of flash, so a bigger precomputed table wouldn't be a
problem, but let's wait for something that actually cares.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Everything currently uses just sine wave oscillators, and it just
generates better code to have that lfo type be hardcoded by the caller
when inlining.  It annoyed me seeing the dead conditionals in the
generated code.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This avoids a few divides by turning them into multiplies with the
inverse, and perhaps more importantly also separates out the biquad
state from the coefficients so that you can re-use the same coefficients
for multiple different streams.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
The notch effect was good for initial testing of the biquad code, but
not very interesting.

Replace it with a more interesting test-case: a phaser.

The phaser settings are a bit random, but do something half-way
phaser-like.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This tries to pitch shift things by walking the delay line at different
speeds, and hiding the discontinuity when jumping back by multiplying
with a smooth function that goes to zero at the discontinuity.

And we've already got such functions: sin/cos.

It's not a great effect, because while it does avoid any horribly
obvious discontinuities, you do get a rather noticeable beating effect
from the walking speed.

Maybe fractional steps would make it less noticeable.  Or just adding
some noise to the delay.  I'm not sure it's salvageable, but I'll think
about it.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
The keyword is "slightly".  Improving the pow() function improves on the
semitone frequencies, and avoiding delay games avoids some crackling.

It's still not great.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This just does fourths, fifths and octaves up and down.  Less jangly
that way, but it's still not a great sound.  But good enough as an
example.

I think I'll archive the project at this point, it's gone about as far
as I wanted it to go in this form.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This design review can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this design review.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin archived:archived
git checkout archived
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ivanxblue/ivan-torvalds-GuitarPedal#1
No description provided.