STM32 Oscilloscope

From ScienceZero
Jump to: navigation, search
Test signal at 300 kHz sample rate

A cheap but very powerful oscilloscope based on the ET-STM32 stamp module

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 waveform output 1 (DAC_OUT1)
  • PA5 - Signal generator waveform output 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)
  • PA13 - Set/Read probe voltage divider gain 1
  • PA14 - Set/Read probe voltage divider gain 2
  • PA15 - Set/Read probe voltage divider gain 3
  • PB0-PB15 - Logical analyzer 1-16
  • 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)
  • PC9 - PWM 4 (TIM8_CH4 / SDIO_D1 / TIM3_CH4)
  • PC10 - General purpose input/output 1
  • PC11 - General purpose input/output 2
  • PC12 - General purpose input/output 3
  • PC13 - General purpose input/output 4

Features

Vertical (Voltage/Frequency)

  • V/Div
  • AC/DC
  • Offset
  • Invert
  • Probe divider / multiplier

Horizontal (Time)

  • T/Div
  • Offset

Trigger

  • Voltage window 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 RS-232
  • Computer via Wireless RS-232
  • LCD touch screen
  • Computer via USB

Logic analyzer

  • Multichannel

Component value testing

Coding

Limits

  • The two waveform outputs run at the same frequency, 12 bit, 0 - 3.3 V
  • The three A/D converters are 12 bits, 0 - 3.3 V
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 ADC sample rate in Hz
  • 1 0 4 DDDD - Set trigger mode, 0=rising, 1=falling,???
  • 2 0 4 DDDD - Set trigger voltage
  • 3 0 4 DDDD - Set input type, 0=DC, 1=AC, 3=frequency, 4=PWM
  • 4 0 4 DDDD - Set Probe gain
  • 5 0 4 DDDD - Set A/D gain (number of bits to shift right)
  • 6 0 4 DDDD - Set Number of channels
  • 7 0 4 DDDD - Set pin state of general purpose pins
  • 8 n n DDDD - Upload Waveform 1
  • 9 n n DDDD - Upload Waveform 2
  • 10 0 4 DDDD - Set Waveform replay sample rate in Hz
  • 11 0 4 DDDD - Set PWM frequency
  • 12 0 4 DDDD - Set PWM 1 duty cycle
  • 13 0 4 DDDD - Set PWM 2 duty cycle
  • 14 0 4 DDDD - Set PWM 3 duty cycle
  • 15 0 4 DDDD - Set PWM 4 duty cycle
  • 16 0 4 DDDD - Set PWM 1 phase?
  • 17 0 4 DDDD - Set PWM 2 phase?
  • 18 0 4 DDDD - Set PWM 3 phase?
  • 19 0 4 DDDD - Set PWM 4 phase?
  • 20 0 4 DDDD - Set General purpose I/O
  • 64 0 0 - Get Probe gain
  • 65 0 0 - Get General purpose I/O
  • 66 0 0 - Get Logical analyzer value
  • 128 0 4 AAAA - Get data from address
  • 129 0 8 AAAA DDDD - Set data at address
  • 130 0 4 AAAA - Execute address
  • 131 0 4 DDDD - Set baudrate (default 9600)
  • 252 - Start
  • 253 - Send next packet of samples
  • 254 - Reset
  • 255 - Stop and listen

Commands STM32 → PC

  • <Ready> - Has entered StopAndListen mode
  • <Frame> - Sample data to follow

Advanced features for the future

  • Realtime view and control over IP by another computer
  • iPad/IPhone view and control
  • Web interface
  • VGA output