Spark Logic

$10 O-Scope revisited

ahull

Over the last few days I’ve been playing with Ray’s STM32 Oscilloscope idea.

Image

Some preliminary results are available here..

https://github.com/pingumacpenguin/STM3 … ontruction

My take on the Scope Sketch is here..

https://github.com/pingumacpenguin/STM32-O-Scope

Its a fun little project and well worth building just for the entertainment value. Currently bandwidth is a little limited, but with a little extra effort it would be possible to make a fully functional 2MHz Scope for next to nothing. Ideal for probing i2c, audio and other low speed signals.

EDIT: We managed to squeeze the maximum speed out of the ADC, read further through the thread for details. The github code includes all of the enhancements made of the course of this thread.

Replies20

RogerClark Fri Apr 08, 2016 10:47 am

You can change the main clock PLL multiplier quite easily, but the USB will stop working

If you look in boards_setup.cpp

e.g.

https://github.com/rogerclarkmelbourne/ … _setup.cpp

and change

#define BOARD_RCC_PLLMUL RCC_PLLMUL_9

to some other number

typedef enum rcc_pll_multiplier {
RCC_PLLMUL_2 = (0x0 << 18),
RCC_PLLMUL_3 = (0x1 << 18),
RCC_PLLMUL_4 = (0x2 << 18),
RCC_PLLMUL_5 = (0x3 << 18),
RCC_PLLMUL_6 = (0x4 << 18),
RCC_PLLMUL_7 = (0x5 << 18),
RCC_PLLMUL_8 = (0x6 << 18),
RCC_PLLMUL_9 = (0x7 << 18),
RCC_PLLMUL_10 = (0x8 << 18),
RCC_PLLMUL_11 = (0x9 << 18),
RCC_PLLMUL_12 = (0xA << 18),
RCC_PLLMUL_13 = (0xB << 18),
RCC_PLLMUL_14 = (0xC << 18),
RCC_PLLMUL_15 = (0xD << 18),
RCC_PLLMUL_16 = (0xE << 18),
} rcc_pll_multiplier;

rexnanet Mon Apr 11, 2016 9:13 am

Ok, thanks! I found it.

Now I need to make some tests :)

Mine also has an 8Mhz crystal. So no issues here.

As for the USB, I know it won’t work but if I add some buttons to change the setting there’s no need for the USB serial command interface :)

The F4 series have more options for the USB divider so they are more “overclock friendly” :) I’ve seen STM32F429 (@180Mhz default) overclocked to 250Mhz without problems.
I’m starting to design a board to get a F429 or a F746 working with some external RAM, an LCD and an external ADC. But time doesn’t stretch… :)

rexnanet Mon Apr 11, 2016 9:43 pm

IT WORKS!!! :lol:

SPI speed is insane!!! I have videos to prove it lol From my calculations it’s probably 64Mhz!

Refresh rate is faster and it’s more responsive. It almost looks like a +$10 scope :lol: :lol: :lol:

ADC speed is maintained so still ~1.7MSPS.

Also ran the graphics test demo, it flies through the steps :lol: COOL :)

Tomorrow I’ll post the videos (still have to upload to youtube).

RogerClark Mon Apr 11, 2016 10:49 pm

Cool

ahull Tue Apr 12, 2016 12:00 am

rexnanet wrote:IT WORKS!!! :lol:

SPI speed is insane!!! I have videos to prove it lol From my calculations it’s probably 64Mhz!

Refresh rate is faster and it’s more responsive. It almost looks like a +$10 scope :lol: :lol: :lol:

ADC speed is maintained so still ~1.7MSPS.

Also ran the graphics test demo, it flies through the steps :lol: COOL :)

Tomorrow I’ll post the videos (still have to upload to youtube).

mrburnette Tue Apr 12, 2016 12:20 pm

ahull wrote:
Display.
But I can’t vouch for that display being usable.

rexnanet Tue Apr 12, 2016 2:17 pm

AAAAAAAAAAAAAAAAAAAAAAnd here they are :D

Normal speed :
https://www.youtube.com/watch?v=RQmDzVx8ovQ

Hyper speed: :twisted:
https://www.youtube.com/watch?v=VOxv87-hZt8

On the video it’s not really that noticeable but there are more triggers/second as (should be) seen in the led and the waveform is more “present” on screen, the flicker (caused by the delete than redraw of the waveform) is less noticeable.

These also show the new trigger machine, trigger level working :)

ahull Tue Apr 12, 2016 10:21 pm

Looks pretty slick, :D and the new trigger algorithm is a lot better than the original. What all did you do to get the over-clocking to work?

If I had any spare time at the moment I would love to see if we can periodically over clock till triggered then drop back to standard clock to spit results to USB. I had a crack at this previously with the low power modes, but I failed to engineer a mechanism to keep USB alive with the lower clock speeds. It might be possible to massage USB in to stability with a high clock speed by some clever trickery though.

An alternative would be to add a $2 USB to serial converter on serial1 or whatever, and abandon the on board USB. The ability to send the captured data to a host using some sort of serial transfer seems to me like a “must have” feature.

rexnanet Wed Apr 13, 2016 12:34 pm

ahull wrote:Looks pretty slick, :D and the new trigger algorithm is a lot better than the original. What all did you do to get the over-clocking to work?

If I had any spare time at the moment I would love to see if we can periodically over clock till triggered then drop back to standard clock to spit results to USB. I had a crack at this previously with the low power modes, but I failed to engineer a mechanism to keep USB alive with the lower clock speeds. It might be possible to massage USB in to stability with a high clock speed by some clever trickery though.

An alternative would be to add a $2 USB to serial converter on serial1 or whatever, and abandon the on board USB. The ability to send the captured data to a host using some sort of serial transfer seems to me like a “must have” feature.

ahull Wed Apr 13, 2016 12:47 pm

rexnanet wrote:ahull wrote:Looks pretty slick, :D and the new trigger algorithm is a lot better than the original. What all did you do to get the over-clocking to work?

If I had any spare time at the moment I would love to see if we can periodically over clock till triggered then drop back to standard clock to spit results to USB. I had a crack at this previously with the low power modes, but I failed to engineer a mechanism to keep USB alive with the lower clock speeds. It might be possible to massage USB in to stability with a high clock speed by some clever trickery though.

An alternative would be to add a $2 USB to serial converter on serial1 or whatever, and abandon the on board USB. The ability to send the captured data to a host using some sort of serial transfer seems to me like a “must have” feature.

rexnanet Tue May 10, 2016 12:27 pm

Updates are on the way! :)

Also I’ve found a simple solution for the analog bit: MCP6S92 (Single-Ended, Rail-to-Rail I/O, Low-Gain PGA)
More exactly 4 of them, 2 for each channel and also the ability to redirect either channel for ADC1 to get the ~2MSPS :)
This way we can get multiple gain configuration with few HW parts!
Gain ranges from 1 to 32 V/V (steps: +1, +2, +4, +5, +8, +10, +16 or +32 V/V) so we can get from 1 to 1024 total combined gain :)
Adding a input attenuator of 1:10 and 1MOhm we can get a functional O-scope!

ahull Tue May 10, 2016 4:09 pm

rexnanet wrote:Updates are on the way! :)

Also I’ve found a simple solution for the analog bit: MCP6S92 (Single-Ended, Rail-to-Rail I/O, Low-Gain PGA)
More exactly 4 of them, 2 for each channel and also the ability to redirect either channel for ADC1 to get the ~2MSPS :)
This way we can get multiple gain configuration with few HW parts!
Gain ranges from 1 to 32 V/V (steps: +1, +2, +4, +5, +8, +10, +16 or +32 V/V) so we can get from 1 to 1024 total combined gain :)
Adding a input attenuator of 1:10 and 1MOhm we can get a functional O-scope!

racemaniac Thu Jun 09, 2016 8:19 pm

A bit off topic, but i started off with the code from this project to get started quickly

I read that you can easily change voice pitches without FFT by simply recording sound in a circular buffer, and going across that buffer at a different speed for playback (with optionally some algorithm for smoothing out the wave a bit when the sampling catches you up, or vice versa).
So i took the code from this project, and set up a simple circular DMA to a buffer of 2k 16 bit samples, and slowed it down as much as possible (clock divider 8 for the ADC, 239.5 cycles sampling time), which would bring down the sampling rate to about 35khz, which is perfect for sound XD.
And then attached a DAC to my maple mini, read the buffer at various sampling rates, and it just perfectly changes the pitch of a voice, it’s incredibly simple :)
Had it all working in less than 2 hours of work ^^.

ahull Fri Jun 10, 2016 9:38 am

racemaniac wrote:A bit off topic, but i started off with the code from this project to get started quickly

I read that you can easily change voice pitches without FFT by simply recording sound in a circular buffer, and going across that buffer at a different speed for playback (with optionally some algorithm for smoothing out the wave a bit when the sampling catches you up, or vice versa).
So i took the code from this project, and set up a simple circular DMA to a buffer of 2k 16 bit samples, and slowed it down as much as possible (clock divider 8 for the ADC, 239.5 cycles sampling time), which would bring down the sampling rate to about 35khz, which is perfect for sound XD.
And then attached a DAC to my maple mini, read the buffer at various sampling rates, and it just perfectly changes the pitch of a voice, it’s incredibly simple :)
Had it all working in less than 2 hours of work ^^.

racemaniac Fri Jun 10, 2016 10:37 am

ahull wrote:racemaniac wrote:A bit off topic, but i started off with the code from this project to get started quickly

I read that you can easily change voice pitches without FFT by simply recording sound in a circular buffer, and going across that buffer at a different speed for playback (with optionally some algorithm for smoothing out the wave a bit when the sampling catches you up, or vice versa).
So i took the code from this project, and set up a simple circular DMA to a buffer of 2k 16 bit samples, and slowed it down as much as possible (clock divider 8 for the ADC, 239.5 cycles sampling time), which would bring down the sampling rate to about 35khz, which is perfect for sound XD.
And then attached a DAC to my maple mini, read the buffer at various sampling rates, and it just perfectly changes the pitch of a voice, it’s incredibly simple :)
Had it all working in less than 2 hours of work ^^.

RogerClark Fri Jun 10, 2016 11:25 am

Github is good for shared open source projects

If you want free private git repo’s with imited private sharing, take a look at bitbucket.org

CrtSuznik Thu Oct 20, 2016 4:06 pm

Hey everyone!
I’ve read the first 10 or so pages and am hooked! I HAVE TO make this.
Can anyone provide the final (so far) version of this project?

ahull Thu Oct 20, 2016 9:52 pm

CrtSuznik wrote:Hey everyone!
I’ve read the first 10 or so pages and am hooked! I HAVE TO make this.
Can anyone provide the final (so far) version of this project?

RogerClark Thu Oct 20, 2016 10:43 pm

BTW.

If anyone has any issues running Andy’s code, can you post it here.

Because there was a PR which made some changes to the ADC and DMA callbacks etc about a week ago, which could possibly effect things (if there was a bug)

Post a reply