PC USB scope project.

Revisited a dual channel usb scope that ran at 1 million samples/second.
I had a read through the PIC32mx datasheet on the A2D.
It seems you can scan in hardware the A2D ports.
Took a while to figure out all the register settings to get it working.
It scans the A2D inputs sequentially and sets an interrupt flag when finished.
Clearing the interrupt flag starts the next samples.
I can now get 3.2 million samples/second.
 
USB scopes are ok so long as they are fast enough for audio.
At first thoughts up to 100KHz should be fine but if the amp oscillates it could be into MHz. I found on a 100KHz scope the oscillation showed up as mush on the signal, so at least something showed up.
Sampling rates and bandwidth can get a bit confusing.
While you might have a 50MHz sampling scope it is probably only good for 1MHz sine waves. It takes about 50 points to start getting a half decent waveform.
 
Been working on a faster dual channel usb scope.
The AD9281 dual a2d looks good.
I can get up to 13 mega samples/second with it.
At £10+ each they aren't cheap.
Getting tempted with Ali-Express where they are just a couple of pounds.

I found a faster PIC micro the PIC32MX374 which has more memory and runs at 72MHz. This should bring my 13 mega samples up closer to 20.
It is SOIC SMD but the pins aren't too close so should solder ok.
 
Been trying to get to grips with a dual channel A2D converter.
First attempts at capturing data gave a very noisy sine wave on the pc screen.
I was clocking the A2D taking in one channel then clocking it again and taking in second channel.
So I reread the datasheet and they show the one channel being taken in one clock edge and the other channel on the opposite edge. So I converted that into software and it works a treat and is also 50% faster than clocking things twice.
So a good day with some progress.
 
Well what a day.
Took 2 hours to fix a new usb scope.
Just garbage on the pc screen.
First mistake was a missed soldered joint on daughterboard to motherboard connector.
Still not fixed, so I resoldered the A2D as everything else was working.
Still not fixed. But I found putting a little pressure on the a2d changed the fault.
So removed all the solder and resoldered going as carefully as I could making sure all pads were well soldered. This time burst into life.

Next job was trying out a cheap A2D from a cheap Chinese source.
Quite a bit of noise on the pc screen.
Then realised I hadn't grounded the sig gen ground on to the scope ground.
Connected it and that cleaned things up nicely.
 
Been revisiting older scope project which was 8.4 mega sample dual usb scope.
I was clocking data out on both clock edges. channel 1 on +ve edge and channel 2 on -ve edge. This worked ok but a little noise on the pcb screen.
I tried capturing both channels on just +ve edge and that improved noise a bit.
The AD9281 seems to be struggling a bit at higher frequencies despite being in spec.
The next step is to try a faster AD9283 A2D.
 
Got my latest pcb from JLCPCB.
Built it up then powered it up.
First problem was waveform wasn't centered on screen.
The A2D /AIN pin was biased wrongly internally.
A 10k from /AIN to ground fixed this.
I tried clocking A2D clock in code and it sort of worked ok.
Tried clocking A2D clocking using atomic port changes and that was a bit noisy.
Tried clocking A2D using OC1 and that was very noisy.
I eventually found a processor clock speed where it was best but still noisy.
I suddenly twigged the noise was processor clock at 8MHz.
The output of my op amp chain goes too close to clock circuit and picks up clock nicely. So I put a cap across feedback resistor on last op amp and that got rid of most of the noise, but the real fix is moving the op amp away from clock circuit and adding the missing ground planes which I forgot.
With the current micro running at 72MHz internally I can now get 23Mega samples/second.

I use porta 0,1 and 4 for selecting the voltage divider chain.
It turns out in the PIC32mx microchip in their wisdom made porta,4 only an input.
So I had to cut a track and find a spare pin for the same function.
 
Last edited:
Built up latest pcb which is a 23 mega sample USB scope.
I fixed a few problems from last time on this pcb.
Better decoupling close to a2d, ground plane top and bottom of pcb.
Added a trimmer for setting a2d center voltage so trace is in middle of screen.
Both the micro and the a2d are SMD now so great care is taken to solder them by hand.
I added a row of vias next to the processor so I can check for solder bridges between pins more easily. The a2d is on a separate pcb which has edge connectors anyway to check for bridges and connect to mother board.
Powered it up and set trimmers to correct position and I am impressed with pc screen, very little noise on it compared to previous versions. The ground plane and moving the crystal away from the signal got rid of the noise.