Posts

Showing posts from March, 2024

Microcontroller as Raspberry Pi peripheral

Image
Raspberry Pi Peripheral Sometimes you just need a real-time MCU to control an operation, but you want the full-blown OS capabilities of an MPU as well. There are many ways to handle this situation, but the one I want to discuss here is implementing a slave I2C interface in an MCU which you can use from a Raspberry Pi. Register Access Control of many peripherals involves manipulating and reading registers. Since this is a commonly understood approach, I will show you how to set up register access to your peripheral over I2C.  For your peripheral to be useful, the registers have to be planned out in terms of what functions they trigger and what data they present. That part will be up to you. To standardize and simplify the layout, the approach I present will use 32-bit registers laid out in a simple array, and any individual register can be one of: A read-only register whose value can't be changed from the Pi, A simple write register which can be changed by the Pi but doesn't tri...