2023-08-15 08:14 AM
I am familiar with the STM32 MCU:s and now I try to learn some around the Linux MPU:s.
I am looking for a simple pheripheral application example on how to control e.g some GPIO:s from inside Linux using the STM32CubeMX and STM32CubeIDE.
Any hints?
Thanks
2023-08-15 11:48 AM
Hello @Southbranch ,
First of all, welcome in ST MPU product family.
I will try to make a brief answer, the ST MPU wiki is your best friend here. For all the different IPs provided by STM32MP13, you will find different article to explain the global architecture of this last one; how does the kernel interacts with the hardware; which driver is used and so on. But also, how you, at user space, you can use these different features.
If I take your GPIO example, let's refer to the right wiki article here. It will provides a lot of useful information about how you can take control of GPIOs in userspace. Please, take also care about other GPIO article, to see how some GPIOs can already be reserved to some IPs for other usage (this is declared in the device tree).
Now, let's talk a little bit about the tools. In MPU world, tools are a little bit different in comparison with what you could have seen in MCU world. For example, on STM32MP13, we do not have Cortex-M (MCU), so CubeIDE is not really used. As another example, STM32MP15 has 2 Cortex-A7 but also a Cortex-M4. In this context, we use CubeIDE to program the firmware that will run on MCU cortex.
As concerns CubeMX, it will be used to configure all the different IPs, the pins associated to these IPs, and will generate you the board device tree at the end (The board device tree describes all the HW at board level). The other type of device tree is the SoC device tree, that will only depends on the SoC, and so does not need to be changed.
I illustrate this with an example, let's take 2 persons that will use the STM32MP135 SoC as their MPU, but 1 will use the discovery board that ST provides as example (the STM32MP135F-DK board), and the other one will make its own custom board around the SoC. Both will have the same SoC device tree (stm32mp135.dtsi), but will have different board device trees. The first one will have a board device tree provided by ST for the disco board (stm32mp135f-dk.dts). The other one will use the board device tree generated by its CubeMX tool, depending on the configuration he gave for its own custom board.
I hope all this information will help you to go forward with ST MPU.
Kind regards,
Erwan.
2023-08-18 06:10 AM
Hi Erwan!
Many thanks for reaching out with your elaborative answer to me as a beginner in the Linux world.
Yes, I understand the STM32MP135 only has Cortex A7. But is there a “best practice procedure” to update pin configurations in STM32CubeMX, then apply necessary code in the Linux’s Main.c and finally, compile and debug such application using STLINK? (e.g. configure GPIO:s, I2C, UART etc)
Any additional tutorial other then the one you linked to?