Spark Logic

$10 O-Scope revisited

Over the last few days I’ve been playing with Ray’s STM32STM32Микроконтроллеры и процессоры…Map magic glue code, ethernet compiles, just WARNING: library LwIP claims to run on [ stm32 ] architecture(s) and may be incompatible with your current board which runs on [STM32]…[STM32GENERIC] F429i Discovery 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

Fri Feb 10, 2017 11:53 am

I have yet to try latest Mausi code (hello, MausiMick, maybe there is something even more recent now? :) ). I left my Box-O-Scope at home, earliest (is that even a word?) would be late tonight, when I can continue experiments. About sacrifices (TFT refresh, Touch, Encoder readings), I guess some are unavoidable with this particular chip we are using. Looks like authors (Alex2, Yurick, GFX) of GFXscope 3.0, for example, got tired of hardware limitations, and migrated to F407, with display away from SPI. By the way, maybe any use this translation (it is about touch, but still):
” Scope, when you press the touch, ceases to do synchronization, it is intended so – to somehow respond to touch, so, quick, but without synchronization. In the high-frequency signal, you do not feel that, because there is also a software synchronization, but turning to time 1ms and a few times a second you will see that it starts to not work properly. The fact, that, for small scans by 40ms or more touch almost does not respond – it is a fact, but, what to do? Collect ADC buffer, or respond to touch? …” (from russian, “GFX”).

Fri Feb 10, 2017 1:54 pm

Yep, 407 is a more capable platform, and a parallel display is faster than this one but also more expensive :)
Even though there’s some boards on aliexpress around 14€… it’s not bad.

Touch is a bit tricky but this text suggest that they would benefit from interrupt driven ADC captures. Or using a timmer for those slow scan timings.

Fri Feb 10, 2017 2:03 pm

Just a quick thought (not researched really) – could some hardware de-bounce chip solve encoder (or buttons) problem here? Just in theory, not prices or anything considered.
Oh, and I wanted to ask, wasn’t there possibility to activate internal pull-ups on those STM32STM32Микроконтроллеры и процессоры…Map magic glue code, ethernet compiles, just WARNING: library LwIP claims to run on [ stm32 ] architecture(s) and may be incompatible with your current board which runs on [STM32]…[STM32GENERIC] F429i Discovery pins?

Fri Feb 10, 2017 2:14 pm

yep, probably a schmitt-trigger would help to avoid transition noise…
Using the falling edge to do the counting would help probably, but maintaining the rising edge discrimination time.
Only more testing will improve this… (time travel capsule needed :) )
The resistors on the encoder are already pull-up’s don’t think the internal would do anything here…

Fri Feb 10, 2017 2:34 pm

rexnanet wrote:
The resistors on the encoder are already pull-up’s don’t think the internal would do anything here…

Fri Feb 10, 2017 3:22 pm

Oh, yes.

I have these:
https://pt.aliexpress.com/item/Free-Shi … 9342e4b279

Only had to add a resistor for the SW and added a capacitor on each one to GND.

Without capacitor : total caos :) I tested it on the logic analyser(saelae clone).

Fri Feb 10, 2017 7:48 pm

Guys,

There is a thread about debouncing those rotary encoders.

I use them myself, and use external CR debounce.

I use an external resistor and capacitor, but had issues with this. So I would advise using 2 external resistors and one capacitor. ( as discussed in the other thread)

BTW. I don’t think you need Schmitt triggers. the R,C,R external circuit was enough.

PS. dont try using the internal pullup ( like I did), as its value is defined in the spec to be something like 40k plus or minus 10k, which is too high not to be prone to glitches.

Sun Feb 12, 2017 3:05 pm

I’ve done some more detailed testing with the logic analyser.

After all, there’s no multiple interrupt being generated on the Rising pulse edges. It was only observed on the logic analyser.

But I have false rising interrupts on the falling edges so I opted to use falling interrupts and now it’s very simple and minimalist (as it should have been from the start :) )
Working great now :)

Added the MCP6S92MCP6S92Аналоговые, логические и силовые компоненты…It would be great to replace the manual gain switches (and gain pins) with menus and MCP6S92 ’s Smile Might have a go on this Smile P.S. BTW is there a video with this setup/code?…DLO-138 OScope code but still as a trivial demo. Cycles through all the gains so “volt/div” is not real. But proves the point.

Improved the trigger a bit. Trigger mode works better.

It’s enough for today :)

(11.37 KiB) Downloaded 115 times

Sun Feb 12, 2017 4:26 pm

Thank You, Rex! Will test soon, unless some even newer version pops up very soon :)
Here, off-topic or not – what “our” almost zero price “BluePill” is capable of:
https://www.youtube.com/watch?v=7pFui4tvjBE&t=0s
True, this graphic awesomeness is on parallel TFT, not SPI (can we have version on parallel TFT?), but still, looks soooo sweeeet… :)

Sun Feb 12, 2017 8:38 pm

ThunderOwl wrote:Thank You, Rex! Will test soon, unless some even newer version pops up very soon :)

Sun Feb 12, 2017 8:50 pm

I also have one “UNO Shield” type, and I know it is working, tested with project “Pultoskop”:
http://bildites.lv/a/daxkuzd2#8stbtwj7
If it looks like yours, I can point you to code, so probably you will see what libraries (what chipset) are used.

Sun Feb 12, 2017 9:29 pm

The seller says it’s ILI9481ILI9481Дисплеи, сенсорные панели и светодиоды…6, 2016 10:38 am Hi ThunderOwl, Last time I tested other displays on STM32 (ILI9327, ILI9481 ), but with no success. And in this thread i tested a little bit with Touch (URTouch-l…$10 O-Scope revisited but I have my doubts…

https://pt.aliexpress.com/item/3-2-inch … 19747.html

I have a Mega now (3d printer project :) ), probably it’s easier to test it on it…

Mon Feb 13, 2017 2:15 pm

Very often these mcufriend LCD TFT shields arrive with a printing that says which chip is used inside. I believe that a manual timbre is used.

In the David Prentice TFT library there is a sketch capable of identify the chip in most of the cases.

Wed Feb 15, 2017 2:35 pm

Today I got nice package from “Microchip”:
http://bildites.lv/images/vf8ywtw5/19940/original.jpg
Well, it is not free samples (I did write earlier why), but still manufacturers prices with special offer – free shipping (with fast express).
If nothing else – I am kind of pretty sure, those are originals, not some re-marked chinese fakes :D

Sun Feb 19, 2017 2:49 pm

Hi ThunderOwl,

I am back , I was in holidays near the “antipodes” ? – in Srilanka, its’s really warmer at this time as the weather in Germany or in Lithuania !

I have the program with the AD9851AD9851Аналоговые, логические и силовые компоненты…integrate Touch-functionality (URTOUCH-Lib) and test it with frequency input for DDS AD9851 : the first picture shows the Touch Panel for set frequency, the second the selected fr…DLO-138 OScope modified a little bit, and integrate the frequency-counter function (on PA15) from the forum. Therefore I have moved the display pins CD / CS to PA14 / PA13.

STM32STM32Микроконтроллеры и процессоры…Map magic glue code, ethernet compiles, just WARNING: library LwIP claims to run on [ stm32 ] architecture(s) and may be incompatible with your current board which runs on [STM32]…[STM32GENERIC] F429i Discovery _O_Scope_AD9851AD9851Аналоговые, логические и силовые компоненты…integrate Touch-functionality (URTOUCH-Lib) and test it with frequency input for DDS AD9851 : the first picture shows the Touch Panel for set frequency, the second the selected fr…DLO-138 OScope _FreqCounter_PA15.JPG
STM32STM32Микроконтроллеры и процессоры…Map magic glue code, ethernet compiles, just WARNING: library LwIP claims to run on [ stm32 ] architecture(s) and may be incompatible with your current board which runs on [STM32]…[STM32GENERIC] F429i Discovery _O_Scope_AD9851AD9851Аналоговые, логические и силовые компоненты…integrate Touch-functionality (URTOUCH-Lib) and test it with frequency input for DDS AD9851 : the first picture shows the Touch Panel for set frequency, the second the selected fr…DLO-138 OScope _FreqCounter_PA15.JPG (47.08 KiB) Viewed 1509 times

Sun Feb 19, 2017 8:13 pm

Nice! :D

BTW which is closer to the truth? 3384Hz or 3400Hz ? having said that… 99.529% accuracy ‘aint bad for us amateurs. ;)

Sun Feb 19, 2017 9:11 pm

Welcome Back, Mausi Mick! :)
Hmm, I probably will need to make some jumpers in my construction, to be able to try andy’s, rexnanet, and your versions. Or, maybe make remap in INO files, to some unified connections to screen, encoder. Have to look into that.

Mon Feb 20, 2017 4:53 am

hi Andy,

I have heard for some times that the last 1% of accuracy cost more than 95% of money/time !
( I think it was for the accuracy of the tank Leopard). But now I have time ? :lol:

The accuracy of the counter was most better than 7 Hz, but at some frequency (3000Hz -> 3095, 5000 Hz -> 4762, 7000Hz -> 7205, 9000Hz -> 8538…)
the error was very big.
I think it was a problem with the AD8951, perhaps with the generated frequency from 180 MHz at 3.3V.

I changed the SW:
http://www.changpuak.ch/electronics/AD9851.php

and modified it a little bit (DDS_CLOCK 120MHz) …

Now its work stable with an error less than 1 Hz until 10 kHz and 7 Hz until 300 kHz.

Mon Feb 20, 2017 7:10 am

here a picture:
DSC00012.JPG
DSC00012.JPG (59.11 KiB) Viewed 1467 times

Thu Feb 23, 2017 8:24 am

Hi ThunderOwl, hi Rexnanet,

the different Pins could be a problem, I have changed it partly for shorter wires, or save pins (e.g. for restart PIN on 3.3V).

Another problem is that not all pins of the STM32F103STM32F103Микроконтроллеры и процессоры…19.html . ag123 Sat Apr 28, 2018 5:54 pm come to think of it blue pill / maple mini ( stm32f103 ) is an *ideal* keyboard controller, the scanning can be done with assistance of sh…[SOLVED] generic blue pill clone as USB keyboard chip are connected to the board, neither on the Blue PillBlue PillОтладочные и вычислительные платы…as become my new favorite board. I am calling it “blue pad” and it is kind of super “ blue pill ”. Pito Thu Jul 27, 2017 8:53 pm [victor_pv – Thu Jul 27, 2017 3:58 pm] – Just for…very small STM32F405 board nor on Maple MiniMaple MiniОтладочные и вычислительные платы…8MHz petertumler Thu Sep 24, 2015 10:58 am Hi, I’m trying to underclock a STM32F103 ( Maple Mini ) to 48MHz (for energy efficiency reasons). According to the datasheet .. The full…Underclocking STM32F103 to 48MHz :
on Maple MiniMaple MiniОтладочные и вычислительные платы…8MHz petertumler Thu Sep 24, 2015 10:58 am Hi, I’m trying to underclock a STM32F103 ( Maple Mini ) to 48MHz (for energy efficiency reasons). According to the datasheet .. The full…Underclocking STM32F103 to 48MHz for instance their is no PIN for PB9, which needs Rexnanet for the encoder-buttom.

I try to test his(Rexnanat) program for the MCP6S92MCP6S92Аналоговые, логические и силовые компоненты…It would be great to replace the manual gain switches (and gain pins) with menus and MCP6S92 ’s Smile Might have a go on this Smile P.S. BTW is there a video with this setup/code?…DLO-138 OScope … and I hope, that it would soon go on with the second channel …

Post a reply