I have a Discovery kit with the STM32WB5MMG module and want to know if it is supported by PlatformIO, either using the Arduino or STM32Cube framework. I’m asking whether there is any way to use this module with PlatformIO.
While https://github.com/platformio/platform-ststm32/ doesn’t yet have a board definition for the STM32WB5MMG discovery kit (“DK”), you can create one for it and add it to the project.
I’ve created a test project for the board and the Arduino framework at
https://github.com/maxgerhardt/pio-stm32wb5mmg-test
Can you test whether it compiles and uploads? It should blink the onboard LED and print stuff on on the serial. The Arduino core supports that board through STM32WBxx/WB5MMGH/variant_STM32WB5MM_DK.cpp.
If that works, the board definition can be added to platform-ststm32.
Compiling for the STM32Cube HAL is not yet possible because PlatformIO is missing the framework-stm32cubewb
package which has the files.
Thanks for your reply.
The example project [pio-stm32wb5mmg-test] (GitHub - maxgerhardt/pio-stm32wb5mmg-test) works perfectly on my [STM32WB5MMG Discovery Kit] (https://www.st.com/en/evaluation-tools/stm32wb5mm-dk.html), including Serial output. This confirms that the board definition can be added to platform-ststm32
. I also plan to use other peripherals like SPI, LPUART, and I2C — do this work in the Arduino framework as well?
Yes, those are well-supported in the STM32 Arduino core. For SPI, use the SPI
library, for I2C, use the Wire
library, for LPUART
, use the Serial
library (object).
See documentation at
https://github.com/stm32duino/Arduino_Core_STM32/wiki/API#built-in-library
You can see all the pin mappings and their associated peripherals at
so for example, PC1 (TX) and PC0 (RX) (can) belong to LPUART1. To use it, you can create a HardwareSerial like
// (on LPUART1) RX TX
HardwareSerial Serial1(PC0, PC1);
void setup() {
Serial.begin(115200); // USART1 (to ST-Link COM port)
Serial1.begin(115200); //is LPUART1
}
void loop() {
Serial1.println("Hello World!"); //on LPUART1
Serial.println("Hello"); // to ST-Link COM port
delay(1000);
}
Similiarly for SPI
and Wire
type objects.