BB-STM32WL and Platformio/Arduino and STM32LoRaWAN

Started by winfried, February 17, 2026, 07:28:38 PM

Previous topic - Next topic

winfried

For a project, I wanted a private LoRa Network with many of these.

I managed to develop it with the LoRa-STM32WL-DevKit using cmis-dap and also debug and also program it via Serial Device (ESP-Prog), using PA10, PA9 pins, boot button and reset. (note: a newer stm32flash app was needed)

In both cases the serial output always is monitored on LPUART1 TX = PA2, RX = PA3.
(Any hints how I can route to PA9/PA10 are welcome).

see https://git.iem.at/ritsch/pfb-bees.git -> experiments/03-basic
(mostly from the examples form the STM32LoRaWAN library.)

see platformio.ini there.


The main issue: I can send a package but don't receive ones and stuck.

Since I am not an LoRa expert maybe one LoRa-wizard can help me here.
Maybe I miss an additional initialization needed and how can I test/measure if something is really transmitted ?

mfG
 Winfried
---- Atelier Algorythmics --- [url="http://algo.mur.at/"]http://algo.mur.at/[/url] ----

LubOlimex

It might be better to directly contact the author of the project.
Technical support and documentation manager at Olimex

winfried

Thanks for answering and sorry for the misunderstanding, I am the author of pfb-bees and use STM32LoRaWAN from author STMicroelectronics.

Since LoRa arduino Lib does not support the STM32WL5xx, I choose the one from STMicroelectronics, which supports it. Any other suggestion is welcome.

Maybe with this community we can get a working example, for this educational project, here the questions:

Not being a LoRaWan expert:

Is it possible to make a local Network between all devices without a LoRaWan gateway ?

Are additional settings are needed for the Olimex Board BB-STM32WL with the board configuration `olimex_wle5.json` recommended by Olimex for platformio ?
---- Atelier Algorythmics --- [url="http://algo.mur.at/"]http://algo.mur.at/[/url] ----

LubOlimex

#3
Oh.

About getting the serial over PA9/PA10 instead of PA2/PA3 it should be purely software effort to also use them as output. In PlatformIO it should be as simple as switching from Serial to Serial1 I guess. Looking into your platformio.ini first make sure to comment out line 30 (it forces the usage of the CDC pins):

-DUSBD_USE_CDC

and uncomment this line 34:

;-DSERIAL_UART_INSTANCE=1

Maybe do some minimal test:

void setup()
{
    Serial1.begin(115200);
}

void loop()
{
    Serial1.println("USART1 on PA9/PA10 working");
    delay(1000);
}

if that doesn't work, maybe Serial1 is not defined at all, add it and force it:

HardwareSerial SerialPort(PA10, PA9); // RX, TX

void setup()
{
    SerialPort.begin(115200);
}

void loop()
{
    SerialPort.println("Forced USART1 mapping");
    delay(1000);
}

It should be possible to connect devices peer-to-peer but it won't be LoRaWan, just LoRa peer-to-peer... After manufacturing we test these devices in a similar way - we connect two devices that send some PING-PONG data between each other.

The json was provided by a customer, who struggled to find PlatformIO config, he also wrote "Bear in mind that I tested it only with the arduino framework (see frameworks section, not cmsis nor stm32cube)".
Technical support and documentation manager at Olimex

winfried

Thank you for the hints,

ad serial monitor for debugging:

; -DSERIAL_UART_INSTANCE=1
This was used to get get the Serial output to cmis-dap using Devkit, since it registers also a /dev/ttyACM0 and didn't work, but maybe it switches to PA9 and PA10.

I want to avoid the approach in Code, since I want the same source code for "cmis-dap" and "serial programming", but it is a solution if others fails.

Also for "STM32flash" there are options to handle boot and reset, with "dtr" and "dtc" pins with your ESP-PROG, (so I can make a dev connector on my board):

  ...
 -i GPIO_string  GPIO sequence to enter/exit bootloader mode
            GPIO_string=[entry_seq][:[exit_seq]]
            sequence=[-]n[,sequence]
 -R      Reset device at exit.
 ...

I will try this and report back here on this post.
---- Atelier Algorythmics --- [url="http://algo.mur.at/"]http://algo.mur.at/[/url] ----

winfried

ad LoRa versus LoRaWAN

Yes you are right, thanks.

I misread the help at the "modem.joinABP(...)", where it states is does not need for data exchange the connection with the gateway, but it seems it needs a gateway for join process, so it does not configure the device same channels etc...

I hoped I can use the middleware interface of STM32LoRaWan lib from STM for P2P, but this is not documented enough without a ton of read and the AI pointed me in the wrong direction confusing LoRa and LoRaWan libs ;-).

But I found the RadioLib which supports STM32WLx. I will try to make P2P example working and post it here.
---- Atelier Algorythmics --- [url="http://algo.mur.at/"]http://algo.mur.at/[/url] ----

winfried

FYI:

Quote from: winfried on February 19, 2026, 10:52:50 AMad serial monitor for debugging:

Now got a working setup for a LoRa_STM32WL_DevKit using USB for powering, programming and monitor and parallel a BB-STM32WL over serial port on PA_9 and PA_10,
the
-DSERIAL_UART_INSTANCE=1 did not help.

First Since Serial Monitor of "cmsis-dap" programmer on board is connected on PB_6 and PB_7 to the programmer on the devkit I have to set the pins.

For the Serial connection  I had to set the Pins to PA_9 and PA_10.

Hints:
There is an issue if the 5V of the USB is weak like below 4.95V, programming fails.
and the new naming of the pins need are PA_9 not PA9, also the STM32flash programm of
actual platformio was too old.

; PlatformIO Project Configuration File for LoRa P2P (Peer-to-Peer) Test
; OLIMEX LoRa-STM32WL-DevKit - Direct LoRa communication without LoRaWAN
[platformio]
description = "LoRa P2P Test - Direct device-to-device communication"

[env]
platform = ststm32
framework = arduino

lib_deps =
    jgromes/RadioLib @ ^7.3.0
board = olimex_wle5
build_flags =
    -DUSB_MANUFACTURER="Olimex"
    -DUSB_PRODUCT="BB-STM32WL"
    -DBLINK_PIN=PC_15

; LoRa-STM32WL-DevKit: with built-in USB-to-serial converter for monitoring
; using CMSIS-DAP for programming/Debug.
[env:LoRa_STM32WL_DevKit]
upload_protocol = cmsis-dap
monitor_speed = 115200
build_flags = ${env.build_flags}
              -D PIN_SERIAL_TX=PB_6
              -D PIN_SERIAL_RX=PB_7

[debug]
debug_tool = cmsis-dap
debug_init_break = tbreak setup
build_flags = ${env.build_flags}
              -D PIN_SERIAL_TX=PB_6
              -D PIN_SERIAL_RX=PB_7

; BB-STM32WL program and monitor
; Upload over serial using USART1
;    USART1_RX : PA10
;    USART1_TX : PA9
; set uC to boot mode with nboot=low on reset
[env:BB-STM32WL_serial]
build_flags = ${env.build_flags}
              -DNODE_ID=0x2
              -D PIN_SERIAL_RX=PA_10
              -D PIN_SERIAL_TX=PA_9

upload_protocol = serial
upload_port = /dev/ttyUSB0
upload_speed = 115200
monitor_port = /dev/ttyUSB0
monitor_speed = 115200

The So I can switch between the two devices for testing.
---- Atelier Algorythmics --- [url="http://algo.mur.at/"]http://algo.mur.at/[/url] ----

winfried

#7
FYI,

Quote from: winfried on February 19, 2026, 11:02:19 AMBut I found the RadioLib which supports STM32WLx. I will try to make P2P example working and post it here.

RadioLib is great,
so I got a working LoRa P2P example see
- https://git.iem.at/ritsch/pfb-bees.git -> experiments/05-p2p-radiolib

Thanks for help will be the firmware.

PS.: Is there a git repo for the BB-STM32WL KiCAD file, I can only find the PDF schematic and the KICAD for the LoRa-STM32WL-DevKit.
---- Atelier Algorythmics --- [url="http://algo.mur.at/"]http://algo.mur.at/[/url] ----

LubOlimex

Nice progress.

About the schematic - from what I can see it seems that BB-STM32WL is not an open-hardware design. For boards that are not OSHW we only share the PDF export of the schematic.
Technical support and documentation manager at Olimex

winfried

ok, I overlooked it, anyway thanks for the schematics.

BTW fyi:
I found you are using XTAL so, in radiolib we need to set TCXO_VOLTAGE to 0V, so it runs.
---- Atelier Algorythmics --- [url="http://algo.mur.at/"]http://algo.mur.at/[/url] ----