Hardware/software projects
2024 - ...
rp2350
rp2350 Microcontroller
programming using C-SDK
In most cases, the following links drop back to the existng 2040 pages,
until the course switches to the 2350.
Code specific to 2350 is linked here for now.
Note: When using protothreads, it appears that there needs to be a 10 mSec sleep
inserted in main before the second core is started.
- ece4760 Support
General utilities and information relevant to ece4760 at Cornell.
All examples and student code are written using the Protohreads framework for multithreading.
- Protothreads 1.3 (written by Adam Dunkels) to be used 2025
The port to the rp2040 also works with rp2350. The basic protothreads scheme is extended for two cores with support for hardware locks, core-safe semaphores, and core-to-core hardware FIFOs. Protothreads provides a simple, cooperative, thread environment with very fast context switch and low memory overhead. Modified thread dispatcher implements priority scheduling in addition the default round-robin. The code linked below is the full demo with, locks, semaphores, FIFO and both cores running,
rp2350 codeand demo ZIP.
- Visual Studio configuration.
Configure VS for editing, programming, debugging using the Pi Debug Probe.
Refer to VScode extension
and the getting started guide.
- Add program/reset button
A trivial hardware and software addition simplifies programming.
Superceded by using the debugger.
- Graphics
The rp2350 has twice the memory, so there is space for more VGA graphics modes.
There are three changes necessary to port the VGA driver to rp2350. The VGA Hsync and Vsync
PIO programs must have the clock dividers changed from 5 to 6 to account for the faster
system clock (150 on rp2350 vs 125 on rp2040). The RGB PIO program pixel delays need
to extended one cycle/pixel, again for the system clock change.
- Arithmetic Systems
The rp2350 has hardware floating point instructions, as well as an improved integer multiplier and divider.
The integer multiplier now produces a full 64 bit result from a 32x32 multiply. This speeds up the fixed point multiply by about a factor of 5. Some test programs attempt to estimate the speed of the operations.
- =====================================================================
- =====================================================================
- >>> Material below is still being edited <<<
- Graphics
Graphics input and output using 640x480 VGA, with optional joystick or encoder wheel.
Mouse interface is also shown in the USB section.
The serial interface is not really graphics, but plays around with color and formatting.
- External Memory
Everyone needs more memory. FRAM works well for simple files with bandwidth
requirments below about 1.5 Mbyte/sec.
SD card with FatFS has a larger program size overhead, but is compatable with PC read/write of huge files.
USB FLASH drives are exzplained the the USB MSC example below.
- LWIP on PicoW
LWIP is the supported TCP/IP stack for the PicoW.
LWIP has lots of options and somewhat limited documentation.
This section has lots of examples to exercise some of the options.
Opotions include bringing up the PicoW as an WIFI access point or WIFI station and
data transfer by UDP or TCP.
- TCP protocol
- Network Time Protocol
- UDP protocol
- Symmetric send/receive between two picoWs (access point to station)
Each picoW can send or receive packets.
The code running on the two nodes is almost identical.
- Audio-rate UDP from picow to picow (access point to station)
Sending real-time data from picow to picow with no router involved.
- Data array UDP send/receive (station to station thru hotspot)
Sending an array of data allows performance testing as well as understanding of data sizes, and dealing with packet efficiency.
- UDP send/receive from desktop (station to station thru hotspot)
UDP
protocol is a simple and fast, but does little error checking. It is therefore useful for data streams where a bad value is not a show stopper. You might send music but not code.
- UDP send/receive pico-to-pico. (station to station thru hotspot)
A simple scheme for figuring out IP addresses on the fly allows two picos to send data to each other.
- USB on Pico
USB uses the tinyUSB implementation and is fairly big.
There are lots of ways to use it. Examples are your friend.
- Amusing (to me) computational projects
These may have little general appeal, although the DMA computing machine could be a co-proessor.
- DMA computing machine.
The DMA subsystem is capable of running a compute-universal system.
This implementation uses three channels for fetch/execute, and a list of DMA control blocks as a program.
- Random number generation.
Using the ROSC to make reasonable quality random numbers. Routines for integers, fixed-point uniform and normal distributions, and for single bits.
- Lattice-Boltzmann fluid flow simulation
A strange hybrid of finite difference and cellular automaton using fixed point arithmetic for speed. The fixed point system used is s1x25. The shorter, and faster, 16-bit fixed point did not have enough precision for stable solutions.
- 16-bit floating point,
with similar bit layout to the IEEE standard FP16, but without infinities or NANs. The reason for doing this annoying exercise is to see if ODE solvers run faster in limited precision floating point than in fixed point. The 16-bit floats have a dynamic range similar to s15x16 fiexed point, but are not faster then standard 32-bit floats.
-
- DSP
More numerical flogging of the M0 architecture, with an emphisis on speed using 16-bit fixed point.
The IIR and FIR sections use design implementations which run completely in C on the the M0, at the
cost some slightly non-optimal designs.
- IIR filter designer
Using s1x14 fixed point format. Lowpass, bandpass, and highpass filters design. Plots the Bode plot of the designed filter, and allows the new filter to be used in realtime for audio input.
- FIR filter designer
Using s1x14 fixed point format. Lowpass, bandpass, and highpass filters design. Plots the Bode plot of the designed filter, and allows the new filter to be used in realtime for audio input. Also a version for linear frequency plots.
- Speech compression/playback from IIR filterbank.
Speech sampled at 12.8 Ksample/sec is sent through 32 MEL-distibuted IIR filters.
The filter powers are sampled every 20 mSec and used to reconstruct speech using DDS.
- FFT and FilterBank spectrograms
FFT compared to lower resolution MEL spectrum
for speech input.
- FFT Spectrogram
Plotting the power spectrum, log power spectrum, and spectrogram of voice signals. The spectrogram actually has enough info to decode what is being said.
- DSP development
IIR filters in fixed point s7x24 format. Butterworth lowpass and bandpass filter.
- Sound Synthesis
Since we can do DSP, can we use it to make sounds we might actually want to listen to.
FM synthesis is very 1970's synth kind of sound.
The Karplus-Strong algorithm actually solves the wave equation on a stirng in realtime to make
physically reasonable stringed instrument sounds.
- FM synthesis of sounds.
Some FM synthesis even sounds like music. Widely used in the 1970's, '80s, and even into the 90's. for music and sound effects.
- Karplus-Strong strings
Plucked and bowed string physical synthesis. An approximation of the actual PDE of a string.
- PIO
- Using Verilog to understand the rp2040 PIO processors. The Pi rp2040 microcontroller has 8, single cycle, deterministic, Programmable i/o blocks (PIO). Each PIO is programmed using a 9-instruction assembly language. We have been speculationg about how you make a single-cycle machine (including jump). This project attemptes to answer that, without implementing the entire PIO architercture.
- rp2040 PIO control
Experiments to see if modifing the code of a running PIO channel is feasable.
- Implementing a input capture ability.
To emulate the precise time stamp feature found on AVR and PIC32
With two PIO state machines, you can get single cycle capture resolution.
- rp2040 Interpolator hardware
- Weighted average of two audio signals using blend mode.
- Line generator for VGA using blend mode.
- Tone burst generator using clamp mode.
- DDS and FM waveform synthesis using interpolator peripherial and clamp mode.
Copyright Cornell University
November 7, 2024