Advice on building a pedal with STM32F7

Started by ingrown, April 24, 2019, 04:20:38 PM

Previous topic - Next topic

ingrown

Hello Everyone!

I bought an STM32F7 board in an attempt to make a dsp pedal. I'm new to this stuff so forgive my ignorance. Where do I begin?
I've read that the signal should come in to an op-amp first, and that I should account for noise from the power supply.
How come it's a good idea to go in to an op-amp and how do I account for the noise?

Any help is greatly appreciated.

xjordanx

Ahhh won't you be needing an Audio CODEC (AD/DA) as well? Or does the F7 chip you're using have that built in? (I wouldn't trust a built in CODEC to be low noise but it might be okay).

The opamp would just be configured as a buffer and set the input level appropriately to get the best dynamic range (ie. for a full hard strummed guitar input, getting 16-bits of resolution at least or as much as 22).

Input --> Op-Amp --> Codec audio input --> STM32F7 I2s port --> Codec audio out --> Opamp --> output

A good coded I've used before would be Cypress CS4270 or similar.

ingrown

You're right, I forgot to include that. The built in is 12-bit but I'm gonna go for a 24-bit with higher sample rate. Although, I am a bit confused how to connect the input jack to the audio codec. Would I get a mounted mono jack and wire it to one of the codecs pins?

Prehistoricman

#3
The input section does two things: buffer & boost, and filter.

Buffer: the codec will have a certain range of input voltages that it can digitise. You should ideally fill that range with the signal, so some amplification may be good. This also means the signal will leave the pedal hotter so you then need to cut the signal after the digital processor.

Filtering: you need to remove any ultra-sonic or infra-sonic information before the signal goes into the codec. This is basically to stop any bad aliasing effects that occur when sampling below the Nyquist frequency. There's some jargon there but it basically means no filter = bad.

audioartillery

Quote from: ingrown on April 25, 2019, 10:04:16 AMWould I get a mounted mono jack and wire it to one of the codecs pins?

Definitely not.  You need to DC bias it and do some impedance matching. 

I highly recommend you abandon the idea of rolling your own unless you're planning on going into production.  You're far better off using a board with this all figured out for you.  I've been using the BlackAddr board and it's great and easy to get going.  And really not terribly pricy considering what it would cost to roll your own.

Ice-9

Quote from: ingrown on April 25, 2019, 10:04:16 AM
You're right, I forgot to include that. The built in is 12-bit but I'm gonna go for a 24-bit with higher sample rate. Although, I am a bit confused how to connect the input jack to the audio codec. Would I get a mounted mono jack and wire it to one of the codecs pins?

What you will need to do is decide on which audio codec chip you want to use and then download the datasheet for that codec, the datasheet will give you information on how to get an audio signal into it with examples circuits, it will also show you other components needed for the codec to work . ie power wiring etc. Without deciding on which codec chip you are going to use you cannot design the audio input circuit as it may differ depending on the codec type you choose.
www.stanleyfx.co.uk

Sanity: doing the same thing over and over again and expecting the same result. Mick Taylor

Please at least have 1 forum post before sending me a PM demanding something.

ingrown

Quote from: audioartillery on April 25, 2019, 11:09:35 PM
Definitely not.  You need to DC bias it and do some impedance matching. 

I highly recommend you abandon the idea of rolling your own unless you're planning on going into production.

For now, I'm more interested in building it than using it.
Okay it looks like I should do a high pass for DC Bias and an L-section for impedance matching.


Quote from: Prehistoricman on April 25, 2019, 08:16:46 PM
The input section does two things: buffer & boost, and filter.

This also means the signal will leave the pedal hotter so you then need to cut the signal after the digital processor.

Filtering: you need to remove any ultra-sonic or infra-sonic information before the signal goes into the codec.

And a 20khz low pass for the high stuff. Can I use a divider after the processor?


So basically my filtering would be: low pass -> high pass -> L-section
Unless the order matters.

Quote from: Ice-9 on April 26, 2019, 06:00:02 AM
Without deciding on which codec chip you are going to use you cannot design the audio input circuit as it may differ depending on the codec type you choose.

So certain codecs have some of the mentioned functions built in? Is there one in particular that you would recommend?


----

Thank you to everyone. Very helpful.


audioartillery

Quote from: ingrown on April 26, 2019, 12:22:34 PM
For now, I'm more interested in building it than using it.
Okay it looks like I should do a high pass for DC Bias and an L-section for impedance matching.

No, not remove DC bias, add DC bias.  You need to lift the signal to be within range of 0 - Vcc (the codec's operating range).  Otherwise you'll only see the top half of the wave form.

ingrown

#8
Quote from: audioartillery on April 26, 2019, 05:52:09 PM
Quote from: ingrown on April 26, 2019, 12:22:34 PM
For now, I'm more interested in building it than using it.
Okay it looks like I should do a high pass for DC Bias and an L-section for impedance matching.

No, not remove DC bias, add DC bias.  You need to lift the signal to be within range of 0 - Vcc (the codec's operating range).  Otherwise you'll only see the top half of the wave form.

Awesome, I found some examples. There's a few simple circuits that may work, if not there's the push-pull. I see why you recommended the shield. This does seem very tedious and dosn't sound all that cheap. Still, it's very nice to be familiar with it.

So far the steps I have are: Input --> Op-Amp --> add DC Bias -> L-section -> low pass -> ADC-->  I2s port --> DAC--> Opamp --> output


Prehistoricman

What do you mean by L-section?
The input circuit can just be a single opamp in a non-inverting config with a capacitor on the feedback for your low pass. The high pass and DC bias can be added with a capacitor, much like the circuit used in the MXR Micro Amp: http://www.generalguitargadgets.com/pdf/ggg_mamp_sc.pdf

slacker

#10
You don't necessarily need a codec, you can get reasonable results using a microcontroller's built it ADC and DAC if it has one or even use PWM for the audio out. Have a look at Electronic Druid's delay design https://electricdruid.net/diy-digital-delay/ for example. The input section of this would also work well with a codec, maybe with some changes to the filter to increase the cut off frequency.
Here's a very simple codec based design that I've been playing with https://github.com/slackDSP/slackDSP_mini/blob/master/hardware/slackdsp_mini.pdf the dsPIC could be replaced with what ever micro you like.

ingrown

#11
Quote from: Prehistoricman on April 27, 2019, 12:57:59 PM
What do you mean by L-section?
The input circuit can just be a single opamp in a non-inverting config with a capacitor on the feedback for your low pass. The high pass and DC bias can be added with a capacitor, much like the circuit used in the MXR Micro Amp: http://www.generalguitargadgets.com/pdf/ggg_mamp_sc.pdf

Audioartillery said I’ll need to do impedance matching so an L-section is a solution I found on Wikipedia.
Awesome, I found some examples of a capacitor in op-amps feedback. Thats done to make the op-amp more stable by removing high frequencies?
Also, thank you for the MXR example. I see that C1 before the op-amp.


Quote from: slacker on April 28, 2019, 03:35:19 AM
You don't necessarily need a codec, you can get reasonable results using a microcontroller's built it ADC and DAC if it has one or even use PWM for the audio out. Have a look at Electronic Druid's delay design https://electricdruid.net/diy-digital-delay/ for example. The input section of this would also work well with a codec, maybe with some changes to the filter to increase the cut off frequency.
Here's a very simple codec based design that I've been playing with https://github.com/slackDSP/slackDSP_mini/blob/master/hardware/slackdsp_mini.pdf the dsPIC could be replaced with what ever micro you like.

Yeah, probably. Thought I’m more interested in learning “best practices” than getting something immediately working. The more I can learn to make it more efficient, the better. I figured this would be a nice (kinda long term) goal for the rest of the year since I’ve done a few build your own kits and small pedal mods. I would like to know a little more about each parts application by building my own circuit, while crossing over into digital.
Thank you for your example. You seem to be doing a low-pass into a high pass/ dc bias too, right?
Also, if you were to change the filter, what would you do?

Hamuro

If your are focusing on learning, you can start with the build-in ADC, then add the codec later for finer product. You can also increase the 12 bit resolution to 14-bit by oversampling on 8-channel expansion like I've done for my cheap multi-effect platform here: https://www.deepstomp.com/ . I have published the source code for the platform ( https://github.com/hamuro80/deepstomp ) but unfortunately it is done in fix-point math, but by looking at the code I hope you might find an insight on how to modify the code to work on STM32F7