06/17/2020 at 20:46 •
As you know, Raspberry Pi doesn't have native ADC, DAC, CAN Bus controller and other low-level peripherals found in most modern microcontrollers(MCU), such as STM32, Arduino Due, Teensy dev board. Normally this issue is ensured through external modules added to Raspberry Pi board. These are I2C and SPI modules like MCP3008(ADC chip), MCP2515(CAN bus), MCP4725(DAC) and other MCPXXX-like boards.
But if you use an MCU for these purposes you have multiple peripherals at the same time. However, the MCU requires the firmware development, flashing and communication protocol implementation. In this case the code running on the Raspberry computer and the embedded firmware are written separately. Debugging communication problems occur on two completely disparate platforms.
It would be great if our programs running on Rpi can work with MCU's peripherals without firmware development and transferring messages (command) between the board and the computer. As if these peripherals were a part of Raspberry SoC.
Fortunately, Raspberry developers have a tool for dealing with this!
The REMCU Lib provides a way to harness the power of a more powerful machine to run complex processing while using the microcontroller being used to collect data from sensors and execute desired outputs. The library lets your Linux user space programs give access to all peripherals of tethered MCU by remote execution of SDK driver code provided by vendors or 3rd parties.
In essence the MCU’s peripherals become a part of Raspberry SoC like other Raspberry peripherals SPI, HDMI, USB etc.
No need to develop firmware, flash the chip and setup communication. You can just call the peripheral driver functions in C/C++ or Python applications.
In this video, one has shown how to make that. There are basic examples of GPIO control as well as ADC and DAC conversion on STM32
GitHub repo with examples: https://github.com/remotemcu/remcu_examples/
The repository does have the detailed instructions how to install the library and OpenOCD utility or just take the readily available image of Raspbian. As well as it has the examples to work with the ADC, DAC, GPIO and CAN bus controller of STM32 chip from Raspbian environment.
There are available the REMCU Raspberry versions for STM32F103(Blue Pill board too), STM32F0(low-cost MCU series. STM32F030F4P6 the cheapest STM32 costs half a dollar) and STM32F407 microcontrollers to download for now.
I believe this approach can provide the absolute fastest and most flexible way to tackle your experiments, hobbies, and design projects, while reducing equipment costs of high speciality MCPXXX boards.