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

gdenton61 Fri Jul 24, 2015 2:13 am

Compile completes OK.

RogerClark Fri Jul 24, 2015 2:46 am

OK.

I guess you’ll need to wait until Andy (the author of the code gets back to you), he is in Scotland (UK) where its currently the middle of the night

victor_pv Fri Jul 24, 2015 2:57 am

gdenton61 wrote:Hey guys,
Trying to compile the sketch with IDE 1.6.5 on Win7 but it fails – it says the functions called from setup() and loop() haven’t been declared before they are called.
I can get around this by declaring the functions first or by moving setup() and loop() to the bottom but surely I shouldn’t have to do either.

Any ideas?

RogerClark Fri Jul 24, 2015 3:36 am

I’ve occasionally seem some odd things happen with the IDE as well.

I can get its self into a complete mess and complain about duplicate function definitions etc

Did you try quitting the IDE and re-opening that sketch and trying again.

mrburnette Fri Jul 24, 2015 11:48 am

Sounds like we have all been ‘here’ before. I usually close all IDE sessions, delete the temp files and restart. Some authors place the functions above setup() and some authors place the functions after loop(). Generally, I stick ’em into another tab, just do not give it an extension name and the IDE will force it to the .ino which then becomes appended (or maybe prefixed) the that main .ino before compile.

Anyway, it seems to just be one of those inexplicable things that begs an answer but happens when one only wants a clean compile and the answers are really not that important. I would not get too hung-up with the weird stuff the IDE does, I do not think it will ever become stable again, too much code thrashing.

ray

gdenton61 Sat Jul 25, 2015 12:01 am

I tried deleting temp files but still had the same issues, re-ordering the functions got me past that but now I’m stuck with the following errors:

C:\Users\Owner\Documents\Electronics\arduino-1.6.5-r2\hardware\Arduino_STM32\STM32F1\libraries\RTClock\src\RTClock.cpp:88:31: error: ‘mktime’ was not declared in this scope
rtc_set_count(mktime (tm_ptr));

C:\Users\Owner\Documents\Electronics\arduino-1.6.5-r2\hardware\Arduino_STM32\STM32F1\libraries\RTClock\src\RTClock.cpp:98:23: error: ‘gmtime’ was not declared in this scope
tm_ptr = gmtime(&res); //why not gmtime?

RogerClark Sat Jul 25, 2015 12:21 am

I’ll try downloading 1.6.5.r2 for Windows in case the IDE team broke something

gdenton61 Sat Jul 25, 2015 12:50 am

Thanks for your help Roger.
For now I commented out all ‘time’ related stuff and it finished compiling – now i need to wire it up and see what happens.

EDIT – forgot to add that the sketch was too big for RAM with the original bootloader selected so I had to select bootloader 2.0, guess I’ll try to install 2.0 tomorrow.

ahull Sat Jul 25, 2015 8:26 am

gdenton61 wrote:Thanks for your help Roger.
For now I commented out all ‘time’ related stuff and it finished compiling – now i need to wire it up and see what happens.

EDIT – forgot to add that the sketch was too big for RAM with the original bootloader selected so I had to select bootloader 2.0, guess I’ll try to install 2.0 tomorrow.

RogerClark Sat Jul 25, 2015 11:37 am

Andy,

Just a matter of interest.. How much noise do you see on your ADC input if its floating ?

I attached my scope to PA1 when it was operating as a ADC, and I see an interesting saw tooth waveform.

Do you get much noise if measuring from a high impedance source ?

Thanks

Roger

gdenton61 Sat Jul 25, 2015 12:56 pm

ahull wrote:gdenton61 wrote:Thanks for your help Roger.
For now I commented out all ‘time’ related stuff and it finished compiling – now i need to wire it up and see what happens.

EDIT – forgot to add that the sketch was too big for RAM with the original bootloader selected so I had to select bootloader 2.0, guess I’ll try to install 2.0 tomorrow.

ahull Sat Jul 25, 2015 1:39 pm

I’m running Linux, and my libraries folder is in a different location. (in my case the time library is installed in {HOME}/Arduino/libraries/Time )
I cloned Pauls lib with git something like this…
cd /home/ahull/Arduino/libraries
git clone https://github.com/PaulStoffregen/Time.git

gdenton61 Sun Jul 26, 2015 5:15 pm

I figured out what was causing my initial problem (not finding functions after setup() and loop() ).
My display is not a touch-screen so I had commented out “#define TOUCH_SCREEN_AVAILABLE”.
It turns out other people have had this same issue with other sketches and I found the following threads that discuss this and a workaround (If you add this line to the very start, the error goes away: “char foo;”);

http://forum.arduino.cc/index.php?topic=84412.0
http://forum.arduino.cc/index.php/topic … #msg938861

But I’m still getting these errors:

C:\Users\Owner\Documents\Electronics\arduino-1.6.5\hardware\Arduino_STM32\STM32F1\libraries\RTClock\src\RTClock.cpp: In member function 'void RTClock::setTime(tm*)':
C:\Users\Owner\Documents\Electronics\arduino-1.6.5\hardware\Arduino_STM32\STM32F1\libraries\RTClock\src\RTClock.cpp:88:31: error: 'mktime' was not declared in this scope
rtc_set_count(mktime (tm_ptr));
^
C:\Users\Owner\Documents\Electronics\arduino-1.6.5\hardware\Arduino_STM32\STM32F1\libraries\RTClock\src\RTClock.cpp: In member function 'tm* RTClock::getTime(tm*)':
C:\Users\Owner\Documents\Electronics\arduino-1.6.5\hardware\Arduino_STM32\STM32F1\libraries\RTClock\src\RTClock.cpp:98:23: error: 'gmtime' was not declared in this scope
tm_ptr = gmtime(&res);
^

victor_pv Sun Jul 26, 2015 8:16 pm

gdenton61 wrote:

But I’m still getting these errors:

C:\Users\Owner\Documents\Electronics\arduino-1.6.5\hardware\Arduino_STM32\STM32F1\libraries\RTClock\src\RTClock.cpp: In member function 'void RTClock::setTime(tm*)':
C:\Users\Owner\Documents\Electronics\arduino-1.6.5\hardware\Arduino_STM32\STM32F1\libraries\RTClock\src\RTClock.cpp:88:31: error: 'mktime' was not declared in this scope
rtc_set_count(mktime (tm_ptr));
^
C:\Users\Owner\Documents\Electronics\arduino-1.6.5\hardware\Arduino_STM32\STM32F1\libraries\RTClock\src\RTClock.cpp: In member function 'tm* RTClock::getTime(tm*)':
C:\Users\Owner\Documents\Electronics\arduino-1.6.5\hardware\Arduino_STM32\STM32F1\libraries\RTClock\src\RTClock.cpp:98:23: error: 'gmtime' was not declared in this scope
tm_ptr = gmtime(&res);
^

gdenton61 Sun Jul 26, 2015 9:12 pm

Thank you Victor – finally compiled successfully.

But after I upload the sketch the display doesn’t do anything, the board LED starts continuously blinking like it’s triggering.

I know it’s wired correctly as I can upload the graphicstest sketch and that works as expected.

victor_pv Tue Jul 28, 2015 2:54 pm

gdenton61 wrote:Thank you Victor – finally compiled successfully.

But after I upload the sketch the display doesn’t do anything, the board LED starts continuously blinking like it’s triggering.

I know it’s wired correctly as I can upload the graphicstest sketch and that works as expected.

ahull Tue Jul 28, 2015 7:36 pm

victor_pv wrote:gdenton61 wrote:Thank you Victor – finally compiled successfully.

But after I upload the sketch the display doesn’t do anything, the board LED starts continuously blinking like it’s triggering.

I know it’s wired correctly as I can upload the graphicstest sketch and that works as expected.

ahull Tue Jul 28, 2015 7:42 pm

RogerClark wrote:Andy,

Just a matter of interest.. How much noise do you see on your ADC input if its floating ?

I attached my scope to PA1 when it was operating as a ADC, and I see an interesting saw tooth waveform.

Do you get much noise if measuring from a high impedance source ?

Thanks

Roger

gdenton61 Fri Jul 31, 2015 1:17 am

Andy – I’m using a Maple Mini board.

The board LED is connected to PB1 so I had to re-assign a couple of pins – and I erroneously assigned TEST_WAVE_PIN to PB2 – there’s no Timer on PB2 – so it was crashing on the analogWrite function – DOH!

Now the display inits, and I can see the test signal on it.

But now I have to figure out why showTime() and the serial commands are not working…

victor_pv Fri Jul 31, 2015 5:22 am

gdenton61 wrote:Andy – I’m using a Maple Mini board.

The board LED is connected to PB1 so I had to re-assign a couple of pins – and I erroneously assigned TEST_WAVE_PIN to PB2 – there’s no Timer on PB2 – so it was crashing on the analogWrite function – DOH!

Now the display inits, and I can see the test signal on it.

But now I have to figure out why showTime() and the serial commands are not working…

Sign in to reply