Detect baudrate fail with Arduino IDE

Hi,

I was able to connect the breakout board of RAK3172 (RAK3272S) to Arduino IDE with RAKDAP1 flash and debug tool. I have connected wires 3V3, GND, and UART2 TX and RX.

I was also able to upload a simple example:

void setup() {
  Serial.begin(9600);

  Serial.println("Setup ...");
}

void loop() {
  while (true) {
    Serial.println("Loop ...");

    delay(1000);
  }
}

However, I am not able to upload another sketch, because the baud rate cannot be detected:

Device is not in boot mode
Detecting baudrate..................
Detect baudrate fail, can not get the baudrate

It is possible that the unnecessary while loop might have some effect, but the microcontroller should be able to communicate the baud rate anyway due to long delay.

Anyway, I decided to try the firmware upgrade tool (1.4) with the latest binary. However, the tool cannot upgrade the chip at all and the process always leads to error message “Device firmware upgrade timeout”.

Do you know how I can access the module and upload a new sketch? I have also tried to set BOOT0 HIGH, but it did not have any effect.

The problem is not related to the USB cable either, because I have tested if RAKDAP1 is connected directly to a computer without any cable and the problem is the same.

Default baudrate for firmware updates is 115200 Baud.
If Arduino IDE has a problem, send AT+BOOT first through the terminal first, then try again. Try to send it with 9600 Baud, but for the firmware upload it should be always 115200.

BOOT0 is not required for “normal” firmware updates, you need it only if you are using STM32CubeProgrammer.

I tested this on two different USB-Serial converters (RAKDAP1 and CP2102). Having Serial initialized at 9600, the firmware upload via Arduino IDE works fine.

Maybe you can try to reupload RUI3 firmware using STM32CubeProgrammer to have a fresh device (slow don’t forget to erase chip before uploading). You will need Boot0 pin to be pulled up here as Beegee said.

I do not understand why you propose another tool, because the documentation includes instructions for pyocd:

The documentation of RAKDAP1 does not even mention STM32CubeProgrammer anywhere.

By the way, those instructions for pyocd include several errors. For example, pyocd cannot be installed with the latest Python (3.12). There is a package which does not support 3.12. Therefore you must use another version. 3.11 seems to work fine.

The following command is not correct:

pyocd erase -t stm32wle5 --chip

0002292 C Target type stm32wle5 not recognized. Use 'pyocd list --targets' to see currently available target types. See <https://pyocd.io/docs/target_support.html> for how to install additional target support. [__main__]

stm32wle5 is not a target type. There are several chips what belong to STM32WLE5 family. However, I tried to install the default firmware with all possible targets:

pyocd flash -t stm32wle5c8ux RAK3172-E_latest_final.hex
0002224 C No ACK received [__main__]

pyocd flash -t stm32wle5cbux RAK3172-E_latest_final.hex
0002723 C Unexpected ACK value (0) returned by probe [__main__]

pyocd flash -t stm32wle5ccux RAK3172-E_latest_final.hex
0002039 C No ACK received [__main__]

pyocd flash -t stm32wle5j8ix RAK3172-E_latest_final.hex
0001987 C No ACK received [__main__]

pyocd flash -t stm32wle5jbix RAK3172-E_latest_final.hex
0002815 C No ACK received [__main__]

pyocd flash -t stm32wle5jcix RAK3172-E_latest_final.hex
0002909 C No ACK received [__main__]

pyocd flash -t stm32wle5u8yx RAK3172-E_latest_final.hex
0002353 C No ACK received [__main__]

pyocd flash -t stm32wle5ubyx RAK3172-E_latest_final.hex
0002797 C No ACK received [__main__]

As you can see, none of the targets work at all. I have connected 3V3, GND, SWDIO, and SWCLK according to the instructions. Perhaps something is simply missing?

Could you provide some kind of instructions how to program RAK3172 with STM32CubeProgrammer? I could not find any.

Unfortunately AT+BOOT command does not seem to have any effect. However, I tested the command with another breakout board where I had added a long setup delay. Then AT+BOOT seemed to work perfectly. It seems that I simply has to erase the firmware and upload the base firmware again to make it working.

However, as you can see in another post, pyocd does not work and I am not sure how to do it with STM32CubeProgrammer, because I could not find any instructions. I assume that I should connect both BOOT0, SWDIO, and SWCLK instead of UART TX and RX. I am not sure if the reset is needed. Do you know how to do this?

Hi @samimaisniemi ,

Its good to hear you have some progress on another board. I will recommend you flash a fresh RUI firmware.

Regarding STM32CubeProgrammer, I am resending here the guide - STM32CubeProgrammer Guide for RAK Modules | RAKwireless Documentation Center. This guide is also on the documentation of RAK3172 - RAK3172 Module Quick Start Guide | RAKwireless Documentation Center

Although pyOCD should work on any ARM based chip, when it comes to STM32 devices, I personally find STM32CubeProgammer more reliable (ideally since this is a native tool created by ST itself). I am using it regularly however with CP2102. It is having issues on my RAKDAP1 being used as UART-USB converter and I haven’t figured out yet why it wont work.