Hello,
I am using stm32h7b3i-dk for the UI and wanted to communicate it with ESP32 S3 N16R8 via SPI2 . I am encountering some issues, as I don 't know how to properly enable it without breaking the UI.
I have tried editing files manually, opening the generated .ioc file, enabling SPI2 , and generating code, but that only ended up deleting some necessary files, and the project stops compiling. How can I make this work?
Welcome J. from your info hard to say, but normal STM project created in MX and use user parts of code as required, can be regenerated many times. But one failure and this dont work. Then try be specific …
Except for what you require next 2 cores and next WiFi ?
Hello, I am planning to create a master–slave connection between an STM32H7B3I-DK (master) and an ESP32 (slave), where the ESP32 handles the main application logic and variables, and the STM32 reads, displays, and modifies them. I do not have any other use for SPI2 besides exchanging this information.
I am not sure if I am doing this correctly, but I am treating the files generated by “Generate Template Files” as the main project files, and then trying to enable SPI2 in CubeMX by opening the generated .ioc file. While doing this, I enabled the options “Keep User Code” and “Generate peripheral initialization as a pair of .c/.h files per peripheral”.
However, this does not help. Regenerating code from CubeMX still deletes or overwrites necessary files, and the project no longer compiles.
Hi Johnny, this usually happens because regenerating the SquareLine template project in standalone CubeMX can overwrite/remove files that SquareLine/LVGL needs, so the project stops compiling.
Recommended approach:
Open and edit the .ioc inside STM32CubeIDE (integrated CubeMX), not in standalone CubeMX.
In CubeMX Code Generator, keep “Keep User Code” enabled and avoid any “delete/clean previously generated files” options if present.
Enable SPI2 carefully (no pin conflicts with display/touch/SDRAM), then generate code.
Put your SPI logic only in USER CODE sections or in a separate app_spi.c/.h file so regeneration is safe.
If it still breaks: generate SPI2 in a small separate CubeMX project and manually copy the MX_SPI2_Init() / hspi2 init into the SquareLine project.