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

Sun Dec 18, 2016 1:23 pm

Thanks, Andy.

And … What UART port does SerialCommand sCmd;
use?

Sun Dec 18, 2016 1:50 pm

Joxo989 wrote:Thanks, Andy.

And … What UART port does SerialCommand sCmd;
use?

Sun Dec 18, 2016 3:24 pm

Thanks again.

Re: SerialCommand:
CRLF mapping in the terminal program did the trick….

Sun Dec 18, 2016 4:00 pm

Joxo989 wrote:Thanks again.

Re: SerialCommand:
CRLF mapping in the terminal program did the trick….

Mon Dec 19, 2016 10:48 pm

ThunderOwl wrote:ahull wrote:… In my quest to find the cheapest suitable screen with a touch panel, I came across these -> http://www.ebay.co.uk/itm/282274565558? … EBIDX%3AIT
They should work with the UTFT libs, so I ordered one. …

Fri Dec 23, 2016 11:38 pm

ahull wrote:I have had bother with some serial terminal emulators.
The serial output should come out of the USB serial device.

Sat Dec 24, 2016 12:18 am

ThunderOwl wrote:ahull wrote:I have had bother with some serial terminal emulators.
The serial output should come out of the USB serial device.

Sat Dec 24, 2016 4:15 pm

Merry Christmas, Everyone! :)

Sun Dec 25, 2016 12:56 pm

May I still post my Xmas wishes letter to Santa? :)
I imagine it would be awesome if we have systematized updated links to current, “latest and greatest” versions of “O-Scope” somewhere easily accessible without lot of searching. I guess it could be “sticky” first post of this thread, for example. With links to current versions of code from various users who are creating “forks”. Sometimes it is done in first post Author’s signature link.
Can we wish that, for Christmas? :) Or maybe New Year :)
Please, question to mausi_mick: I presume you are also Windows user, and, judging from your earlier posts, also struggling to have any serial interaction? Or maybe any success, that you could share? It kinda looks like serial connection is possible only for non-Windows users here. I can hope that I am wrong. And, mausi_mick, what is your current code that youi like yourslef? Is it encoder-oriented, or touch, or both maybe? Thanks in advance!

Sun Dec 25, 2016 9:26 pm

Wiki is here -> https://github.com/pingumacpenguin/STM32-O-Scope/wiki
All pull requests and Wiki edits are welcome. If you figure out the cause of your Windows serial woes (short of installing a real operating system of course :twisted: ) post them on the wiki and share them here.

Sun Dec 25, 2016 9:36 pm

Yes, but what about work of mausi_mick, racemaniac, rexanet, maybe more others?

Mon Dec 26, 2016 10:38 am

Hi ThunderOwl,

Last time I tested other displays on 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 (ILI9327ILI9327Дисплеи, сенсорные панели и светодиоды…0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 GAMMA-N reg(0x00EF) 00 00 00 00 00 00 ILI9327 reg(0x00F2) 00 00 00 00 00 00 00 00 00 00 00 00 Adjust Control 2 reg(0x00F6) 00 00 00…8-bit|16-bit parallell ILI9341 , 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 with no success.

And in this thread i tested a little bit with Touch (URTouch-lib) .
On a 2.8″ ILI9341ILI9341Дисплеи, сенсорные панели и светодиоды… shows on my screen. I have used and programmed a few different types of SPI screens( ili9341 , st7735) using Python very successfully and these parallel screens have many of the…[SOLVED] FSMC LCD on STM32F407VET display it’s possible to change the parameters over touch with your fingers, on smaller displays you have to take a stick or make the changes over encoder(s).

Wishes for the new year:
–
–
–
– a second channel for the O_Scope ( for testing quadrature encoders … )
– a bigger display with more pixel (like 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 -8bit? 480 x 320)) for display the signal with 8-bit resolution.

Mon Dec 26, 2016 10:54 am

I hacked up a version for a *smaller* display (c’mon I’m not Santa Clause… I can’t give you all the toys you want ;) )

Here’s the diff between the hacked TFT_ILI9163CILI9163CДисплеи, сенсорные панели и светодиоды…ered if it would be possible to get the pig-o-scope working with it. This display is ILI9163C based, but the original code calls for a ILI9341 display. After a bit of head scratch…$10 O-Scope revisited 1.4″ version (first) and the original Adafruit_ILI9341ILI9341Дисплеи, сенсорные панели и светодиоды… shows on my screen. I have used and programmed a few different types of SPI screens( ili9341 , st7735) using Python very successfully and these parallel screens have many of the…[SOLVED] FSMC LCD on STM32F407VET _STM git version (second) so you can see what changes were needed. I don’t intend to support different displays, but if you fancy doing the work in such a way that you can define the display type and automagically include the correct libs, then feel free to give it a go. You may need to trim out some of the bloat, and define a better set of colour names too.

1,2c1,2

< /*.

<   (c) Andrew Hull - 2015

---

>  /*.

> (c) Andrew Hull - 2015

4c4

<   STM32-O-Scope - aka "The Pig Scope" or pigScope released under the GNU GENERAL PUBLIC LICENSE Version 2, June 1991

---

> STM32-O-Scope - aka "The Pig Scope" or pigScope released under the GNU GENERAL PUBLIC LICENSE Version 2, June 1991

6c6

<   https://github.com/pingumacpenguin/STM32-O-Scope

---

> https://github.com/pingumacpenguin/STM32-O-Scope

8c8

<   Adafruit Libraries released under their specific licenses Copyright (c) 2013 Adafruit Industries.  All rights reserved.

---

> Adafruit Libraries released under their specific licenses Copyright (c) 2013 Adafruit Industries.  All rights reserved.

12,13c12,13

< //#include "Adafruit_ILI9341_STM.h"

< //#include "Adafruit_GFX_AS.h"

---

> #include "Adafruit_ILI9341_STM.h"

> #include "Adafruit_GFX_AS.h"

19c19

< #define LANDSCAPE 3

---

> #define LANDSCAPE 1

21,26d20

< // Define the orientation of the touch screen. Further

< // information can be found in the UTouch library documentation.

<

< // #define TOUCH_SCREEN_AVAILABLE

<

< #define TOUCH_ORIENTATION  LANDSCAPE

28,33d21

< #ifdef TOUCH_SCREEN_AVAILABLE

< // UTouch Library

< // http://www.rinkydinkelectronics.com/library.php?id=56

< #include <UTouch.h>

<

< #endif

48d35

< #ifdef TOUCH_SCREEN_AVAILABLE

50c37,42

< UTouch  myTouch( PB12, PB13, PB14, PB15, PA8);

---

> // Also define the orientation of the touch screen. Further

> // information can be found in the UTouch library documentation.

> //

>

> // This makes no sense.. (BUG) but if you don't actually have a touch screen, you need to declere it anyway then  #undef it below.

> #define TOUCH_SCREEN_AVAILABLE

51a44,49

> #if defined TOUCH_SCREEN_AVAILABLE

> #define TOUCH_ORIENTATION  LANDSCAPE

> // UTouch Library

> // http://www.rinkydinkelectronics.com/library.php?id=56

> #include <UTouch.h>

> UTouch  myTouch( PB12, PB13, PB14, PB15, PA8);

53a52,55

> // This makes no sense.. (BUG) but if you don't actually have a touch screen, #undef it here.

> #undef TOUCH_SCREEN_AVAILABLE

>

>

77c79

< #include "Time.h"

---

> #include "Time.h" //If you have issues with the default Time library change the name of this library to Time1 for example.

84a87

> /* For reference on STM32F103CXXX

86,88c89,98

< #define BOARD_LED      PC13

< //#define TFT_LED        PC13          // Backlight

< #define TEST_WAVE_PIN       PB0     // PWM 500 Hz

---

> variants/generic_stm32f103c/board/board.h:#define BOARD_NR_SPI              2

> variants/generic_stm32f103c/board/board.h:#define BOARD_SPI1_NSS_PIN        PA4

> variants/generic_stm32f103c/board/board.h:#define BOARD_SPI1_MOSI_PIN       PA7

> variants/generic_stm32f103c/board/board.h:#define BOARD_SPI1_MISO_PIN       PA6

> variants/generic_stm32f103c/board/board.h:#define BOARD_SPI1_SCK_PIN        PA5

>

> variants/generic_stm32f103c/board/board.h:#define BOARD_SPI2_NSS_PIN        PB12

> variants/generic_stm32f103c/board/board.h:#define BOARD_SPI2_MOSI_PIN       PB15

> variants/generic_stm32f103c/board/board.h:#define BOARD_SPI2_MISO_PIN       PB14

> variants/generic_stm32f103c/board/board.h:#define BOARD_SPI2_SCK_PIN        PB13

90,109d99

<

< /*

<    Connections to an STM32F103CXXX board as follows. (Wire colours for reference only, clearly you can use whatever colours you please).

<   NOTE: While most of the cheap "ILI9163C 128x128 TFT" boards will probably work you may also need to set the board type in TFT_ILI9163C.h

<   Also, the STM32F103XXX boards are 3v3 devices, as is the display, so you can in fact short out the link across the regulator on the display and power it directly from the 3v3 on the STM board.

<

<   Pinout  - (TFT => stm32duino)

<   LED to 3.3V   - Orange  - Could also be taken to a suitable pin + transistor to drive the backlight.

<                            NOTE: The backlight will probably draw far too much current for one GPIO pin to handle unbuffered.

<

<   SCK to PA5    - Yellow  - STM32 -> SPI1_SCK      - These two SPI pins are hardware defined pins

<   SDA to PA7    - Greeen  - STM32 -> SPI1_MOSI     -

<

<                -           The exact pin number of the next three pins are not critical, you should be able to use and GPIO, update the below #defines and it should work.

<   A0 to PB6     - Blue

<   RST to PB5    - Violet    - Can also be tied to STM32_NRST, so save a GPIO pin.

<   CS to PB7     - Grey

<

<   GND to GND    - Brown

<   VCC to 3.3V   - Red

111,114d100

< // Additional SPI1 pins.

< #define RST PB5

< #define DC PB8

< #define CS PB9

115a102,113

> // Additional  display specific signals (i.e. non SPI) for STM32F103C8T6 (Wire colour)

> #define TFT_DC      PA0      //   (Green)

> #define TFT_CS      PA1      //   (Orange)

> #define TFT_RST     PA2      //   (Yellow)

>

> // Hardware SPI1 on the STM32F103C8T6 *ALSO* needs to be connected and pins are as follows.

> //

> // SPI1_NSS  (PA4) (LQFP48 pin 14)    (n.c.)

> // SPI1_SCK  (PA5) (LQFP48 pin 15)    (Brown)

> // SPI1_MOSO (PA6) (LQFP48 pin 16)    (White)

> // SPI1_MOSI (PA7) (LQFP48 pin 17)    (Grey)

> //

117,118c115,116

< #include "TFT_ILI9163C.h"

< TFT_ILI9163C TFT = TFT_ILI9163C(CS, DC, RST);

---

> #define TFT_LED        PA3     // Backlight

> #define TEST_WAVE_PIN       PB1     //PB1 PWM 500 Hz

119a118,119

> // Create the lcd object

> Adafruit_ILI9341_STM TFT = Adafruit_ILI9341_STM(TFT_CS, TFT_DC, TFT_RST); // Using hardware SPI

123,159c123

< #define BOARD_LED PC13

<

< #ifndef  ILI9341_BLACK

< // Color definitions from ILI9341

< // FIXME: I should stick to a subset of real colours, and avoid the Adafruit ones.

< #define ILI9341_BLACK       0x0000      /*   0,   0,   0 */

< #define ILI9341_NAVY        0x000F      /*   0,   0, 128 */

< #define ILI9341_DARKGREEN   0x03E0      /*   0, 128,   0 */

< #define ILI9341_DARKCYAN    0x03EF      /*   0, 128, 128 */

< #define ILI9341_MAROON      0x7800      /* 128,   0,   0 */

< #define ILI9341_PURPLE      0x780F      /* 128,   0, 128 */

< #define ILI9341_OLIVE       0x7BE0      /* 128, 128,   0 */

< #define ILI9341_LIGHTGREY   0xC618      /* 192, 192, 192 */

< #define ILI9341_DARKGREY    0x7BEF      /* 128, 128, 128 */

< #define ILI9341_BLUE        0x001F      /*   0,   0, 255 */

< #define ILI9341_GREEN       0x07E0      /*   0, 255,   0 */

< #define ILI9341_CYAN        0x07FF      /*   0, 255, 255 */

< #define ILI9341_RED         0xF800      /* 255,   0,   0 */

< #define ILI9341_MAGENTA     0xF81F      /* 255,   0, 255 */

< #define ILI9341_YELLOW      0xFFE0      /* 255, 255,   0 */

< #define ILI9341_WHITE       0xFFFF      /* 255, 255, 255 */

< #define ILI9341_ORANGE      0xFD20      /* 255, 165,   0 */

< #define ILI9341_GREENYELLOW 0xAFE5      /* 173, 255,  47 */

< #define ILI9341_PINK        0xF81F

<

< // Colours are RGB565 - try this site for a colour picker --> http://www.barth-dev.de/online/rgb565-color-picker/

< #define TFT_GREY 0x5AEB

< #define TFT_BLACK 0x0000

< #define TFT_WHITE 0xFFFF

< #define TFT_RED 0xFB03

< #define TFT_GREEN 0x37E0

< #define TFT_BLUE 0x081F

< #define TFT_ORANGE 0xFC80

< #define TFT_MAGENTA 0xF817

< #define TFT_YELLOW 0xE7E0

<

< #endif

---

> #define BOARD_LED PC13 //PB0

168,169d131

<

<

171d132

< #define ANALOG_INPUT_1 PB1

173c134

< const int8_t analogInPin = ANALOG_INPUT_1 ;   // Analog input pin: any of LQFP44 pins (PORT_PIN), 10 (PA0), 11 (PA1), 12 (PA2), 13 (PA3), 14 (PA4), 15 (PA5), 16 (PA6), 17 (PA7), 18 (PB0), 19  (PB1)

---

> const int8_t analogInPin = PB0;   // Analog input pin: any of LQFP44 pins (PORT_PIN), 10 (PA0), 11 (PA1), 12 (PA2), 13 (PA3), 14 (PA4), 15 (PA5), 16 (PA6), 17 (PA7), 18 (PB0), 19  (PB1)

174a136

> float displayTime = 0;

183,187c145,146

< int16_t yZoomFactor = 50

<                       ;

<

< //int16_t yPosition = -150 ;

< int16_t yPosition = 20 ;

---

> int16_t yZoomFactor = 100; //Adjusted to get 3.3V wave to fit on screen

> int16_t yPosition = 0 ;

194c153

< unsigned long timeBase = 100;  // Timebase in microseconds

---

> unsigned long timeBase = 200;  //Timebase in microseconds

205d163

< int32_t triggerSensitivity = 6;

207,208c165,171

< int16_t retriggerDelay = 10;

< int8_t triggerType = 1;

---

> // Trigger is setup in one of 32 positions

> #define TRIGGER_POSITION_STEP ANALOG_MAX_VALUE/32

> // Trigger default position (half of full scale)

> int32_t triggerValue = 2048;

>

> int16_t retriggerDelay = 0;

> int8_t triggerType = 2; //0-both 1-negative 2-positive

225,226c188,189

< # define maxSamples 1024*6

< uint32_t startSample = 10;

---

> # define maxSamples 1024*6 //1024*6

> uint32_t startSample = 0; //10

229d191

<

234a197,200

> //array for computed data (speedup)

> uint16_t dataPlot[320]; //max(width,height) for this display

>

>

243,244c209

<   serial_debug.begin();

<   /*

---

>

246c211

<   #ifdef BOARD_LED

---

> #if defined BOARD_LED

247a213,219

>   digitalWrite(BOARD_LED, HIGH);

>   delay(1000);

>   digitalWrite(BOARD_LED, LOW);

>   delay(1000);

> #endif

>   pinMode(TFT_LED, OUTPUT);

>   digitalWrite(TFT_LED, HIGH);

249,255c221

<   for (  int i = 0; i < 30; i++)

<   {

<     blinkLED(100);

<   }

<   #endif

<   */

<

---

>   serial_debug.begin();

281c247,249

<   sCmd.addCommand("Y",   increaseYposition);               // move trace Down

---

>   sCmd.addCommand("Y",   increaseYposition);               // move trace Up

>   sCmd.addCommand("g",   decreaseTriggerPosition);         // move trigger position Down

>   sCmd.addCommand("G",   increaseTriggerPosition);         // move trigger position Up

302a271

>

314,317c283,285

<   TFT.fillScreen(TFT_BLACK);

<

<   //TFT.setRotation(2);

<   //TFT.setRotation(PORTRAIT);

---

>   // initialize the display

>   clearTFT();

>   TFT.setRotation(PORTRAIT);

326a295

> //  showGraticule();

328,329c297

<   showGraticule();

<   delay(3000) ;

---

>   delay(1000) ; //5000

348d315

<     showGraticule();

351,358c318

<       blinkLED(10);

<       //Blank  out previous plot

<       TFTSamples(BEAM_OFF_COLOUR);

<       showLabels();

<

<       // Show the showGraticule

<       showGraticule();

<       //notTriggered = true;

---

>       blinkLED();

361a322,324

>

>       //Blank  out previous plot

>       TFTSamplesClear(BEAM_OFF_COLOUR);

363,364c326,327

<       // Display the Labels ( uS/Div, Volts/Div etc).

<       showLabels();

---

>       // Show the showGraticule

>       showGraticule();

367a331,335

>       displayTime = (micros() - displayTime);

>

>       // Display the Labels ( uS/Div, Volts/Div etc).

>       showLabels();

>       displayTime = micros();

368a337,338

>     }else {

>           showGraticule();

395c365

<       TFT.drawFastHLine(  (myHeight / 2) - 1 , TicksX, 3, TFT_RED);

---

>       TFT.drawFastHLine(  (myHeight / 2) - 1 , TicksX, 3, GRATICULE_COLOUR);

399c369

<       TFT.drawFastHLine(  (myHeight / 2) - 5 , TicksX, 11, GRATICULE_COLOUR);

---

>       TFT.drawFastHLine(  (myHeight / 2) - 3 , TicksX, 7, GRATICULE_COLOUR);

407c377

<       TFT.drawFastVLine( TicksY,  (myWidth / 2) - 1 , 3, TFT_RED);

---

>       TFT.drawFastVLine( TicksY,  (myWidth / 2) - 1 , 3, GRATICULE_COLOUR);

411c381

<       TFT.drawFastVLine( TicksY,  (myWidth / 2) - 5 , 11, GRATICULE_COLOUR);

---

>       TFT.drawFastVLine( TicksY,  (myWidth / 2) - 3 , 7, GRATICULE_COLOUR);

420,421c390,391

<   adc_set_sample_rate(ADC1, ADC_SMPR_13_5);

<   adc_set_sample_rate(ADC2, ADC_SMPR_13_5);

---

>   adc_set_sample_rate(ADC1, ADC_SMPR_1_5); //=0,58uS/sample.  ADC_SMPR_13_5 = 1.08uS - use this one if Rin>10Kohm,

>   adc_set_sample_rate(ADC2, ADC_SMPR_1_5);    // if not may get some sporadic noise. see datasheet.

455,457c425,431

<   delayMicroseconds(20);

<   if (((analogRead(analogInPin) - triggerPoints[0] ) < triggerSensitivity) or ((triggerPoints[0] - analogRead(analogInPin) ) < triggerSensitivity)) {

<     notTriggered = false ;

---

>   while(notTriggered){

>     triggerPoints[1] = analogRead(analogInPin);

>     if ( ((triggerPoints[1] < triggerValue) && (triggerPoints[0] > triggerValue)) ||

>          ((triggerPoints[1] > triggerValue) && (triggerPoints[0] < triggerValue)) ){

>       notTriggered = false;

>     }

>     triggerPoints[0] = triggerPoints[1]; //analogRead(analogInPin);

462,466d435

<

<   triggerPoints[1] = analogRead(analogInPin);

<   if ((triggerPoints[1] - triggerPoints[0] ) > triggerSensitivity) {

<     notTriggered = false;

<   }

467a437,443

>   while(notTriggered){

>     triggerPoints[1] = analogRead(analogInPin);

>     if ((triggerPoints[1] > triggerValue) && (triggerPoints[0] < triggerValue) ){

>       notTriggered = false;

>     }

>     triggerPoints[0] = triggerPoints[1]; //analogRead(analogInPin);

>   }

471,475d446

<

<   triggerPoints[1] = analogRead(analogInPin);

<   if ((triggerPoints[0] - triggerPoints[1] ) > triggerSensitivity) {

<     notTriggered = false;

<   }

476a448,454

>   while(notTriggered){

>     triggerPoints[1] = analogRead(analogInPin);

>     if ((triggerPoints[1] < triggerValue) && (triggerPoints[0] > triggerValue) ){

>       notTriggered = false;

>     }

>     triggerPoints[0] = triggerPoints[1]; //analogRead(analogInPin);

>   }

486,488c464,466

<     serial_debug.println(triggerPoints[0]);

<     serial_debug.println(triggerPoints[1]);

<     serial_debug.println(triggerType);

---

>   serial_debug.println(triggerPoints[0]);

>   serial_debug.println(triggerPoints[1]);

>   serial_debug.println(triggerType);

497c475

< void blinkLED(uint16_t duration)

---

> void blinkLED()

501c479

<   delay(duration);

---

>   delay(10);

539a518,525

> void TFTSamplesClear (uint16_t beamColour)

> {

>   for (signalX=1 ; signalX < myWidth - 2; signalX++)

>   {

>     //use saved data to improve speed

>     TFT.drawLine (  dataPlot[signalX-1], signalX, dataPlot[signalX] , signalX + 1, beamColour) ;

>   }

> }

544,545c530,534

<   signalX = 1;

<   while (signalX < myWidth - 2)

---

>   //calculate first sample

>   signalY =  ((myHeight * dataPoints[0 * ((endSample - startSample) / (myWidth * timeBase / 100)) + 1]) / ANALOG_MAX_VALUE) * (yZoomFactor / 100) + yPosition;

>   dataPlot[0]=signalY * 99 / 100 + 1;

>

>   for (signalX=1 ; signalX < myWidth - 2; signalX++)

549,558c538,541

<     signalY =  (((myHeight * dataPoints[signalX * ((endSample - startSample) / (myWidth * timeBase / 100)) + 1]) / ANALOG_MAX_VALUE) * yZoomFactor ) / 100 + yPosition;

<     signalY1 = (((myHeight * dataPoints[(signalX + 1) * ((endSample - startSample) / (myWidth * timeBase / 100)) + 1]) / ANALOG_MAX_VALUE) * yZoomFactor ) / 100 + yPosition ;

<     TFT.drawLine (  signalY * 99 / 100 + 1, signalX, signalY1 * 99 / 100 + 1 , signalX + 1, beamColour) ;

<     signalX += 1;

<     /*

<       serial_debug.println((myHeight * dataPoints[signalX * ((endSample - startSample) / (myWidth * timeBase / 100)) + 1]) / ANALOG_MAX_VALUE);

<       serial_debug.println(dataPoints[(signalX + 1) * ((endSample - startSample) / (myWidth * timeBase / 100)) + 1]);

<       serial_debug.println(yZoomFactor/100);

<       serial_debug.println(yPosition);

<     */

---

>     signalY1 = ((myHeight * dataPoints[(signalX + 1) * ((endSample - startSample) / (myWidth * timeBase / 100)) + 1]) / ANALOG_MAX_VALUE) * (yZoomFactor / 100) + yPosition ;

>     dataPlot[signalX] = signalY1 * 99 / 100 + 1;

>     TFT.drawLine (  dataPlot[signalX-1], signalX, dataPlot[signalX] , signalX + 1, beamColour) ;

>     signalY = signalY1;

563,564c546,547

<   // Run a bunch of NOOPs to trim the inter ADC conversion gap

<   void sweepDelay(unsigned long sweepDelayFactor) {

---

> // Run a bunch of NOOPs to trim the inter ADC conversion gap

> void sweepDelay(unsigned long sweepDelayFactor) {

569c552

<   }

---

> }

575,576c558,559

<   TFT.setTextSize(0);

<   TFT.setCursor(2, 100);

---

>   TFT.setTextSize(1);

>   TFT.setCursor(10, 190);

581,583c564,572

<   TFT.setTextSize(0);

<   TFT.print(" uS ");

<   TFT.setTextSize(0);

---

>   TFT.setTextSize(1);

>   TFT.print(" uS/Sample  ");

>   TFT.print(maxSamples);

>   TFT.print(" samples ");

> //  TFT.setCursor(10, 190);

> //  TFT.print(displayTime);

>   TFT.print(float (1000000 / float(displayTime)));

>   TFT.print(" fps    ");

>   TFT.setTextSize(2);

585,586c574,575

<   TFT.print("3.0");

<   TFT.setTextSize(0);

---

>   TFT.print("0.3");

>   TFT.setTextSize(1);

588,595c577,584

<   /* Not enough room on 128*128 for all of the lables

<     TFT.setTextSize(0);

<     TFT.print(samplingTime);

<     TFT.setTextSize(0);

<     TFT.print(" us for ");

<     TFT.print(maxSamples);

<     TFT.print(" samples ");

<   */

---

>   TFT.setTextSize(1);

>

>   TFT.print("timeBase=");

>   TFT.print(timeBase);

>   TFT.print(" yzoom=");

>   TFT.print(yZoomFactor);

>   TFT.print(" ypos=");

>   TFT.print(yPosition);

603c592

<   TFT.setTextSize(0);

---

>   TFT.setTextSize(1);

608c597

<     TFT.setCursor(5, 120);

---

>     TFT.setCursor(5, 10);

623,631c612,618

<     /*  Not enough room on 128*128 display for date

<       TFT.print(" ");

<       TFT.print(day(tt));

<       TFT.print("-");

<       TFT.print(month(tt));

<       TFT.print("-");

<       TFT.print(year(tt));

<       TFT.print(" "TZ" ");

<     */

---

>     TFT.print(" ");

>     TFT.print(day(tt));

>     TFT.print("-");

>     TFT.print(month(tt));

>     TFT.print("-");

>     TFT.print(year(tt));

>     TFT.print(" "TZ" ");

655,656c642

<     //serial_debug.print("\n");

<     serial_debug.println();

---

>     serial_debug.print("\n");

695,696c681,682

<     sweepDelayFactor =  sweepDelayFactor / 2 ;

<     if (sweepDelayFactor < 1 ) {

---

>   sweepDelayFactor =  sweepDelayFactor / 2 ;

>   if (sweepDelayFactor < 1 ) {

700c686

<     }

---

>   }

801a788,806

>

> void increaseTriggerPosition() {

>

>   if (triggerValue < ANALOG_MAX_VALUE ) {

>     triggerValue += TRIGGER_POSITION_STEP;  //trigger position step

>   }

>   Serial.print("# TriggerPosition=");

>   Serial.println(triggerValue);

> }

>

> void decreaseTriggerPosition() {

>

>   if (triggerValue > 0 ) {

>     triggerValue -= TRIGGER_POSITION_STEP;  //trigger position step

>   }

>   Serial.print("# TriggerPosition=");

>   Serial.println(triggerValue);

> }

>

833,834c838,839

<   @brief Enable DMA requests

<   @param dev ADC device on which to enable DMA requests

---

> * @brief Enable DMA requests

> * @param dev ADC device on which to enable DMA requests

843,844c848,849

<   @brief Disable DMA requests

<   @param dev ADC device on which to disable DMA requests

---

> * @brief Disable DMA requests

> * @param dev ADC device on which to disable DMA requests

884d888

<   // Not enough space on  128*128 display but OK on serial

996,1003c1000,1001

<   TFT.setTextColor(TFT_RED, BEAM_OFF_COLOUR) ;

<   TFT.setTextSize(0);                           // Tiny font

<   TFT.setCursor(0, 10);

<   TFT.print("STM-O-Scope") ;

<   TFT.setCursor(0, 30);

<   TFT.print(" Andy Hull");

<   TFT.setCursor(0, 40);

<   TFT.print(" Ray Burnette.");

---

>   TFT.setTextSize(2);                           // Small 26 char / line

>   //TFT.setTextColor(CURSOR_COLOUR, BEAM_OFF_COLOUR) ;

1005,1007c1003

<   TFT.print(" Victor PV");

<   TFT.setCursor(0, 60);

<   TFT.print(" Roger Clark");

---

>   TFT.print(" STM-O-Scope by Andy Hull") ;

1009,1013c1005

<   TFT.print("stm32duino.com");

<   TFT.setCursor(0, 80);

<   TFT.print("Probe Pin [");

<   TFT.print("PB1");

<   TFT.print("]");

---

>   TFT.print("      Inspired by");

1015,1020c1007,1022

<   TFT.setTextSize(0);

<   TFT.print("GPL Ver. 2 ");

<   TFT.setTextColor(CURSOR_COLOUR, BEAM_OFF_COLOUR) ;

<   //delay(3000);

<   //TFT.setTextSize(2);

<   //TFT.setRotation(PORTRAIT);

---

>   TFT.print("      Ray Burnette.");

>   TFT.setCursor(0, 130);

>   TFT.print("      Victor PV");

>   TFT.setCursor(0, 150);

>   TFT.print("      Roger Clark");

>   TFT.setCursor(0, 170);

>   TFT.print(" and all at stm32duino.com");

>   TFT.setCursor(0, 190);

>   TFT.print(" CH1 Probe STM32F Pin [");

>   TFT.print(analogInPin);

>   TFT.print("]");

>   TFT.setCursor(0, 220);

>   TFT.setTextSize(1);

>   TFT.print("     GNU GENERAL PUBLIC LICENSE Version 2 ");

>   TFT.setTextSize(2);

>   TFT.setRotation(PORTRAIT);

1057,1077d1058

< void send_command(int command, void *message)

< {

<    asm("mov r0, %[cmd];"

<        "mov r1, %[msg];"

<        "bkpt #0xAB"

<          :

<          : [cmd] "r" (command), [msg] "r" (message)

<          : "r0", "r1", "memory");

< }

<

< void put_char(char c)

< {

<     asm (

<     "mov r0, #0x03\n"   /* SYS_WRITEC */

<     "mov r1, %[msg]\n"

<     "bkpt #0xAB\n"

<     :

<     : [msg] "r" (&c)

<     : "r0", "r1"

<     );

< }

Mon Dec 26, 2016 11:05 am

BTW you want two channels.. build two scopes.. need three…. four… build more :D

I figure the current BOM is probably nearer $6 than $10 since the STM boards are ubercheap, so a double headed pig-o-scope could be built for a bit less than $20. The advantage of having two is that you still have the full bandwidth on the channels. If you do go down this road, you might need to invent some way of sharing the triggering, so you can trigger both boards from one source, which would be useful for looking at things like encoders and matching clock signals to data.

Another advantage of having two or more scopes is that when the inevitable happens and you break one, you have the other(s) to debug it with.

If you add a second channel to the existing code, you need to share the bandwidth between channels and thus the bandwidth is halved. You could also have one display and multiple channels with each feeding its data to a master controller, but that might be a little more work. Worth it if you intend using a larger, and thus more expensive display I guess. Having two or more channels on the same display does have its advantages. It makes comparing signal timing easier for example.

I figure oscilloscopes are like multimeters, you can never have too many. My wife may not be in complete agreement on this matter :lol:

Mon Dec 26, 2016 2:53 pm

But I think for testing for example quad-encoder with the 90° shift between the signals it’s better to have a Dual-Scope, the bandwidth is there normally not the problem.
Perhaps it’s possible to change by the O-Scope between Single- and Dual-Channel.

Mon Dec 26, 2016 3:00 pm

mausi_mick wrote:But I think for testing for example quad-encoder with the 90° shift between the signals it’s better to have a Dual-Scope, the bandwidth is there normally not the problem.
Perhaps it’s possible to change by the O-Scope between Single- and Dual-Channel.

Tue Dec 27, 2016 1:48 pm

Mausi_mick, can we please have your very latest version(s) of code that uses touch and (or) rotary encoder? Thank You.

Tue Dec 27, 2016 2:56 pm

ahull wrote: If you figure out the cause of your Windows serial woes …

Tue Dec 27, 2016 8:58 pm

ahull wrote:… but if you fancy doing the work in such a way that you can define the display type and automagically include the correct libs, then feel free to give it a go.

Post a reply