Arduino UNO R4 WIFI firmware update fail

Hello, I recently bought the R4 WIFI board and I have been struggling to update the firmware ever since. I tried to update it through the IoT and with Arduino IDE in both windows macos and also in linux. I couldn’t understand why it kept displaying firmware update failed but on linux I got the eror ‘Exec format eror.
Cannot put the board in ESP mode. (Via ‘unor4wifi-reboot)’ I don’t know how to solve this issue please help. Thank you in advance

The Linux update zip is only for 64 bit x86 systems so if you're running a 32 bit system (or you're on a Raspberry) you'll get that error. I was able to use the procedure below to manually update the firmware to 0.3.0 using a Raspberry Pi. It's taken from Arduino UNO R4 WiFi Upload to ESP32:

  1. Install esptool.py if not already done (pip3 install esptool).
  2. Download latest firmware from https://github.com/arduino/uno-r4-wifi-usb-bridge/releases.
  3. Extract the bin file from the firmware subdirectory in the zip.
  4. Short bottom left and bottom centre pins on 3x2 header near USB connector before powering on. Remove jumper after applying power.
  5. Erase flash with: esptool.py --chip esp32s3 --port <yourPort> erase_flash
  6. Write flash with: esptool.py --chip esp32s3 --port <your port> write_flash -z 0 <extracted file.bin>

I didn’t quite get step 4. Am I supposed to hook up arduino to the raspberry pi via the pins? If so could you tell the pin numbers that I need to use on the pi please

Just short the two pins together. Using a shorting jumper is an easy way.

jumper

Do the " Run espflash directly" part of Update the connectivity module firmware on UNO R4 WiFi first, but make sure you remove or kill any other USB device attached to your PC before doing this. Only the UNO R4 should be the USB device attached to your PC when you do it. After doing it, do the firmware update part.

Would this cause any damage to the components?

Did you not even click on the link I provided? The one that takes you to a page on arduino.cc? It's their procedure!

Sorry I just clinked on it yeah I saw it now

I am getting this error on windows (I hooked up the shorting jumper)
Error: espflash::connection_failed

x Error while connecting to device
`-> Failed to connect to the device
help: Ensure that the device is connected and the reset and boot pins are not being held down

On top of this I keep hearing the plugging in and out sound of windows. I wanted to try it again on mac with the IDE but it doesn't seem to be able to recognize the board it says "no supported board connected".

Check your PC's device manager, make sure there is no other USB device instance including greyed out ones. Remove all, only the UNO R4 should be the USB device connected when you try it. If you do it correctly and the issue persist, your board might have been bricked.

Right now when I connect the board(with the Download pin and the ground pin shorted) to my computer it shows up as 'Adafruit QT Py ESP32-C2' within the Arduino IDE. This is before I click on 'select other board and port' to set that port as Arduino uno r4 wifi. Otherwise when I plug it in without the pins shorted it does show up as arduino uno r4 wifi but it keeps disconnecting and reconnecting to the computer. Why could this be?

Additionally, the r4 wifi is the only thing connected to the computer. This is what it is seen as when I list the usb devices:
USB JTAG/serial debug unit:

      Product ID: 0x1001
      Vendor ID: 0x303a
      Version: 1.01
      Serial Number: DC:54:75:CF:AA:74
      Speed: Up to 12 Mb/s
      Manufacturer: Espressif
      Location ID: 0x14100000 / 19
      Current Available (mA): 500
      Current Required (mA): 500
      Extra Operating Current (mA): 0

Make sure your USB cable is a good data type. When the board shows up as UNO R4, reset the it by double tapping the reset button fast and check the status of the onboard "L" LED. If the onboard LED fade in and out slowly (pulsating), upload an example sketch (Blink LED) from the IDE to the board. After this, Update the connectivity module firmware on UNO R4 WiFi

I think it has become somewhat of a puzzle now because if I don't connect the GND and Download pins together the arduino keeps on connecting and disconnecting from the computer. At the same time, as long as those pins are connected together the arduino shows up as different types of ESP32s

This is the eror code I get when I try to upload 'Blink' from example sketches;

Sketch uses 51552 bytes (19%) of program storage space. Maximum is 262144 bytes.
Global variables use 6744 bytes (20%) of dynamic memory, leaving 26024 bytes for local variables. Maximum is 32768 bytes.

Device unsupported
Failed uploading: uploading error: exit status 1

Hi @kakovalipuduk.

One possible cause of this behavior is that the sketch program currently running on the UNO R4 WiFi board is interfering with its ability to produce a USB CDC serial port.

The tricky thing about the boards like UNO R4 WiFi is that (under certain conditions) the USB code that creates the CDC serial port is running on the same microcontroller as your sketch. This means your sketch code can break the USB code, or stop it from running. When that happens, the board no longer produces a serial port. This could result in the "connecting and disconnecting" symptom you describe.

This possibility for the sketch code to affect the port can be unexpected to those who previously mainly worked with the boards like Uno and Mega with a dedicated USB chip that can never be affected by the sketch code.

When you get the board into this state, it might no longer be possible to upload as usual. However, this is not a serious problem because Arduino provided a system that allows you to easily recover the board from this state. This is done by putting the board into a "boot" mode, where the sketch program is no longer running on the microcontroller. Once in that mode, you can upload to the board without any interference from whatever sketch program happens to be loaded on the microcontroller.

  1. Press and release the reset button on your board quickly twice.
    The double reset activates the bootloader. It will run until the board is reset normally, powered off, or an upload is done.
  2. Select the port of your board from the Tools > Port menu in Arduino IDE.
  3. Start an upload in Arduino IDE.

The upload should now finish successfully.

If you find that the board still doesn't produce a port while the bootloader is not activated, the problem may be caused by the code of the sketch you uploaded. You can verify this by uploading a simple sketch like the one from File > Examples > 01.Basics > BareMinimum in the Arduino IDE menus. If the uploads work normally after uploading that sketch, but not after uploading the previous sketch you were using, then you will know the issue is caused by that other sketch code.

3 Likes

Awesome explanation! I may be encountering this as well. I will have to study this post as I seeing some very strange things with my Win 10 OS that I have never seen with any other Uno Product?

Loon

1 Like

Hello,
Would you know of any additional implications of running performing updates via Ubuntu running on a Virtual Machine?

Thank you for your reply. I tried it and I got this eror:
Sketch uses 51504 bytes (19%) of program storage space. Maximum is 262144 bytes.
Global variables use 6744 bytes (20%) of dynamic memory, leaving 26024 bytes for local variables. Maximum is 32768 bytes.
No device found on cu.usbmodem14101
Failed uploading: uploading error: exit status 1

Other than this, when I tried to update the firmware by with the macos terminal I get this eror regardless of whether I connect the download pin to the gnd pin:
Chip type: esp32s3 (revision v0.1)
Crystal frequency: 40MHz
Flash size: 8MB
Features: WiFi, BLE
MAC address: dc:54:75:cf:aa:74
Error: × No such file or directory (os error 2)

I don't know much about electronics all that well however my arduino uno r4 wifi was workikng just as fine in the same way an uno r3 works. Now I can't even use it like an arduino uno r3 and tihs happened after I tried to update the firmware several times with all the methods that were shown on this page https://support.arduino.cc/hc/en-us/articles/9670986058780-Update-the-connectivity-module-firmware-on-UNO-R4-WiFi

@ptillisch , hi, thank you for this explanation, and all other explanations you provided!

I admire your patience!

I would like to understand one specific case a bit better:
What happens if a user has - willingly or inadvertently - loaded an ESP32 program to the ESP32 chip?
So far I had understood that then the manual load of the firmware, with the pins connected, is needed, to restore the ability to download programs to the RA4M1 processor.

Does this mean the RA4M1 listens directly to the USB signals, or is the connection through the ESP32 still needed?

Thank you.
-jz-

The answer is that it depends on the program they loaded on the ESP32-S3, and on the program that is running on the RA4M1. There is a complex situation where the program running on either chip can easily significantly interfere with the functionality of the other.

Arduino pin 21 on the RA4M1 is connected to NLASB3157 switches on the board that control whether the USB data lines are electrically connected directly to the RA4M1 or to the ESP32-S3. So the program on the RA4M1 has the power to cut off communication between the ESP32-S3 and the computer.

Arduino pin 4 on the ESP32-S3 is connected to the RESET pin on the RA4M1. So the program on the ESP32-S3 can reset the RA4M1, including holding it permanently in reset by setting that pin LOW. In addition, I wasn't able to understand why from looking at the schematics, but if pin 4 is not set HIGH (as is done in the stock firmware) then the RA4M1 won't restart after the reset button on the board is pressed. So the program on the ESP32-S3 has the power to disable the RA4M1 completely. The program on the ESP32-S3 can also activate the bootloader on the RA4M1 by doing a double reset via pin 4 (as is done by the stock firmware when a "1200 baud touch" is received).

I wrote: "(under certain conditions) the USB code that creates the CDC serial port is running on the same microcontroller as your sketch" in post #15. The specific conditions I was referring to were:

  • The program on the RA4M1 sets pin 21 HIGH
  • The program on the RA4M1 creates a CDC serial port

Those conditions are produced when the program on the RA4M1 #includes the "HID" library (which is more commonly done transitively via a higher level library like "Keyboard" or "Mouse").

But as soon as you activate the bootloader on the RA4M1, the sketch program that would produce those conditions stops running, so the USB data lines are switched to being connected to the ESP32-S3. This means that if the program running on the ESP32-S3 doesn't provide the necessary "bridge" capabilities then it will no longer be possible to upload programs to the RA4M1.

The only exception is if the "RA4M1 USB" solder jumper on the bottom of the UNO R4 WiFi board has been shorted, which causes the NLASB3157 switches to be permanently set to connecting the USB data lines to the RA4M1. In this case the computer can still communicate directly with the RA4M1 even when the bootloader is activated, rather than being dependent on the ESP32-S3 acting as a "bridge".

1 Like