STM32 Oscilloscope
From ScienceZero
Contents
- 1 Pinput
- 2 Features
- 2.1 Vertical (Voltage/Frequency)
- 2.2 Horizontal (Time)
- 2.3 Trigger
- 2.4 Auto Scale
- 2.5 Metered values
- 2.6 Markers
- 2.7 Data output
- 2.8 Display modes
- 2.9 Dynamically labelled grid
- 2.10 Pause and scroll back
- 2.11 Protocol decoding
- 2.12 DSP
- 2.13 Log playback
- 2.14 Output and control interfaces
- 2.15 Logic analyzer
- 2.16 Component value testing
- 3 Coding
- 4 Advanced features for the future
Pinput
- PA0 - Channel 1 (ADC0 / TIM2_CH1_ETR / TIM5_CH1 / TIM8_ETR)
- PA1 - GND
- PA2 - Channel 2 (ADC2 / TIM5_CH3 / TIM2_CH3)
- PA3 - GND
- PA4 - Signal generator 1 (DAC_OUT1)
- PA5 - Signal generator 2 (DAC_OUT2)
- PA6 - GND
- PA7 - External trigger 1 (ESPI1_MOSI / TIM8_CH1N / ADC12_IN7 / TIM3_CH2)
- PA8 - External trigger 2 (USART1_CK / TIM1_CH1 / MCO)
- PA9 - RS-232 (USART1_TX / TIM1_CH2)
- PA10 - RS-232 (USART1_RX / TIM1_CH3)
- PA11 - USB (USART1_CTS / CANRX / TIM1_CH4 / USBDM)
- PA12 - USB (USART1_RTS / CANTX / TIM1_ETR / USBDP)
- PB0-PB15 - Logical analyzer
- PC0 - Voltmeter 1 (ADC10)
- PC1 - Voltmeter 2 (ADC11)
- PC2 - Voltmeter 3 (ADC12)
- PC3 - Voltmeter 4 (ADC13)
- PC4 - Voltmeter 5 (ADC14)
- PC5 - Voltmeter 6 (ADC15)
- PC6 - PWM 1 (I2S2_MCK / TIM8_CH1 / SDIO_D6)
- PC7 - PWM 2 (I2S3_MCK / TIM8_CH2 / SDIO_D7)
- PC8 - PWM 3 (TIM8_CH3 / SDIO_D0)
Features
Vertical (Voltage/Frequency)
- V/Div
- AC/DC
- Offset
- Invert
- Probe divider / multiplier
Horizontal (Time)
- T/Div
- Offset
Trigger
- Voltage level trigger
- Trigger on rising / falling edge
- Single trigger / force trigger / trigger continiously
- Auto detect and track trigger level
- Trigger at fixed frequency / Trigger output
- External trigger
- Pretrigger (sample continiously then stop n samples after the trigger)
- Filtered trigger (low frequency / high frequency / number of pulses)
- Video trigger
- RS-232 trigger
Auto Scale
- Voltage
- Period
Metered values
- Voltage
- True RMS
- Average
- Peak
- Peak to peak
- Frequency
- Duty
Markers
- Voltage
- t1
- t2
- delta t
- frequency
Data output
- Save display snapshot to picture
- Save display frames for movie
- Save wave data to file (raw / .CSV)
- Stream non interrupted wave data to file
Display modes
- Waveform
- range (old oscilloscope method)
- Average per sample
- Average per waveform
- XYZ
- Fourier transform
- Spectrum
- Average spectrum
- Subtract average
- Spectrogram
- Turtle - Channel A = speed, Channel B = direction
- TV (pixel brightness)
- Histogram
- Roll mode (continuous scrolling)
- BPM mode for heart rate monitoring
- wide range of scroll rates
- dynamically zoom in to check on activity of extremely slow rates
Dynamically labelled grid
Pause and scroll back
Protocol decoding
- RS-232
- TTL RS-232
- IR remotes
- I2C
- SPI
DSP
- Pre-scale before process
- Add channels
- Subtract channels
- Multiply channels
- AM demod
- FM demod
- Configurable bandpass filtering
- Phase tracking hum removal
- Audio output
Log playback
Output and control interfaces
- Computer via RS232
- Computer via Wireless RS232
- LCD touch screen
- Computer via USB
Logic analyzer
- Multichannel
Component value testing
Coding
Limits
- The three A/D converters are 12 bits
- Maximum guaranteed clock frequency is 14 MHz, giving 1 MHz sample rate
- Maximum possible with a 8 MHz crystal is 12 MHz
- Two ADCs can be run in interleave for (12 / 14) * 2 = 1.74 MHz (highest guaranteed sample rate)
- Maximum ADC clock rate at 72 MHz system clock is 36 MHz giving (12 / 14) * 2 = 5.14 MHz
- Maximum system clock is 128 MHz giving a theoretical maximum of 9.14 MHz by overclocking everything
- System memory is 64 KB
Protocol
One byte for each symbol, most significant byte first: C SS DDD... C = Command S = Size D = Data
Commands PC → STM32
- 0 0 4 DDDD - Set sample rate in Hz
- 1 0 5 D DDDD - Trigger mode & voltage
- 2 0 1 D - Input type 0=DC, 1=AC, 3=frequency
- 3 0 4 DD.DD - Probe gain
- 4 0 1 D - A/D gain (number of bits to shift right)
- 5 0 1 D - Number of channels
- 6 0 2 DD - Set pin state of a 16 pin port
- 7 0 4 AAAA - Read data from address
- 8 0 8 AAAA DDDD - Write data to address
- 10 0 4 AAAA - Execute address
- 253 - Send next packet of samples
- 254 - Reset
- 255 - Stop and listen
Commands STM32 → PC
- 0 SS D D... - Sample data, 8 bit unsigned
- 1 SS HL HL... - Sample data, 8 bit unsigned, H = highest value during the sample period, L = lowest value during the sample period
- 2 SS DD DD... - Sample data, 16 bit per sample
- 3 SS DD DD... - Pin state from one 16 pin port
- 4 0 4 DDDD - Return data from address
- 255 - Ready
Advanced features for the future
- Realtime view and control over IP by another computer
- iPad/IPhone view and control
- Web interface
- VGA output