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

ahull Fri Jul 31, 2015 9:42 am

If your board doesn’t have the RTC crystal fitted, one of these will do the trick. I have fitted 4 of these so far to different boards, and they work flawlessly. These crystals are pretty tiny (2mm x 6mm not including the leads) however, so you may need a magnifier to see them easily (unless your eyesight is pretty good) and a very fine tip on your soldering iron.

You can obviously comment out the time functions in the code if they are causing issues too. The scope doesn’t rely on them (yet) for anything other than the clock display.

darth_llamah Fri Aug 21, 2015 10:43 am

Hi
Sorry if my question is n00bish, I’m new to C/C++.

I’m trying to compile Pig-O-Scope for Maple Mini clone using Arduino 1.6.5:
-touchscreen is not defined since my TFT doesn’t have one
-all libraries (except for UTouch) are in place
-Time library is renamed and is included correctly
-BOARD_LED is changed to PB1
-I’m aware about second Adafruit_GFX_AS instance but it doesn’t interfere (tested using other TFT projects)

But still I got a compile error:
STM32-O-Scope.ino: In function 'void setup()':
STM32-O-Scope:258: error: 'setADCs' was not declared in this scope
STM32-O-Scope:263: error: 'setCurrentTime' was not declared in this scope
STM32-O-Scope:264: error: 'serialCurrentTime' was not declared in this scope
STM32-O-Scope:265: error: 'sleepMode' was not declared in this scope
STM32-O-Scope:271: error: 'toggleSerial' was not declared in this scope
STM32-O-Scope:272: error: 'toggleHold' was not declared in this scope
STM32-O-Scope:273: error: 'decreaseTimebase' was not declared in this scope
STM32-O-Scope:274: error: 'increaseTimebase' was not declared in this scope
STM32-O-Scope:275: error: 'decreaseZoomFactor' was not declared in this scope
STM32-O-Scope:276: error: 'increaseZoomFactor' was not declared in this scope
STM32-O-Scope:277: error: 'scrollRight' was not declared in this scope
STM32-O-Scope:278: error: 'scrollLeft' was not declared in this scope
STM32-O-Scope:279: error: 'incEdgeType' was not declared in this scope
STM32-O-Scope:280: error: 'decreaseYposition' was not declared in this scope
STM32-O-Scope:281: error: 'increaseYposition' was not declared in this scope
STM32-O-Scope:282: error: 'toggleTestPulseOn' was not declared in this scope
STM32-O-Scope:283: error: 'toggleTestPulseOff' was not declared in this scope
STM32-O-Scope:285: error: 'unrecognized' was not declared in this scope
STM32-O-Scope:307: error: 'timer_set_period' was not declared in this scope
STM32-O-Scope:315: error: 'clearTFT' was not declared in this scope
STM32-O-Scope:326: error: 'showCredits' was not declared in this scope
STM32-O-Scope:327: error: 'showGraticule' was not declared in this scope
STM32-O-Scope:332: error: 'showLabels' was not declared in this scope
STM32-O-Scope.ino: In function 'void loop()':
STM32-O-Scope:346: error: 'trigger' was not declared in this scope
STM32-O-Scope:347: error: 'showGraticule' was not declared in this scope
STM32-O-Scope:350: error: 'blinkLED' was not declared in this scope
STM32-O-Scope:352: error: 'TFTSamples' was not declared in this scope
STM32-O-Scope:353: error: 'showLabels' was not declared in this scope
STM32-O-Scope:360: error: 'takeSamples' was not declared in this scope
STM32-O-Scope:370: error: 'showTime' was not declared in this scope
STM32-O-Scope.ino: In function 'void trigger()':
STM32-O-Scope:440: error: 'triggerNegative' was not declared in this scope
STM32-O-Scope:443: error: 'triggerPositive' was not declared in this scope
STM32-O-Scope:446: error: 'triggerBoth' was not declared in this scope
STM32-O-Scope.ino: In function 'void takeSamples()':
STM32-O-Scope:519: error: 'DMA1_CH1_Event' was not declared in this scope
STM32-O-Scope:521: error: 'adc_dma_enable' was not declared in this scope
STM32-O-Scope.ino: In function 'void decreaseTimebase()':
STM32-O-Scope:681: error: 'clearTrace' was not declared in this scope
STM32-O-Scope:694: error: 'showTrace' was not declared in this scope
STM32-O-Scope.ino: In function 'void increaseTimebase()':
STM32-O-Scope:701: error: 'clearTrace' was not declared in this scope
STM32-O-Scope:708: error: 'showTrace' was not declared in this scope
STM32-O-Scope.ino: In function 'void increaseZoomFactor()':
STM32-O-Scope:714: error: 'clearTrace' was not declared in this scope
STM32-O-Scope:718: error: 'showTrace' was not declared in this scope
STM32-O-Scope.ino: In function 'void decreaseZoomFactor()':
STM32-O-Scope:725: error: 'clearTrace' was not declared in this scope
STM32-O-Scope:729: error: 'showTrace' was not declared in this scope
STM32-O-Scope.ino: In function 'void setCurrentTime()':
STM32-O-Scope:853: error: 'serialCurrentTime' was not declared in this scope
Multiple libraries were found for "Adafruit_GFX_AS.h"
Used: C:\Users\Matus\Documents\Arduino\hardware\Arduino_STM32\STM32F1\libraries\Adafruit_GFX_AS
Not used: C:\Users\Matus\Documents\Arduino\libraries\Adafruit_GFX_AS-2
'setADCs' was not declared in this scope

ahull Fri Aug 21, 2015 11:08 am

Interesting… I’m not sure if I actually tested those ifdefs for the touch screen. I’ll have a play with it later.
Does it compile if you grab the utouch lib and install it and leave #define TOUCH_SCREEN_AVAILABLE as is?

darth_llamah Fri Aug 21, 2015 11:27 am

ahull wrote:Does it compile if you grab the utouch lib and install it and leave #define TOUCH_SCREEN_AVAILABLE as is?

RogerClark Fri Aug 21, 2015 11:50 am

The old / original bootloader only gives you 17k, the new bootloader gives your all the RAM in the device

Easy test is just to switch the bootloader in the menu and recompile

mrburnette Fri Aug 21, 2015 12:20 pm

RogerClark wrote:The old / original bootloader only gives you 17k, the new bootloader gives your all the RAM in the device

Easy test is just to switch the bootloader in the menu and recompile

darth_llamah Fri Aug 21, 2015 12:33 pm

RogerClark wrote:The old / original bootloader only gives you 17k, the new bootloader gives your all the RAM in the device

Easy test is just to switch the bootloader in the menu and recompile

ahull Fri Aug 21, 2015 1:44 pm

You can decrease the buffer size too.
// Samples - depends on available RAM 6K is about the limit on an STM32F103C8T6
// Bear in mind that the ILI9341 display is only able to display 240x320 pixels, at any time but we can output far more to the serial port, we effectively only show a window on our samples on the TFT.
# define maxSamples 1024*6

darth_llamah Fri Aug 21, 2015 2:18 pm

ahull wrote:You can decrease the buffer size too.

RogerClark Fri Aug 21, 2015 9:01 pm

Backlight is not comtrolled by the processor, its normally connected to Vcc.

So if its not getting lit at all, you have wired it up incorrectly or its defective

victor_pv Fri Aug 21, 2015 11:46 pm

darth_llamah wrote:ahull wrote:You can decrease the buffer size too.

darth_llamah Sat Aug 22, 2015 8:55 am

victor_pv wrote:darth_llamah wrote:ahull wrote:You can decrease the buffer size too.

mrburnette Sat Aug 22, 2015 1:25 pm

darth_llamah wrote:
TFT is for sure not defective, wiring seems to be OK.
But I’m not sure if resulting .hex is good- there is no output on TEST_WAVE_PIN and the board is not enumerated as a serial port.
I’ll check everything again with unmodified sketch

RogerClark Sat Aug 22, 2015 9:34 pm

I totally agree with the modular testing approach that Ray has described.

I often have to go back to the LCD demo to confirm that the connections are correct, before I move on to the real think I want to do.

mrburnette Tue Aug 25, 2015 2:55 pm

RogerClark wrote:I totally agree with the modular testing approach that Ray has described.
I often have to go back to the LCD demo to confirm that the connections are correct, before I move on to the real think I want to do.

zoomx Thu Sep 10, 2015 10:02 am

Finally I build this project with the TFT TJCTM24024-SPI.

Problems encountered:
If you have Adafruit_GFX_AS library in your libraries folder you will find the problems described here
viewtopic.php?f=14&t=562
the solution was to move this library and the Adafruit_ILI9341_STM library inside the sketch folder and modify all references of .h in all .cpp files.
Time.h library must be renamed in other else.

LED TFT pin seems that it don’t work in PA3 pin (but STM board take power from STlink, I forgot USB cable), I used a 3.3V pin.
It seems that touch coordinates are rotated by 180 degrees, maybe it is written in some pages here but I believe that the solution is simple.

A note.
STLink was unable to find the chip until I used the STM32 ST-LINK Utility, then in setting choosed “Connect Under Reset” (Mode), then, after connection, blanked the chip. After done that the IDE was able to program the chip. I simply don’t remember wich sketch was in the chip.

RogerClark Thu Sep 10, 2015 8:57 pm

The SWD (STLink) pins are normally set to GPIO mode if you upload via the bootloader etc.

I think only STLink uploads leave the SWD pins in their SWD mode.

martinayotte Sat Sep 12, 2015 3:26 am

ahull wrote:Oink, oink… enjoy.. :D

ahull Sat Sep 12, 2015 1:03 pm

martinayotte wrote:ahull wrote:Oink, oink… enjoy.. :D

Sign in to reply