Skip to content
CEC Semester Twenty 2021

Raspberry Pi RP2040 Bare-Metal Programming

Fred Eady -
Owner, EDTP Electronics Inc. and Principal Engineer, Ongoing Systems LLC.
July 26,
2021
Clocking the RP2040
The RP2040 houses a number of clocks and associated PLLs that must be configured and properly started. In today's lecture we will assemble some RP2040 hardware and use Embedded Studio to create and code an RP2040 project to enable the RP2040's internal clocks. We will verify the success and accuracy of our clock-enable code using a Saleae Logic Pro 16. Once all of the RP2040 clocks are up and runningwe will write some code to enable the RP2040's SysTick timer. Enabling the SysTick timer will allow us to implement delayswhich we will use to drive a square wave out of a GPIO pin and subsequently blink an LED on the Raspberry Pi Pico.
Course Resources
Special Educational Materials
What to Know About the Raspberry Pi 4 - Blog
Intro to TensorFlow Lite Part 3: Speech Recognition on Raspberry Pi Digi-Key Electronics - Video
How to Use Raspberry Pi as a Web Server - Blog
July 27,
2021
Enabling the RP2040 UART
The RP2040 documentation tells us that using the custom RP2040 MicroPython build along with the MicroPython SDK eliminates the need for the programmer to consult the registers area of the RP2040 data sheet. Since we are not coding with MicroPython or the MicroPython SDKwe will depend on the RP2040 data sheet to guide us through bringing up one of the RP2040's UARTs. Not only will we breathe some firmware life into an RP2040 UARTwe will also code a buffered UART receive interrupt routine to support the UART hardware.
Course Resources
Special Educational Materials
What to Know About the Raspberry Pi 4 - Blog
Intro to TensorFlow Lite Part 3: Speech Recognition on Raspberry Pi Digi-Key Electronics - Video
How to Use Raspberry Pi as a Web Server - Blog
July 28,
2021
Enabling the RP2040 SPI Portal
Once again we will dive into the RP2040 data sheet to craft some code that will enable one of the RP2040's SPI portals. Today's ultimate goal is to activate some RP2040 SPI hardware that will drive a TFT display. Againwe will use the Saleae Logic Pro 16 to verify the SPI portal's operation. Once we are satisfied that our SPI portal is ready to gowe will attach a TFT display and code a TFT driver to support the display.
Course Resources
Special Educational Materials
What to Know About the Raspberry Pi 4 - Blog
Intro to TensorFlow Lite Part 3: Speech Recognition on Raspberry Pi Digi-Key Electronics - Video
How to Use Raspberry Pi as a Web Server - Blog
July 29,
2021
Coding an RP2040 Weather Node
The RP2040 is not equipped with an on-chip data radio of any kind. Sowe will take advantage of our newly enabled UART and use it to add XBee data radio capability to our RP2040 hardware. In today's lecture we will use the XBee data radio to glean data from my home-brewed backyard weather station. The data that will be received by the XBee data radio will flow into the RP2040 UART we enabled earlier. We will write a routine to process the incoming weather data and display it on the TFT display that is attached to one of the RP2040's SPI portal.
Course Resources
Special Educational Materials
What to Know About the Raspberry Pi 4 - Blog
Intro to TensorFlow Lite Part 3: Speech Recognition on Raspberry Pi Digi-Key Electronics - Video
How to Use Raspberry Pi as a Web Server - Blog
July 30,
2021
RP2040 PIO Primer
The RP2040's PIO state machines are unique to the RP2040. Todaywe will use CLion to build an instance of the pioasm applicationwhich runs on a personal computer. The pioasm application is used to assemble PIO assembler source code that is used to drive the RP2040's PIO state machines. We will write some PIO assembler code and process it with pioasm. The file produced by pioasm is ultimately loaded into the PIO state machine's execution memory. We will write the C code that will place the assembled PIO state machine code into executable memory and start the execution of the code within the state machine.
Course Resources
Special Educational Materials
What to Know About the Raspberry Pi 4 - Blog
Intro to TensorFlow Lite Part 3: Speech Recognition on Raspberry Pi Digi-Key Electronics - Video
How to Use Raspberry Pi as a Web Server - Blog
Instructor
Fred Eady
Owner, EDTP Electronics Inc. and Principal Engineer, Ongoing Systems LLC.

Fred Eady is the owner of EDTP Electronics Inc. and is the principal engineer at the Georgia branch of Ongoing Systems LLC. EDTP Electronics was established in 1988. In the meantime, Fred has written thousands of magazine articles. He has written for all of the major electronic magazines, including Radio Electronics, Electronics Now, Nuts and Volts, Servo, MicroComputer Journal, and Circuit Cellar. Fred has even done a few short feature articles for Design News. To date, he has authored four books and contributed to a fifth. He currently works as a PIC microcontroller consultant and is a Microchip Authorized Design Partner. Fred’s expertise also extends into the ARM community where he is a hardware and firmware design consultant. His customers include aerospace companies, machine shops, specialty startup companies, medical machine manufacturers, coin-operated device businesses, and various other research and development companies. He has a very close working relationship with Microchip Technology, the manufacturer of PIC microcontrollers, and has taught multiple Ethernet and WiFi classes at Microchip's annual Masters Conference.