Raspberry Pi Compute Module 5 IoT In C
Using Linux Drivers and Gpio5

Errata none

Program Listings

Resources 

 

CIoTCM5360

 

Buy from: Amazon

The Raspberry Pi Compute Module 5, CM5, is designed specifically to be used in IoT and embedded applications, but differs considerably from other IoT devices you might be familiar with. The key difference is that it has enough power to run an operating system, usually Linux. This makes it ideal for use in complex IoT scenarios requiring access to sensors and actuators and running multiple programs at the same time, but this is made difficult due to a lack of documentation. The problems are exacerbated by the use of the RP1 chip to implement the CM5’s peripherals which means it doesn’t work with the usual IoT libraries such as Wiring Pi, bcm2835, pigpio and so on. This book demonstrates how to interact with the hardware both using Linux drivers, the accepted way of accessing external devices, and via Gpio5, a new open source IoT library specifically for the Raspberry Pi 5 and CM5, that provides direct access to the CM5’s hardware, with functions for working with GPIO, PWM, I2C, SPI and more.

Discovering, installing and using drivers is the topic of early chapters of this book. Having seen how to work with drivers we move on to direct access to the hardware via the Gpio5 library, which is developed and enhanced throughout the book.
Next comes a lightning tour of the electronics needed for simple IoT applications. This is followed by a digression into the Device Tree and overlays, using the DHT22 temperature and humidity sensor as a practical example, before tackling PWM both via a driver and directly using Gpio5. The same treatment is applied to the two standard buses, I2C and SPI and also the 1-wire bus. We then look at two attempts to impose a higher organization, the hardware monitoring system, hwmon, and Industrial I/O, IIO.

We next come to the PIO, the Programmable Input Output, first introduced by the Raspberry Pi Pico, a unique way to interface the CM5 to the outside world without the need to use the CPU. After covering the basics, we look at three examples of the most sophisticated PIO programs you are likely to encounter.
The penultimate chapter takes drivers to the next level, showing you how to create your own custom overlays by writing fragments of the device tree, and the final chapter is about advanced scheduling and dealing with problems encountered in running a real-time system.

Harry Fairhead has worked with microprocessors and electronics for many years and is an enthusiastic proponent of the IoT. C is his programming language of choice and he is the author of Fundamental C: Getting Closer To The Machine and Applying C For The IoT With Linux. His Raspberry Pi books include Raspberry Pi 5 IoT In C: Drivers and Gpio5, the companion volume to this book, Raspberry Pi IoT In C, 3rd EdRaspberry Pi IoT in C With Linux Drivers, 2nd Ed and Programming the Raspberry Pi Pico/W in C, 2nd Ed.

Paperback 

  • Publisher ‏ : ‎ I/O Press (April 11, 2025)
  • Language ‏ : ‎ English
  • Paperback ‏ : ‎ 442 pages
  • ISBN-10 ‏ : ‎ 1871962951
  • ISBN-13 ‏ : ‎ 978-1871962956
  • Item Weight ‏ : ‎ 1.69 pounds
  • Dimensions ‏ : ‎ 7 x 1 x 10 inches

Hardback

  • Publisher ‏ : ‎ I/O Press (April 12, 2025)
  • Language ‏ : ‎ English
  • Hardcover ‏ : ‎ 442 pages
  • ISBN-10 ‏ : ‎ 1871962331
  • ISBN-13 ‏ : ‎ 978-1871962338
  • Item Weight ‏ : ‎ 2.09 pounds
  • Dimensions ‏ : ‎ 7 x 1.19 x 10 inches

Kindle 

  • ASIN ‏ : ‎ B0F4NMXRJN
  • Publisher ‏ : ‎ I/O Press; 1st edition (April 11, 2025)
  • Publication date ‏ : ‎ April 11, 2025
  • Language ‏ : ‎ English
  • File size ‏ : ‎ 7.7 MB
  • Text-to-Speech ‏ : ‎ Not enabled
  • Enhanced typesetting ‏ : ‎ Not Enabled
  • X-Ray ‏ : ‎ Not Enabled
  • Word Wise ‏ : ‎ Not Enabled
  • Format ‏ : ‎ Print Replica