RAK3172 with third party LoRa libraries in Arduino?

There are a number of LoRa libraries for the SX126X that are for the Arduino environment.

Can these independant LoRa libraries be used with the SX126X within the RAK3172 ?

Presumably the Arduino LoRa library would need to be able to address the SX126X in the RAK3172 via the appropriate SPI port number.

Welcome to the forum @StuartsProjects

As far as I know none of these libraries support the LoRa transceiver inside the STM32WL5E. The LoRa transceiver is not a separate chip but it is inside the STM32 and it is “SX1262 compatible”.

But you can have a look at our RUI3 API, a BSP for Arduino for our RAK3172

RUI3 is an API that makes it easy to develop custom firmware for RAK modules. It handles the complete low level hardware interface and the firmware can be written with Arduino framework style API calls.

It supports the following IDE’s:

Arduino IDE
Visual Studio with Arduino extension
Visual Studio Code with Arduino extension

Here are the links to the documentation and examples source codes:
RUI3 overview: RAKwireless Unified Interface V3 (RUI3) | RAKwireless Documentation Center
RUI3 API documentation: Arduino API | RAKwireless Documentation Center
RUI3 BSP installation guide: RUI3 Supported IDE | RAKwireless Documentation Center
RUI3 BSP examples: RAK-nRF52-RUI/libraries/RUI_V3_examples at main · RAKWireless/RAK-nRF52-RUI · GitHub

Other RUI3 examples:

https://github.com/beegee-tokyo/RUI3-RAK12047-Air-Quality

Thanks for the comprehensive reply.

I had looked a the STM32WL5E datasheet but there is little mention of how to address the LoRa device. However, the Reference manual RM0453 says this about the STM32WL5X ;

Section 5.8 of the reference manual also gives the opcodes used for the access to the radio, and the ones I checked are the same as the standalone SX126X opcodes. So it does look like the STM32 silicon is talking to the (standard ?) SX126X silicon over an internal SPI, it even mentions the Busy pin. So presumably this SPI interface is accessible to other code (libraries) running on the STM32 core.

I could not find where in the rak_rui core the API code was actually talking to the SX126X.

In RUI3 the LoRa transceiver communication is proprietary code and we are not publishing it.

STM did a very bad job with the documentation how to access the LoRa transceiver. You can have a look in their STM32WLE5 example codes for the STM32Cube IDE.

We have some tutorials how to use the RAK3172 with the STM32CubeIDE in our Documentation Center because there are some difference between the RAK3172 and the STM32 developer kit.

But we have no solution for Arduino beside our RUI3.

After studying the reference for a bit, it seems some of the required pins and signals (on the SX126x) are routed and accessed through internal STM registers, meaning a normal Arduino LoRa library would need modifying to access the appropriate signals.

Shame really, routing the SX126X pins to STM GPIOs would seem to be more universal.

Thanks for your time.