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 Jan 13, 2017 9:49 am

ThunderOwl wrote:All pictures under ThunderJuris (me) in portal bildites.lv are my experiments, so you could just ask me, where exactly I got those codes that are in projects in my pictures :) ]

Sat Jan 14, 2017 2:32 pm

I had problems with starting the o-scope. After compiling /upload the program starts direct, but only with USB connection or 5V on Vin the screen was frozen for about 30 sec.
I think the program loops in the trigger-routine.
If I put a signal on the input-pin, the program starts direct.

With the intern DDS generator and an external generator I made some pictures:

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_Sinius_222Hz_3kHz.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_Sinius_222Hz_3kHz.JPG (52.61 KiB) Viewed 1323 times

Sat Jan 14, 2017 2:40 pm

Thanks for update, mausi_mick.

Sat Jan 14, 2017 3:32 pm

mausi_mick wrote:now I have modified “function” 7: activate 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 DDS ….

Sat Jan 14, 2017 3:49 pm

Hi ThunderOwl,

I think I have this board:

http://www.ebay.de/itm/AD9851-DDS-Signa … SwImRYWB6B

It has a dimension from 2.5 cm x 4.5 cm, the holes have a distance from about 2 cm x 4 cm.

The 0 to 1 MHz square-signal I haven’t seen (no jumper on board ?).
Perhaps you / I have to look in the datasheet.
I use the serial port for setting frequency.

Sat Jan 14, 2017 3:58 pm

mausi_mick wrote:Hi ThunderOwl,
It has a dimension from 2.5 cm x 4.5 cm, the holes have a distance from about 2 cm x 4 cm.

Sat Jan 14, 2017 4:25 pm

now I have all delay()’s eliminated in the encoder and switch region, only on the touch-display you have to wait for “ENTER” to go back to osci-mode.
If you switch (with the button on the encoder) to function, the first number (for function 1…7 = timeBase … 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 )
is red illuminated, if you touch again, the second number (for parameters) is yellow illuminated. The third number shows the current value of the parameter.

Sat Jan 14, 2017 9:40 pm

I’m having trouble getting any serial output. Actually, the trouble is connecting the serial, using a “bluepill” board.
To test, I’ve just loaded the AnalogReadSerial example and it works fine: Win10, 72MHz, Boot0 is 1 for programming, 0 otherwise. I’ve tried with serial_debug.begin(115200) and it doesn’t work for me but serial_debug.begin() works. Arduino 1.8.1.

Also, not sure what’s up with these boards or the bootloader but on initial power-up Windows reports USB device not recognized. Since I’m using a powered USB hub I just disconnect the USB from computer (while board remains under power) and then it get recognized. Perhaps I’m missing something or I should be flashing another bootloader. I just used the board as-is and it seems to be working fine otherwise.

BTW, after the device is successfully enumerated, with a basic example the baud rate is ignored and auto-negotiated by Windows, so it does not matter what baud rate you select. Using RealTerm for debugging. I can use Linux (either VM or standalone) but I feel something is off.

Offtopic, but there is a syntax error in the latest source code from GIT:

-#if defined TOUCH_SCREEN_AVAILABLE
should be:
+#ifdef TOUCH_SCREEN_AVAILABLE

unless I’m also missing something there.

Sat Jan 14, 2017 10:09 pm

brainwash, check my posts from, I think, december 29 (page 42). Here, I can repost myself:
Success! I got serial interaction working, with default USB “MapleMapleОтладочные и вычислительные платы…expensive short of buying in bulk. many resort to usb-serial converters. today comes leaflabs maple , stm32duino it is ‘disruptive’ in a similar light, user customizable usb is no…Linux Journal serial” port (onboard USB socket). Problem was one line, that is present in original github INO file, and also later in INO file for fancy miniature TFT. This line (under “void setup”):
serial_debug.begin();
To get my serial working, I have to make it like this:
serial_debug.begin(115200);
or, even comment it out altogether works, for some magic reason!

Sat Jan 14, 2017 10:22 pm

brainwash wrote:Also, not sure what’s up with these boards or the bootloader but on initial power-up Windows reports USB device not recognized.

Sat Jan 14, 2017 10:26 pm

brainwash wrote:Offtopic, but there is a syntax error in the latest source code from GIT:

-#if defined TOUCH_SCREEN_AVAILABLE
should be:
+#ifdef TOUCH_SCREEN_AVAILABLE

unless I’m also missing something there.

Sat Jan 14, 2017 11:28 pm

I’ve read those, but both commenting out and adding 115200 to the serial.begin line just blocks the USB serial completely. Leaving it alone enumerates it but no data is getting through. I have tested at least 20 different kinds of serial devices on my machine and all worked, except USB serial 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 with this project.
My main goal is to have it output data on serial (as written some pages ago) so I’ve commented out most of the touch and LCD code. Now that I’m thinking more, perhaps it’s hanging in some LCD init function.

Edit: haven’t seen all the posts, was not aware that “#ifdef” is the same as “#if defined”.
Looking into the USB hardware issue now as well.

Sun Jan 15, 2017 1:45 pm

Sorry, somehow when I viewed the notification I only saw one post from before, after a refresh (a day later!) I now saw the replies. I’ve edited my last post.
However I have to ask this in a separate post: does not having an LCD alter the flow somehow? i.e. is SPI waiting for some commands that are not arriving? Should I worry about that or did someone already test it without an LCD connected?

I’ve ‘commented out’ the RTC lines through some preprocessor behavior as I want this to be as self-contained as possible (minimal hardware):

#ifndef RTC_AVAILABLE

int hour(long time){return 0;}

int minute(long time){return 0;}

int second(long time){return 0;}

int day(long time){return 0;}

int month(long time){return 0;}

int year(long time){return 0;}

void setTime(int time){}

long now(){return millis();}

#endif

Sun Jan 15, 2017 4:12 pm

I’ve not tried a “headless” version. In the unlikely event that I get a spare moment in the next week or so, I may give it a go. I can’t think why the code will particularly care , so long as you comment out all of the bits that output anything to the screen (the graticule, plot, credits, labels etc).

Sun Jan 15, 2017 4:25 pm

ahull wrote:ThunderOwl wrote:… I have several DIY scopes experimenting-building going in parallel, so no definite timeline for any of them in particular :) If anyone interested about other projects I find interesting – write me message, I guess. Or, if topic starter would want that, I can post all here (some of them are not 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 , for example, clone of cheap USB scopes Hantek/Instrustar – they are Cypress-based).

Mon Jan 16, 2017 2:35 am

their is a nice osci from Bobdavis:

http://bobdavis321.blogspot.de/2013/06/ … s-per.html

…

but back to O-Scope:

I had problems 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 to set back to 0 Hz, it needs more than 400ms.
Therefore I changed the code and reset/init 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 in this case. It’s stable and quicker.

How quick and comfortable you can change frequency you can see on the video:

[urlhttps://youtu.be/g8Aow6RRULM][/url]

Mon Jan 16, 2017 11:34 am

mausi_mick wrote:I had problems with starting the o-scope. After compiling /upload the program starts direct, but only with USB connection or 5V on Vin the screen was frozen for about 30 sec.
I think the program loops in the trigger-routine.
If I put a signal on the input-pin, the program starts direct.

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 _01.ino

Mon Jan 16, 2017 12:52 pm

Hi rexnanet,

thanks for the code,

I have set triggerSensivity to 100 ?? ( 10 was to small) :

uint32_t triggerSensitivity = 100; //########################## ????????

and changed in the function …triggerBoth()
the “or” in the code to || .

I think it’s starts now quick, but for the sinus-wave I think it’s triggered (with triggerBoth()) not stable.

Mon Jan 16, 2017 1:48 pm

Hi mausi_mick,

That approach using triggerSensivity is not ideal because you won’t have a stable trigger. It may work ok for a sine and other similar waves but for other signals it won’t work as expected.
And on that code you can’t set a trigger value.

Post a reply