R4 OTA update errors

Hi, I have new R4, can load simple sketches via USB fine. Now trying OTA. Examples, Examples from Custom Libraries, ArduinoOTA, WiFi101_OTA. Changed WiFiNINA to WiFiS3, added WiFi credentials. Loaded sketch via USB. On Serial monitor can see it connected to WiFi, and IP address 192.168.1.27.

On Arduino IDE change port to "Arduino at 192.168.1.27", ^u, compiles alright, "Failed uploading, no upload port provided". PC is Windows 10 Home 22H2, firewall off. IDE is 2.2.1.

Another PC, W7, IDE 1.8.18. After ^u the password dialogue appears. Whatever I enter in that 'password' or abc etc. there's a message in the console and nothing more. "No device found on 192.168.1.27"

Any help appreciated.

did you do this?

For Uno R4, RP2040, nRF5 and STM32 boards, platform.local.txt from extras folder has to be copied into boards package installation folder.

from https://github.com/JAndrassy/ArduinoOTA#installation

Thanks, I have not done that. Regret that does not tell me specifically what to do. For platform.local.txt I see 10 of them e.g. ...Arduino\libraries\ArduinoOTA\extras\esp32\platform.local.txt. There is no "R4" directory, so it might be ESP32 or renesas, but which?

Where to copy it? Under ...AppData\Local\Arduino15\packages there is arduino, builtin, esp32, esp8266. Other topics indicate the file should go in arduino15/packages/esp32/hardware/esp32/1.0.4, but my esp32 has no hardware directory.

Uno R4 is in the Renesas Core

Please would you say where I should copy the file. Below is the top 3 levels of what's currently in packages.

\APPDATA\LOCAL\ARDUINO15\PACKAGES\ESP32
└───tools
    ├───esptool_py
    │   └───4.5.1
    ├───mklittlefs
    │   └───3.0.0-gnu12-dc7f933
    ├───mkspiffs
    │   └───0.2.3
    ├───openocd-esp32
    │   └───v0.11.0-esp32-20221026
    ├───xtensa-esp-elf-gdb
    │   └───11.2_20220823
    ├───xtensa-esp32-elf-gcc
    │   └───esp-2021r2-patch5-8.4.0
    ├───xtensa-esp32s2-elf-gcc
    │   └───esp-2021r2-patch5-8.4.0
    └───xtensa-esp32s3-elf-gcc
        └───esp-2021r2-patch5-8.4.0


\APPDATA\LOCAL\ARDUINO15\PACKAGES\ESP8266
├───hardware
│   └───esp8266
│       └───3.1.2
└───tools
    ├───mklittlefs
    │   └───3.1.0-gcc10.3-e5f9fec
    ├───mkspiffs
    │   └───3.1.0-gcc10.3-e5f9fec
    ├───python3
    │   └───3.7.2-post1
    └───xtensa-lx106-elf-gcc

next to platform.txt

It’s working! I can reliably load the sketch OTA to my Arduino R4 Wifi. Thank you @Juraj.

  • Windows 7. Arduino IDE 1.8.18 or Windows 10, Arduino IDE 2.2.1
  • Install Arduino UNO R4 Boards (1.0.5)
  • Select Ardunio UNO R4 WiFi
  • Install library ArduinoOTA (1.0.12)
  • Example WiFi101_OTA
  • Change WiFiNINA.h to WiFiS3.h
  • Copy \libraries\ArduinoOTA\extras\renesas\platform.local.txt
    o To %userprofile%\AppData\Local\Arduino15\packages\arduino\hardware\renesas_uno\1.0.5\
  • Restart IDE
  • Select port (e.g.) “Arduino at 192.168.1.27”
  • ^u
  • Password: password

There are a few ways it can fail to work or be confused.

At one point the R4 was not connecting to WiFi every time. (Caused by a new WiFi repeater that I was testing then removed). The Arduino IDE is not very live with its port information, and continues to attempt OTA update when the R4 is not pingable. Use ping to check R4 is connected.

The IDE using OTA puts up the password dialogue. It doesn’t do it every time, perhaps it caches the information. It sometimes asks when the R4 is not on the network, so don’t take it as proof of connection.

At one point the IDE was showing “Arduino at 0.0.0.0”. Fixed either by rebooting the computer, or another instance of the IDE had the IP address, so close one sketch and re-open it from the other IDE.

Thanks for taking the time to share your findings @RichardDL!

That is correct. It is cached for the selected board and port and will only appear again if the previous upload failed.

If you want to trigger a reappearance of the dialog, select Sketch > Configure and Upload from the Arduino IDE menus.

1 Like

After my last post everything was working well. I was making small changes to the program, playing with the features of the R4 and reloading frequently. Sadly the end of the day arrived and I hibernated the PCs. The next day tried to continue, but nothing worked. After much rebooting and retrying the OTA load worked again on the W7 PC while still refusing on the W10 (so the problem is in the PC or IDE not the R4).

Today using the W7 PC the OTA load said it had failed, but I realised the new sketch was loaded and running. Now I’ve noticed this, I can see it happens quite often. To show whether the load is successful I’ve resolved always to put a visible change in the program, e.g. different led pattern. If there is a web page, then the macro __TIME__ in the web-page text makes this easy. This successful load can happen before or after the first password dialogue.

1 Like

There is another way the OTA load can fail. This one is fixed by switching the PC WiFi on and off. Then it loads, but said it had failed.

...
Global variables use 10624 bytes (32%) of dynamic memory, leaving 22144 bytes for local variables. Maximum is 32768 bytes.
processing.app.debug.RunnerException: Unable to connect to 192.168.1.27
	at cc.arduino.packages.uploaders.SSHUploader.uploadUsingPreferences(SSHUploader.java:148)
	at cc.arduino.UploaderUtils.upload(UploaderUtils.java:77)
	at processing.app.SketchController.upload(SketchController.java:732)
	at processing.app.SketchController.exportApplet(SketchController.java:703)
	at processing.app.Editor$UploadHandler.run(Editor.java:2061)
	at java.lang.Thread.run(Thread.java:748)
Unable to connect to 192.168.1.27

- Switched the laptop WiFi off and on.
...
C:\Programs\Arduino\hardware\tools\avr/bin/arduinoOTA -address 192.168.1.27 -port 65280 -username arduino -password password -sketch C:\Users\RDL_AD~1\AppData\Local\Temp\arduino_build_562013/UNO_R4_Dev.ino.bin -upload /sketch -b 
Connecting to board ...  done
Uploading sketch ...  done
Flashing sketch ...  done        !  R4 is running the new sketch.
Error flashing the sketch
- Showing password dialogue

could it be timeout of the upload tool? it is only 10 seconds.
newer version of the arduinoOTA tool allows a timeout parameter

https://github.com/arduino/arduinoOTA/releases

replace the 1.3.0 exe and in platform.local.txt add the -t option in seconds