News:

SMF for DIYStompboxes.com!

Main Menu

Multi Effects Pedal

Started by MstrKurt, November 20, 2013, 11:35:51 PM

Previous topic - Next topic

MstrKurt

Hey Digital Larry,
thanks for the input, I will look in to this when I'm back in the lab tomorrow :).

I managed to get a cleanish signal through the PIC today but with what sounded like slight distortion. Will see if the problem persists when I clean up the breadboard (shorten wires etc).

I also noticed the DAC has a + and - Would I need to merge the two channels so the full wave arrives at the output?.

MstrKurt

#41
I'm still getting a rather distorted signal from the DAC after adding an op amp, and biasing.

The 2 DAC outputs +/- are confusing. The + pin has the positive half cycle, but no negative half and clips at around -100mv and vice verse for the -

Perhaps the DAC isn't sampling at it's maximum rate?.

EDIT: Digital Larry, what did you mean by a non inverting stage? Isn't the op amp I'm using already in Non Inverting mode?

EDIT 2: Here's an updated Circuit Diagram


ALSO: I think I'm getting attenuation after the differential amplifier somehow, shouldn't the gain be 1 since all resistor values are identical = no change to the signal in terms of amplitude?

Digital Larry

Ah, yes you're correct, you ARE already using a non inverting stage.  Sorry, sometimes I look at these things really quickly and pop off with some half baked response.  So in that case I'd suggest 2.2M resistors in place of the 100ks to give you the Vcc/2 bias voltage, as 2 of these in parallel would be just over 1 Meg which is usually OK for pickup loading.
Digital Larry
Want to quickly design your own effects patches for the Spin FV-1 DSP chip?
https://github.com/HolyCityAudio/SpinCAD-Designer

MstrKurt

Ok, thanks for the input Digital Larry.

While browsing over this circuit, I may have stumbled on to why I'm only getting a positive half cycle of the wave out of the DAC. I've put a Capacitor before the ADC (Labelled on the circuit as C6). Wouldn't this remove the DC biasing done beforehand?.

Also can anyone explain to my why the DAC has 2 outputs a + and a -?. I'm not able to find a good explanation of why this is there.

Digital Larry

#44
You're correct that the cap removes the DC bias and since the PIC only has a single supply, it will (probably) clip any signal going below zero.

I only say "probably" because I didn't read all 88 pages of the ADC application note, and I've never used the PIC, but it seems a reasonable place to start (biasing the input).  

http://ww1.microchip.com/downloads/en/DeviceDoc/70183D.pdf

Regarding the DAC differential output, check figure 33-5 in this document:  http://ww1.microchip.com/downloads/en/DeviceDoc/70211B.pdf

Normally that would be done to reduce common mode noise getting into the buffered DAC output (post op-amp).


Digital Larry
Want to quickly design your own effects patches for the Spin FV-1 DSP chip?
https://github.com/HolyCityAudio/SpinCAD-Designer

slacker

#45
Yes the cap C6 removes the DC biasing, you can't just remove it though. Your opamp is running on 5 Volts with the signal biased to the mid point by R3 and R4, so the signal is biased around 2.5 Volts. The PIC needs the signal to be biased around half its supply which is 3.3/2 = 1.65 Volts, if you add the thing I drew earlier between the output of the opamp and the analogue input on the PIC it will bias the signal correctly.

EDIT: posted the same time as DL.

Your output stage is wrong as well, the bottom of R10 should go to half the PIC's supply Voltage not ground. See the appnote Larry posted.

MstrKurt

Thanks once again to both of you for your input, I will look to see if I can finally get a clean signal through on Tuesday when I get access to the lab.

Does anyone know if those pocket oscilloscopes are good enough to monitor wave forms for these type of projects?

And would anyone know for a relatively cheap variable DC PSU with a built in function generator?.

Thanks!.

MstrKurt

Clean signal achieved :)

I biased the input correctly and removed the Diff Amp for the time being and it sounds great so far. I also managed to get distortion working by using a clipping point which doesn't sound all that bad!.

I'm working on getting delay working now by using the delay line Pottul provided but I'm struggling.

slacker

Excellent glad to see you're making progress.

MstrKurt

Would anyone know how I can make a simple delay line that gives the longest amount of delay possible for a dsPIC33FJ128GP802's internal RAM

slacker

#50
Try this, there's probably better ways to do it but this works. I've tried this on a dspic33FJ64GP202 which is similar to what you're using and this is the longest delay I can make using this method, you've got twice as much RAM so you might be able to increase the length. How much delay this gives you depends on your sample rate, I'm running at 32KHz so it gives me about 90ms. This is a  circular buffer with a counter that steps through the stages writing a new sample in and reading one out, hopefully the code is pretty self explanatory.

Stick all this in your ISR or whatever you're using to run the ADC or DAC. You may need to make a few changes to make it fit what you're doing.


#define length 3000 //length of delay in samples
static unsigned int writeaddress = 0; //address to write sample to
static unsigned int readaddress; //address to read sample from
static signed int delayline[length]; //set up an array of signed ints of "length" number of samples

writeaddress++;
if(writeaddress == length)
writeaddress = 0;

readaddress = writeaddress + 1;
if(readaddress == length)
readaddress = 0;

delayline[writeaddress] = sample_in; //sample could be the output from the ADC
sample_out = delayline[readaddress]; //sampleout could go to the DAC

MstrKurt

#51
Thank you very much, Slacker!.

Based on initial code, I think it's working however it's difficult to hear the short delay. I have tried increasing the length from 3000 to 6000 but I get this error:

build/default/production/Main.o: Link Error: Could not allocate section .nbss, size = 12008 bytes, attributes = bss near
Link Error: Could not allocate data memory

But isn't that saying 12008 bytes are required, when I have 16384 bytes of RAM?.

EDIT: Nevermind, I fixed it by changing the memory model to "Large data".

slacker

Quote from: MstrKurt on January 17, 2014, 07:11:39 AM
EDIT: Nevermind, I fixed it by changing the memory model to "Large data".

Interesting, how do you do that?

MstrKurt

Sorry I'm late replying,

Right click the project name>properties>C30 (Global Options)>pic30-gcc>set option categories to Memory Model>Change Data model to Large data model.

slacker

Thanks for that, how much extra memory did it allow you to use?

MstrKurt


ElectricDruid

You should check out Seb Francis 4xD stuff if you're doing FX on a dsPIC. It's great work. A bit more sophisticated, but it shows what can be done with these chips. He used an external codec like you discussed initially.

http://burnit.co.uk/sdiy/index.php?page=4xd

I've used the dsPIC '802 a lot myself, but pretty much always in assembler. There's some nice DSP features (DMA, hardware circular buffers) available which really save a lot of processor time, but I'm afraid I'd have no idea how you'd implement them from C.

Good luck anyway, it looks like a cool project.

Tom

MstrKurt

Hi again guys, I've recently bought a 23LC1024 1Mbit RAM chip that interfaces with the dsPIC through SPI.

Have any of you any experience on getting these things to work together?.

slacker

I'm playing with the same thing at the minute and the smaller 23k256.
Pretty easy to get working, the datasheet gives good explanations of what to do.
Let me know if you need any pointers, happy to share my code if needed.

MstrKurt

Thanks Slacker, I will give it a try according to the datasheets soon and see if I hit a wall.

I was told today that the sample time that is able to be achieved by 16k of RAM can be increased by lowering the resolution of my ADC or lowering the sample rate?. Is there any truth to this?.