RAK11160 - UART interface

Hello,

Hello,

I am planning to use the RAK11160 module in a design where I need to connect multiple UART-based peripherals (for example a sensor using UART and an NB-IoT modem).

I can see that UART2 is exposed for external use, but I am unsure which other UART interfaces are available or usable when running custom firmware (RUI3 or bare-metal on the STM32).

Is it possible to use additional UARTs from the STM32WLE5 or the ESP8684, or are these reserved for internal communication?

What would be the recommended architecture if multiple UART devices need to be connected?
Is it stable or practical to implement software UART on other GPIOs?

Hi @Simonn

Welcome back to forum.

RAK11160 was primarily designed to work with its integrated ESP32-C2 to bridge LoRa packets to internet via MQTT using WiFi with lowest current consumption. Extending this capability to other use cases like UART-based sensors, cellular, etc., entails extra work. If you need WiFi and LoRa with custom functionalities, you can also consider RAK3112 since it has ESP32-S3 in it is definitely more capable for custom use cases than ESP32-C2. It has more features (lots of UART), more memory, etc.

Assuming you will use RAK11160.

STM32WL inside has two UARTS. UART1 is used for communication to ESP32-C2. Your choice if you will attach a UART device is via UART2 but you have to take note that this handles FW update and AT command. You can disable AT command if you need to and use it to your external use case but you have to handle AT+BOOT which is the command that activates bootloader mode. Software UART is not supported in RUI3 unless you will use an external SW serial/bitbang library.

ESP32-C2 (ESP8684) can be more flexble since you use SW serial and use it UART. Bootloader mode of ESP32-C2 is handled via boot pin so you can safely use the UART on custom use case. However Arduino ESP32 doesn’t have a port for ESP32-C2, you have to build its binaries to be able to use it via Arduino. ESP32 IDF development shouldn’t have any issue though.

Hi,

Thanks for the clarification.

Just to make sure I understood correctly:

My use case requires:

  • one UART for a sensor
  • one UART for an NB-IoT modem
  • one UART (or console interface) for communication with a PC

From your explanation, my understanding is:

  • On RAK11160 , only one external hardware UART (UART2) is realistically available on the STM32WL side, and software UART is not supported in RUI3. Therefore, implementing multiple external UART peripherals in a clean and stable way is not practical.
  • On RAK3112 (ESP32-S3) , multiple hardware UARTs and/or software UART can be used, making it suitable for connecting multiple UART-based peripherals simultaneously.

Is this understanding correct?

Just ticking in here with Simon, as we work on the same project.

The ESP32 would only be used as you say as a bridge. The actual sensor logic should run on the STM chip.
We currently use RAK3172, and it’s great, however, we need in the future to be able to have a base board that works with nbiot aswell. Our nbiot module works via uart.

Currently, the sensor is connected to a RAK3172 via uart1 on the RAK3172, and uart2 is used for At commands etc working in RUI3.

We hoped to find a replacement that could still run RUI3, so the power optimizations are baked in together with lora, but where we can connect the NBIOT module to the STM32 directly (or the ESP32, whatever works).

The sensor still runs on UART, and I would assume it is stil lconnected to uart1.

You understood it right @Simonn

Welcome back to forum @kevinals ,

RAK3172 has two hardware UART. I haven’t run a software UART on it but that should be possible. If you really need a 3rd UART, that’s the only route - implement a SW UART.

With the Rak3112, I see no example of low power mode, which is what we need.
Is it made for low power iot? We run on battery, wake up every 6 h and send a packet either via nbiot or lorawan

In the example it doesnt seem to do deep sleep - and as I remember, doing deep sleep with the esp32 means all ram state is gone, so it has to rejoin lora etc

ESP32-S3 is designed for low power application. But keeping the keys persistent is a different topic if your RAM turns off.

At 6hrs wake up interval, you can achieve a very long battery life.

How about considering using RAK3172 as a LoRaWAN modem only then have an MCU that will do all the necessary housekeeping. This might simplify everything and gives you flexibility but with added parts. It is all about trade off - R&D time VS cost VS power consumption VS product size, etc etc.

Well - It does.

Your idea with the 3172 does work, however, ideally we wanted “one” chip (I know its two mcu’s) that we can get on the board from rak, and not have to deal with other stuff. Even if that means the ESP32 is within the RAK3112.

Is the idea with the 3112 not that the STM32 handles lora (and thus, the keys, as in your example with 3172), and the ESP32 can be used only for ble/wifi updates.

We Only want to use esp32 as bridge for future wifi or ble updates.

For now, the stm should handle data

Would the Rak3112 stm not handle Keys in deep sleep?

Which gets me back to

We want to hookup the uart sensor, and uart nbiot to the STM part, and only use esp32 as a bridge if ble or wifi is needed for updates or Remote diagnostic

Only 1 UART is exposed on RAK11160 STM32WL. That is used for AT commands and FW update. You can use disable AT commands and use it for custom use case (just avoid AT+BOOT else it will go boot mode). Still, that is only 1 UART - going to end up on having to implemented SW UART. As for the ESP32-C2, you can use those as well. Essentially, this is design decision you have to make with consideration to what chip/modules to use, development time, cost, etc.