RAK3172 Arduino IDE RUI3 uploading problems (2nd time)

Hello, I’m having exactly the same problem as RAK3172 Arduino IDE RUI3 uploading problems - RUI - RAKwireless Forum

Detailed description:

  1. upload a sketch using arduino IDE correctly working
  2. after upload the sketch the device starts and the suddenly stops at some point
  3. trying again to re-upload the sketch won’t work as cannot find the correct boudrate
  4. using ST-LINK and STM Programmer I’m able to unbrick the module re-uploading the original firmware
  5. repeat the process, same result

I have tried different sketchs but the result is always the same.

This is the last one I’ve tried which is a simple I2C scanner:

#include <Wire.h>

void setup() {
  Wire.begin();
  Serial.begin(115200);
  delay(5000);
  Serial.println("\nI2C Scanner");
}
void loop() {
  byte error, address;
  int nDevices;
  Serial.println("Scanning...");
  nDevices = 0;
  for (address = 1; address < 127; address++) {
    // The i2c_scanner uses the return value of
    // the Write.endTransmission to see if
    // a device did acknowledge to the address.
    Wire.beginTransmission(address);
    error = Wire.endTransmission();
    if (error == 0) {
      Serial.print("I2C device found at address 0x");
      if (address < 16)
        Serial.print("0");
      Serial.print(address, HEX);
      Serial.println(" !");
      nDevices++;
    } else if (error == 4) {
      Serial.print("Unknown error at address 0x");
      if (address < 16)
        Serial.print("0");
      Serial.println(address, HEX);
    }
  }
  if (nDevices == 0)
    Serial.println("No I2C devices found\n");
  else
    Serial.println("done\n");
  delay(5000); // wait 5 seconds for next scan
}

Is the module broken? I have other RAK3172 (actually 3372) and I don’t have this problem. We have a BME680 sensor board from RAK itself attached to the WisBase.

Hi @a.occ ,

I will suggest to perform full chip erase using STM32CubeProgrammer then upload the latest .hex firmware of RAK3172 - v4.0.5 at the moment. They will ensure that there is no unnecessary residue in any part of the memory.

If this is done already, maybe you can manual execute bootloader mode using AT+BOOT before uploading the firmware.

image

Hello @carlrowan,
your message just triggered an hint in my head.

I’m trying to use the BME680 module board from WisBlock with the RAK3372. As you may know the BME680 works with the I2C communication protocol. I’ve started experiencing the problem of the first message after the first try of a custom firmware for the BME680. After that I’ve tried an I2C scan sketch after unbrick the module with the ST-LINK and I had the same problem: after Wire.beginTrasmission(address) the module just goes dead and unresponsive also to AT commands. Now I see that if I run the AT+BOOT command just after powering on the board (so before the Wire.begineTrasmission(address) is called) the AT command works and then I can upload a new sketch.
So I have tried an example sketch from the Arduino library of the RAK3172 and it worked correctly (I could re-upload the sketch without having the boot problem), but as soon I uploaded again the simple I2C scan I had again the same problem. The problem now is there also using your example sketch for the BME680 module ( WisBlock/examples/common/sensors/RAK1906_Environment_BME680 at master · RAKWireless/WisBlock (github.com))

Seems like the Wire transmission is breaking up the module in some way.

Hi @a.occ ,

Probably it is a good idea to try the RAK library for RAK1906 module. You can get it here - https://downloads.rakwireless.com/RUI/RUI3/Library/RAKwireless_RAK1906_Environment_BME680.zip

Thanks @carlrowan, I didn’t know about this library.
Anyway seems like the result is the same: I have uploaded the example inside the library and when it tries to run rak1906.init() just dies and again I can’t re-upload anything if I don’t run AT+BOOT fast when it startups or erasing via ST-LINK.
Is the module broken? Unfortunately right now I don’t have any other 3372.

Dear Alessio,

Apologies for the delayed response. Unfortunately, I have not been working on the RAK3172 for some time. The last I worked on it was the middle of last year.

However, from what I can remember, flashing the RAK3172 with an older version seemed to solve the problem. See my reply to this other thread here: https://forum.rakwireless.com/t/rak3172-module-no-longer-response-after-re-uploading-hex-firmware-through-stm32cube/9092/2

Also my original Arduino IDE sketch did not use I2C or the Wire library. It only used the Serial1. Thus it seems strange that the Wire library is causing the same problem.

Will update you when I resume work on the RAK3172.

Cheers,
Ethan

Hello @RCPilot1604,
I have just tested with the 3.4.11 version of the firmware for the RAK3172, but the result is the same: whenever I upload something related to I2C or the Wire library just stops working when reaches the Wire.beginTrasmission(address) line. I don’t know if this is a faulty module but seems like a big problem.

Hi @a.occ ,

I strongly suggest you update the firmware first to latest 4.0.5. If you are coming from 3.4.11, please use STM32CubeProgrammer to fully erase the flash the upload the update hex for RAK3172. There are lots of changes and great improvements on the latest firmware that solves hacking/bricking/stalling of modules.

Hello @carlrowan,
no, as I already said, I always used the latest firmware until yesterday when I tried @RCPilot1604 solution downgrading the firmware.
The result is the same and it is a bit scary since I have ordered other 3172 and I would not like to have the same problem.

So, just to summarize: I have tested with 4.0.5 and 3.4.11 and I have the exact same problem.
Any help on this?

Got it @a.occ .

  1. I am not sure if you fully erase whenever you switch firmware. If not yet, we can try that.

  2. Is the version of our RUI3 STM32 already 4.0.5 in your Arduino IDE? I cannot compile the BME680 above as I exceeds rom. (Take note that that example is for Arduino BSP and not RUI3).

  3. I run exactly the I2C scan code you shared and uploaded different firmware after that and my RAK3172 still works fine with multiple sensors modules attached to it. @beegee had run so many I2C modules/sensor on RAK3172 and I am sure beginTransmission works ok to him.

Wire transmission is working for me without problems.

I would propose to start with

  1. Erase flash of the RAK3172
  2. Flash the latest version of RUI3
  3. Try a simple code that is just scanning the I2C bus
  4. Add you code for the RAK1906 using the small RUI3 RAK1906 library. Sorry, needs manual installation in ArduinoIDE using the “Install from ZIP” feature.

I’ve done the process multiple time, making sure I erase the flash before flashing the latest version. I don’t know why and how but at some point the board started working!
Thank you for the support, I really don’t know what to say, but maybe it is better to run the “erase flash” command on STProgrammer a couple of times before re-flashing the firmware.
Problem solved for now!

EDIT: taking as solution the one from @beegee just because I did that exact same things the last time.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.