STM32 with RFM95 bare metal programming

Hi TTN-fellows,

I’d like to design a custom board around some STM32 chip, one of STMicro’s mainstream MCUs such as the STM32F103C8, which is used for the blue pill should do.

I am now wondering: Can I manage to get the STM32 working with the latest LMIC library:
LMIC Github Repo

There are tutorials that describe how to flash the Arduino bootloader onto the STM32:
Flash Arduino bootloader to STM32

Thank you!

You can, but you’ll have to do a lot of the work yourself when you use a platform that’s not already supported by the library maintainter.

You’d have a much easier time if you used a supported platform like the particular SAMD chip/pinout of the Adafruit feather or the STM32L073 with MCU/radio connections matching the Murata module which combines them in one package. Although the STM32L07x processors are also made by ST they are rather drastically different in all the ways that matter from the old STM32F1xx series you’re contemplating.

Also keep in mind that MCCI LMiC (unfortunately) targets an Arduino platform on top of the hardware which meets some meanings of “bare metal” and violates others. If you want to run it more directly, you’re first going to have to invest a day or two in de-Arduino-ifying the code - at which point you’re also going to be on your own.

You might want to use a fully supported platform without any modifications to gain some experience before you try to do something unique.

You might want to use the “origin” LMIC library: GitHub - mcci-catena/ibm-lmic: The IBM Zurich LMiC codebase
This does not have the arduino adaption layer and contains some hardware support for STM32 controllers already.

Probably not, as that’s ancient and missing a lot of bugfixes to the basic LMiC code that are present only in their Arduino-ified version - the last commit was four and a half years ago, basically before any of the fixes were made.

It would be especially unwise to use it with TTN V3, which really, really, really requires that nodes correctly handle MAC command downlinks.

If you want to start with STM32 and Arduino I suggest to use the newer official ‘Arduino Core STM32’ supported by ST Microelectronics instead of the older core from Roger Clark (rogerclarkmelbourne).

The thing to remember is that if your hardware and complete software setup does not start out exactly the same as someone else’s you’re likely going to run into issues for which no one else can give you comprehensive help.

It’s really advisable to make your first LoRaWan node exactly a supported platform in every detail, and only go your own way once you have some experience of what things are like when they are working correctly.

Exact in every detail means not just STM32, but the exact same STM32 chip with the exact same clock source and radio SPI/DIO pins, not just “Arduino” but the exact same Arduino BSP on the exact same hardware…

Been there, done that, definitely will not do it again.

In 2017 I developed a distributed Air Quality monitoring system using the STM32F103C8 Bluepill and LoRa in response to a competition sponsored by the EPA in the USA.

First, calling this a mainstream processor is like calling the Intel 8080 a mainstream processor. The STM32F1 series dates back to 2007.

During my development I encountered multiple issues with the processor such as limited Arduino core implementation, poor sleep support (wake from sleep was basically a processor reset), poor RTC implementation, primitive read/write to flash capability. All these issues would have been acceptable in their time as that was the state of the art back then. Because of the time constraints of the competition I really had no choice but to stick with the STM32F1 processor for the challenge.

Today, processors like the SAMD are far superior in all aspects. After the competition I switched to the SAMD21 processor and continued developing the platform. This was a much better processor platform for my implementation.

Regarding the LoraWAN implementation, after some initial development, I quickly realized the RFM95 was not the right solution within the time constraints of the project as there was too much work required to get an implementation running in the timeframe required and instead I moved to the RN2903A which meant I no longer had to deal with the low level driver implementation required for the RFM95. Although I currently still use the RN2483/RN2903 I am not satisfied with them as it means I need a different hardware/software combination depending on where in the world these are deployed

In my initial and current shipping implementation, a single processor does all the work however my next generation solution under development splits the radio subsystem out and, as one option, I am considering the STM32 variant that integrates the LoRa radio for the Lora radio subsystem.

3 Likes

That was some helpful input that I first need to filter a bit, I have some experience with programming STM32 with STM32CubeIDE, for convenience using the ArduinoIDE would be faster for prototyping.

I’ll take a look at the SAMD processors and breakout boards from Sparkfun/Adafruit, I’ve seen those previously.

Dragino has also a nice open-source project for an STM32 and their own SX1276 antenna frontend design (I think it is their own):

It has a good support base but Arduino is not included, I don’t consider it as a super must for my project…better invest the time in learning something new.

Neither STM32 nor SAMD are processors.

They are processor families or in a more practical sense brand names. The individual members of those families are often so distinct as to be in some practical ways more similar to members of the other family than they are to many other members of their own.

Both families include members with a wide range of approaches to basic questions, so please don’t make broad statements about a brand, but rather specific statements about a particular device type.

One must also be careful to keep in mind the distinctions between the hardware itself, vs those that follow from one’s own decisions about how to utilize the hardware, which if any libraries to utilize, which modes to operate the hardware in, etc.

Not sure where you are coming from. The original post and my response was specifically referenced the STM32F103C8 and more specifically we both referenced the Bluepill implementation. The STM32F103C8 is a specific instance of a processor family and it is a processor. Perhaps you should reread the posts?