cancel
Showing results for 
Search instead for 
Did you mean: 

Transitioning from ESP32-S3 to STM32: Code Compatibility & Library Usage

Gabrowsk
Associate II

Hello everyone,

I've been diving into the world of ESP32s and Arduinos for approximately 2 years now. My current project focuses on GNSS tracking combined with radio transmission. Initially, I was inclined towards using the ESP32-S3, however, as the project evolved, I find myself inclined to seek a more robust solution with a more powerful MCU, hence my interest in the STM family.

Here's where I'm hitting a roadblock:

Given the significant time and effort I've already invested in developing code for the ESP32, I'm hesitant about starting from scratch. So, my question is:

  1. How seamless is the transition from the Arduino-like programming in C++ (as I've been doing with the ESP32) to programming an STM32?
  2. Can I expect to use most of the libraries created for Arduino? For instance, I'm utilizing Sparkfun's Arduino GNSS library for tracking. Is there a possibility that I can reuse a significant portion of the existing code?

Any insights or experiences you could share would be immensely helpful. Looking forward to your feedback!

1 ACCEPTED SOLUTION

Accepted Solutions
AScha.3
Chief II

ESP32-S3 is a dual-core XTensa LX7 MCU, capable of running at 240 MHz.

> a more robust solution with a more powerful MCU, hence my interest in the STM family?

i dont think so.  Two 32bit risc CPUs at 240Mhz - not easy to beat. 🙂

ad 1. not seamless at all. like jumping into a cold pool.

ad 2. no, you can adapt a lib to use, but this depends on your skills.

 

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

11 REPLIES 11
RhSilicon
Lead

For those who worked only with Arduino software, the transition is not very easy. STM32 usually needs the programmer to understand the hardware as well.

There are 2 Arduino cores for STM32 (C++) (but the hardware may not be fully supported by the core yet). I found it better to use C language with the STM32CubeIDE, it's easier to find examples and help.

To be more compatible with ESP32-S3, see STM32WB series.

To make it easier, read all the documents (each model has specific documents too), even if you can't understand everything (to at least get an idea of where the information is) and there are also many videos on YouTube.

While Arduino users generally use the serial port to debug the program, STM32 has more advanced tools:

STM32CubeIDE Advanced Debug Features

AScha.3
Chief II

ESP32-S3 is a dual-core XTensa LX7 MCU, capable of running at 240 MHz.

> a more robust solution with a more powerful MCU, hence my interest in the STM family?

i dont think so.  Two 32bit risc CPUs at 240Mhz - not easy to beat. 🙂

ad 1. not seamless at all. like jumping into a cold pool.

ad 2. no, you can adapt a lib to use, but this depends on your skills.

 

If you feel a post has answered your question, please click "Accept as Solution".
RhSilicon
Lead

.

Might just be me, but aren't the STM32H5 and H7 kinda beefier than the ESP32? From fixing gadgets, I've seen a bunch of stuff with ST MCUs. Makes me think they might be the go-to if I ever think about selling what I'm working on. Seems like getting into STM32 stuff could be cool. Thanks for the tips, everyone!

I concur with everyone else on this post... It's really not something you should be looking to do, it will take a very long time and can be quite pain staking given the number of years you've already put into the project.

I'm an expert in with the ESP32 (not so much with the STM32) but in any case there might be something that you can do, to keep your current solution workable.

Can you detail more about what you're trying to achieve and what the actual bottleneck is? GPS tracking + BLE / WiFi transmission shouldn't be a problem at all for the Xtensa 240 Mhz CPU's, especially considering it's dual core on the S3.


RhSilicon
Lead

To get the full performance of ESP32 it is more suitable to use ESP-IDF than Arduino IDE.

Yep, Ive given up on re-doing this project on STM32, still think it is a good idea to learning about it though.
About my project:

my design comprises two ESP32-S3 units designated as 'Master' and 'Slave'.

  • Master Unit's Responsibilities:

    • Generate an HTML interface, enabling user-specific GNSS configurations, inclusive of parameters like constellation preferences, navigation rates, and radio transmitter settings.
    • Upon user-defined configuration, a JSON is generated and dispatched to the slave unit.
  • Slave Unit's Responsibilities:

    • Decode and apply the parameters from the JSON to the GNSS module.
    • Monitor the GNSS module for potential errors.
    • Document navigation metrics onto an SD card.
    • Transmit these metrics to a radio module, wherein the radio configurations are also governed by this slave unit.
    • Concurrently, this unit interfaces with a fuel gauge IC via I2C to get info like battery level and charge.
    • extracting data such as Latitude, Longitude, Altitude, GNSS precision, and satellite count from the GPS module.
    • Every 2 seconds, the data is sent to the master unit for display on the user interface.

      One discernible challenge in my current configuration is the ESP32 slave's concurrent recording of data onto the SD card. The GPS module generates a correction dataset named 'RTCM', which necessitates transmission to the radio module. The ideal configuration would be a direct connection between the radio and the GPS module. However, due to the radio's singular UART port, which is requisite for ESP32 interfacing (for configurations like frequency and air data speed), there arises a need for the ESP32 to act as a bridge for the RTCM data from the GPS module reach the radio. This procedure, occurring at 1-second intervals, coincides with SD card data recording, leading to potential bottlenecks, both the data being written on the sd card and the RTCM data are quite large and if the user decides to increase the navegations for something like 2 or 3hz these data would be genereated as much as 2 or 3 times per second.

      honestly I think I made a poor choice of hardware when I started the project and thought about using something like a rasberry pi or orange pi multiple times, but I dont know anything about MPUs or SBCs and also dont know to code on these things.

I'm afraid that, in the long run, you'll be needing to port your code to a new processor anyway.

Espressif has already made comments of shifting from their XTensa cores to RISC-V.

When I was working with 8266s, and ESP32s I found that their version of FreeRTOS had diverged from the distribution a lot and was not being back ported, their code was very fragile (AT command blob), and their support seemed to have moved on from a single 3rd year CS student in Bangalore (for real) to someone in Shanghai that had to save face at every opportunity. How do you report bugs when the company rep must not present the company as ever doing anything, in any way, wrong?

Anyway, good luck with your ESP projects.