Spark Logic

$10 O-Scope revisited

ahull Sat May 09, 2015 12:56 pm

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.

Replies

RogerClark Wed May 27, 2015 1:47 am

umm
does it need to be included by RTClock

mrburnette Wed May 27, 2015 11:42 am

… but when I try to use the RTC library, it fails saying it is not declared in that scope:

Such a pun! ;)

I’m having the same issue… just ran out of time yesterday to post about it. Wife’s to-do list is interfering with my playing.

Ray

victor_pv Wed May 27, 2015 12:31 pm

:lol: didn’t think on it until you mentioned

victor_pv Wed May 27, 2015 2:51 pm

Ray any idea on why it happens so far?
I am using version 1.6.0 of the Arduino IDE.
Yesterday I tested installing GCC 4.9.0 15Q1, and still was getting the same errors.

mrburnette Wed May 27, 2015 3:08 pm

victor_pv wrote:Ray any idea on why it happens so far?
I am using version 1.6.0 of the Arduino IDE.
Yesterday I tested installing GCC 4.9.0 15Q1, and still was getting the same errors.

victor_pv Wed May 27, 2015 3:58 pm

I’m going to try 1.6.0 in a clean computer that never had it installed, then download Roger’s master repo, and then try again…

victor_pv Wed May 27, 2015 6:25 pm

Andy, are you able to compile the last push I sent and test it? I had tested separating the ADC setup and the DMA capture before you added RTC to it, so I expect it to work fine, but I can’t test right now due to the RTC errors.

ahull Wed May 27, 2015 7:15 pm

Yes, compiles for me. However with the following caveats.
I may be using a different version of the ILI9341 libraries. I’ll need to check once I get back from the supermarket.
Multiple libraries were found for "Adafruit_ILI9341_STM.h"
Used: /home/ahull/Arduino/libraries/Adafruit_ILI9341_STM
Not used: /home/ahull/PersonalApps/Arduino.cc/beta/arduino-nightly/hardware/Arduino_STM32/STM32F1/libraries/Adafruit_ILI9341_STM
Multiple libraries were found for "Adafruit_GFX_AS.h"
Used: /home/ahull/Arduino/libraries/Adafruit_GFX_AS
Not used: /home/ahull/PersonalApps/Arduino.cc/beta/arduino-nightly/hardware/Arduino_STM32/STM32F1/libraries/Adafruit_GFX_AS

victor_pv Wed May 27, 2015 8:22 pm

I get the same errors with gmtime and mktime on a clean install of Arduino IDE 1.6.0 and the latest repo.

Andy, what version of the IDE are you using?

victor_pv Wed May 27, 2015 8:46 pm

Ray, I found the issue.
Paul’s Time library, called Time (with uppercase T) seems to be taken for time.h from the standard library.
I get to compile by renaming Paul’s library to Time1.cpp and Time1.h.

No idea if this is specific to the Arduino IDE, or rather to gcc for Windows, or it depends on what order gcc loads each header file.

mrburnette Wed May 27, 2015 11:25 pm

… well, that explains it! Thanks for digging into it, I was occupied today with non-fun chores.

Ray

RogerClark Wed May 27, 2015 11:27 pm

Ah

Is this a case in-sensitivity issue on windows, e.g. Time.h == time.h which is an internal header in the compiler ??

I suspect that its best not to call your own files Time.h or Time.cpp just to be safe

victor_pv Thu May 28, 2015 12:08 am

It seems like it.

Ray is using Arduino 1.7.3 from “the others” while I use the 1.6.0, and I also tried gcc 4.9 with same results. So the issue seems to be that windows for whatever reason doesn’t care for the case, although with other libraries I have found that I had to match the case or it would not find the files… go figure…

victor_pv Thu May 28, 2015 3:06 am

ahull wrote:Yes, compiles for me…

ahull Thu May 28, 2015 1:27 pm

O-Swilloscope! :D

Image

Idea (c) 2015 Niall Chapman… all rights reserved. Value of bacon may go up as well as down. You sense of humour may be at risk if you do not keep up payments… etc.

mrburnette Thu May 28, 2015 2:21 pm

With all the basic routines in the design, you could also use one of the I/O lines to switch between “scope” and “Voltmeter” mode… in the latter mode, Mr. swine would be a Pig-O-Meter instead of a Swine-O-Scope… properly known as POM and SOS on the labeling. If you extend the Voltmeter concept to have an internal shunt, then the Ammeter could be called a Bacon-O-meter (Bak’ en Omm mi tor). In electronic slang, checking voltage, current, or waveforms could likely evolve to being, “Porking around the circuit.”

Ray

ahull Thu May 28, 2015 3:06 pm

I like your sty-le..

victor_pv Fri May 29, 2015 2:43 pm

Little update, I tested the pig-oscope in an RCT6 board, and works fine. I tested it with the latest commits in the repo, that has 2 ILI9341 libraries, one with DMA (_STM) and one without. Works fine with both.

I noticed that if the sketch is waiting for a trigger level to capture the next batch of samples, it seems to be hold in that loop forever until it triggers, and in the meanwhile will not respond to any other serial commands.

As soon as the trigger event happens, it goes and responds to all the commands that were sent in the meanwhile. I haven’t check the code of the trigger section to see why is that, I believe is not board specific but I had not noticed that before.

BTW I have not started turning it to an RTOS yet, if you need to make changes push them to the repo and I’ll download again before starting with RTOS.

ahull Fri May 29, 2015 4:29 pm

The triggering is very crude. I suspect we need to redesign the triggering to take advantage of our dual ADCs and DMA. I’ve got guests staying over this weekend, but I will take a look at any recent changes when if I get some time this evening.

If we can make the triggering more robust we could look at averaging schemes over multiple triggers to get better resolution (although this would require more RAM or fewer samples per event and might not be practical on the STM32F103C8XX boards). There are a couple of tricks that also allow increased bandwidth by averaging too, so we might theoretically be able to pluck a few more megasamples/sec from our short signal with a bit of smoke and mirrors. Consistent triggering is key to these ideas though.

This might make interesting reading.

Sign in to reply