Spark Logic

$10 O-Scope revisited

ILI9341 MSP3223 · 14-contact header Pinout
STM32F103C8T6 Example · LQFP48 Pinout
GD32F103 Example · LQFP48 Pinout

Over the last few days I’ve been playing with Ray’s STM32STM32Microcontrollers and processors…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]…View in hardware catalog 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 Mar 18, 2016 3:41 pm

mrburnette wrote:
Yes, this issue is simply an Arduino IDE issue in the way that libraries are searched … one can only have a single Time.h in the /Arduino/libraries directory. It sucks, really, but is just one of those abstract things that Arduino does.

I strongly recommend putting such code directly into the directory with the INO file(s) and encapsulate it. Hard disks are so large these days that the duplicated space is insignificant and the way the ArduinoIDE is evolving, having the Board Manager updating libraries has caused me a great deal of annoyance. Anyway, there are some environments such as Cypress PSoCPSoCMicrocontrollers and processors… choice depends on your own requirements. Note. You may also want to add the Cypress PSoC devices to the list as well, as although they are not programmed via the Arduino IDE, I t…View in hardware catalog development where libraries are always copied into the working folder – so the paradigm is not weird.

Ray

Fri Mar 18, 2016 10:16 pm

rexnanet wrote:
<…>
To solve many of these issues we could create a zip/rar file with all the necessary libraries “in a working state” :) to make it easier to replicate the project.

That approach makes it more dificult to share libraries and their changes but makes compilation a lot easier.
<…>

Wed Mar 23, 2016 2:20 pm

victor_pv wrote:Andy,

I worked some optimizations in the lcd library. It is still not the best it can, but much faster than before specially when it comes to drawing the captured data.
Download the zip attached and use that. It requires the latest SPI library from Roger’s repo.

Adafruit_ILI9341ILI9341Displays, touch panels and LEDs… 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…View in hardware catalog _STM.zip

Wed Mar 23, 2016 3:00 pm

mrburnette wrote:The neatest part of this is that you are using Pix of the O’scope in operation to show capability and issues.

Job well done… this should be a required build for any serious tinkerer who does not have access to a scope. This would be a great PSoCPSoCMicrocontrollers and processors… choice depends on your own requirements. Note. You may also want to add the Cypress PSoC devices to the list as well, as although they are not programmed via the Arduino IDE, I t…View in hardware catalog 4200 project due to the “free” analog subsystem and analog mux + OpAmp. FYI, only $4 http://www.cypress.com/?rID=92146
( do not even consider 4100 )

Ray

Wed Mar 23, 2016 5:03 pm

rexnanet wrote:
Latter I’ll test it on the board :)

Wed Mar 23, 2016 11:16 pm

rexnanet wrote:rexnanet wrote:
Latter I’ll test it on the board :)

Thu Mar 24, 2016 2:45 pm

ahull wrote:
Take care with the backlight, the pins on the STM32F103STM32F103Microcontrollers and processors…19.html . ag123 Sat Apr 28, 2018 5:54 pm come to think of it blue pill / maple mini ( stm32f103 ) is an *ideal* keyboard controller, the scanning can be done with assistance of sh…View in hardware catalog may not be able to source the current needed to run the display at full brightness, you may (depending on your LCD board) need to add a transistor to drive the backlight.

Thu Mar 24, 2016 4:41 pm

rexnanet wrote:ahull wrote:
No, the ADC on most boards is tied to the supply voltage, so in most cases you input signal *must* be between 0v and VCC (3.3V) otherwise you will damage the ADC.

Sun Mar 27, 2016 8:45 pm

ahull wrote:
Dual channel should be relatively easy, but you will not get the full bandwith.

Sun Mar 27, 2016 10:31 pm

You might find this interesting. https://www.tablix.org/~avian/blog/arch … oller_adc/

As to the stability of AnalogWrite, I am not aware of any instability, I suppose the best way to check for this would be to compare with a real oscilloscope.

Mon Mar 28, 2016 12:55 pm

Once you have the kinks ironed out of your changes and you are happy with them, fire me a pull request on githib, and I can merge them if you want. :D

Based on the available analog bandwidth per Alvin’s Blog post I wonder if we can over clock the ADC (at the expense of resolution presumably), and get reliable results beyond the 1MHz stated STM Spec. It looks like an interesting experiment to try. Even 8 bit resolution at say 10MHz would be useful. The GD32F103GD32F103Microcontrollers and processors… think you will need to use a 6 x multipler to give you 96Mhz as the max freq on the GD32F103 is 108Mhz Then if you set the f_cpu in the boards.txt to 96000000L (look at the gd32f…View in hardware catalog Red PillRed PillDevelopment and computing boards…------------------- // // STM32F103C8XX Pin numbers - chosen for ease of use on the " Red Pill " and "Blue Pill" board // Touch Panel Pins // T_CLK T_CS T_DIN T_DOUT T_IRQ // PB12…View in hardware catalog boards might also be worth a bit of over clocking experimentation, their silicon should in theory be more amenable to being driven at higher frequencies.

Mon Mar 28, 2016 8:32 pm

Andy

The GD32GD32Microcontrollers and processors…no bootloader and 120MHz clock. RogerClark Mon Feb 22, 2016 8:31 pm I tried to put a GD32 , taken from one board, onto a Maple mini, but my soldering was not good enough, and I ba…View in hardware catalog boards seem to work fine at 120Mhz, but Ive not looked at whether the ADC works at that frequency.
But it is specced to 108Mhz ( but as you know, USB only works at 48,72,96 and 120Mhz because of limitations in the USB PLL clock divider)

Mon Mar 28, 2016 9:03 pm

RogerClark wrote:Andy

The GD32GD32Microcontrollers and processors…no bootloader and 120MHz clock. RogerClark Mon Feb 22, 2016 8:31 pm I tried to put a GD32 , taken from one board, onto a Maple mini, but my soldering was not good enough, and I ba…View in hardware catalog boards seem to work fine at 120Mhz, but Ive not looked at whether the ADC works at that frequency.
But it is specced to 108Mhz ( but as you know, USB only works at 48,72,96 and 120Mhz because of limitations in the USB PLL clock divider)

Mon Mar 28, 2016 11:23 pm

HI Andy

I think someone may have already looked into clock switching, but I though it breaks the USB connection

You could of course force USB re-enumeration, but that would be a pain every time you wanted to transfer data

Unfortunately the STM32STM32Microcontrollers and processors…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]…View in hardware catalog only has 2 clock divider settings for the USB PLL, but the GD32GD32Microcontrollers and processors…no bootloader and 120MHz clock. RogerClark Mon Feb 22, 2016 8:31 pm I tried to put a GD32 , taken from one board, onto a Maple mini, but my soldering was not good enough, and I ba…View in hardware catalog has 4 (2 bits) (this has been possible because STM have a reserved bit in the register next to the bit for the PLL divider, so GD were able to add 2 more PLL divider settings and yet keep backwards compatibility

Tue Mar 29, 2016 12:53 am

RogerClark wrote:HI Andy

I think someone may have already looked into clock switching, but I though it breaks the USB connection

Tue Mar 29, 2016 9:54 am

Hi Andy

I’m afraid I’ve not looked at the ADC clock at all.

Looking in the manual RM0008, there is a PLL divider for the ADC clock, but I don’t know where its setup in the core.

I took a quick look in the libmaple folder at adc.c, but I can only see the setup for the number of clock cycles per sample, rather than the master PLL divider for the ADC.

I suspect the ADC clock stuff is probably setup somewhere in the RCC code, but I’m not sure where.

If someone had time to play with it, I suppose you may be able to get a bit more performance at the expense of resolution, but I wonder how useful it would actually be, or whether you’d just end up with erroneous results.

Tue Mar 29, 2016 10:09 am

ahull wrote:You might find this interesting. https://www.tablix.org/~avian/blog/arch … oller_adc/

As to the stability of AnalogWrite, I am not aware of any instability, I suppose the best way to check for this would be to compare with a real oscilloscope.

Tue Mar 29, 2016 2:16 pm

rexnanet wrote:
With an overclocked ADC we must keep the 1.5clk on the sample time to allow a proper sampling of the signal.

Tue Mar 29, 2016 9:21 pm

You could modify the SPI DMA transfer to be non blocking, and to generate an interrupt when the transfer is complete, as this would allow the core of the cpu to go off and do other stuff while the spi transfer was happening.

But I dont suppose there is much that the cpu could do while waiting for the spi transfer to finish?

Post a reply

Optional · up to 10 MiB