All projects

EMBEDDED / UCT · EEE3096S / 2023

Signals, timing and the physical world

Connect waveform samples to hardware timing: collaborative STM32 work with timer-triggered DMA, PWM and analogue-input control.

CSTM32DMAADC / PWM

UCT / COURSE CONTEXT / 2023

EEE3096S · Embedded Systems II

Embedded architectures, firmware/software stacks and system modelling. The practicals shown here focus on peripherals and signal generation.

Engineering & the Built Environment handbook · 2023

ENGINEERING PERSPECTIVE

Inside the work

Use hardware timing and data movement to produce a repeating output without writing a CPU-driven sample loop. The work links discrete waveform tables to microcontroller peripherals and physical-interface constraints.

Embedded C / STM32
Configure registers and interrupt-driven peripheral behaviour.
Timers / DMA / PWM
TIM2 events transfer lookup values into TIM3 CCR3; related practicals connect ADC input and LCD interaction.
STEP 1 / 3

Choose a table

Select the submitted sine, sawtooth or triangle sample array.

Source-derived walkthrough

What it is

Embedded practicals exploring waveform generation and analogue-input control on a microcontroller, with LCD and interrupt interaction.

Why it was built

Understand how microcontroller timing and data movement produce a physical output without a CPU-driven sample loop.

My contribution

Collaborative practical by Azhar Abdool and a named partner, supported by the hand-in. The report does not divide peripheral/module ownership, so no sole-author claim is made. ST vendor headers retain their separate terms.

How it works

A timer-driven DMA transfer writes waveform lookup-table values to the PWM compare register. A related practical samples ADC input and updates PWM behaviour.

  1. 01Waveform LUT
  2. 02Timer trigger
  3. 03DMA
  4. 04PWM compare register
  5. 05Signal output

Technical implementation

  • The source defines 201-sample sine, sawtooth and triangular lookup tables and a nominal 8 MHz timer clock / 10 Hz signal configuration.
  • TIM2 output-compare events request DMA transfers from the selected table into TIM3 CCR3, changing the PWM duty cycle.
  • An external-interrupt handler switches tables and updates the LCD. The related ADC practical demonstrates input-dependent PWM control.
  • The supplied excerpt contains line-wrapped numerical literals and lacks board/HAL/LCD dependencies. The plot repairs whitespace only for documentation; it is not a rebuilt firmware or oscilloscope trace.

A peripheral, made visible

STM32 / SIGNAL DESK

SOURCE-DERIVED MAPPING
ADC RAW20480–4095
TIM3 / CCR324005ARR 47999
PWM DUTY50.0%Ideal output
IDEAL PWM / FOUR PERIODSNORMALISED TIME
CCR = (adc_value * (47999 + 1)) / 4095

Portfolio simulation of the submitted mapping, not live STM32 hardware. Ideal PWM, not an oscilloscope trace. Source: ADCtoCCR and TIM3 configuration. At maximum input CCR=48000 exceeds ARR and represents full duty. Nominal carrier: 8 MHz / 48000 ≈ 166.7 Hz, conditional on the documented clock.

Waveform generation / separate practical

WAVEFORM LUTTIMER TRIGGERDMAPWM REGISTER

The separate timer/DMA practical transfers lookup-table values into the PWM compare register. It is not an ADC-to-DMA pipeline, and neither practical is claimed as newly hardware-verified.

Visual evidence

Sine, sawtooth and triangle values reconstructed from the submitted lookup tables
Source-table reconstruction for documentation. Not measured analogue output or a new hardware test.

Results & evidence

  • Original C source demonstrates peripheral configuration and waveform tables.
  • Separate practical source documents ADC sampling and PWM control.

Engineering challenges

Peripheral clocks, sample cadence and destination registers must align. Blocking delays inside an interrupt handler and DMA restart behaviour deserve review.

Scope & limitations

Source excerpt only. Original board headers, HAL/startup/linker files and LCD support are missing from the selected folders. Hardware execution and oscilloscope measurements were not performed during cleanup.

What I learned

Timer-triggered transfer, interrupt behaviour and the relationship between numerical samples and PWM hardware. Additional collaborative hand-ins corroborate SPI memory commands and the ADC/TIM3/LCD peripheral exercise; neither is a new hardware retest.

What I would improve now

Recover the exact board project and vendor licence, replace blocking ISR delays with deferred state changes, validate DMA mode and measure the actual output on hardware.

NEXT PROJECTOS scheduling: Andre the Barman