ArduinoOTA with the Uno R4 WiFi

My Uno R4 WiFi has the latest firmware (UNOR4-WIFI-S3-0.3.0-rc1.bin) and the OTA sketch works on it.

I would now like to set up IDE 2.2.1 to upload sketches to my Uno R4 WiFi via OTA. The library ArduinoOTA should allow this, the Uno R4 WiFi is included in the supported micro-controllers and in the boards tested. However none of the examples work with my Uno R4 Wifi board and I have searched the internet for an example without success. Does anyone have an example of the library ArduinoOTA working with an Uno R4 WiFi and the IDE 2.2.1 to upload a sketch via OTA?

Is there any error message that you can see while trying to upload your code to the UNO R4?

The WiFi101_OTA example should work if you replace the WiFiNINA include to WiFiS3.

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

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

1 Like

Thank you, that worked.

Greetings.

I am still having the issue of the programming network port not appearing in the IDE 2 with Uno R4.

I have followed the instructions, replaced the WiFiNINA to WiFiS3, added platform.local.txt from "renesas" to local "renesas_uno\1.1.0" folder. Still no luck.

I have even tried the " OTA Upload from IDE without 'network port' " by modifying the "programmers.txt" file (in the "renesas_uno\1.1.0" folder), but the programmer does not appear in the list for some reason.

I am out of ideas and would really appreciate any help on this issue.

Best regards,

Marek J.

Hi @Manki.

There is a bug in Arduino IDE that can cause this. It caches the contents of the Tools Programmer menu and uses that cached data instead of generating the menu from the updated contents of the programmers.txt file as expected.

I'll provide instructions you can follow to clear that cache, which will force Arduino IDE to load the data from programmers.txt again:

  1. Select File > Quit (or Arduino > Quit Arduino for macOS users) from the Arduino IDE menus if it is running.
    All Arduino IDE menus will close.

  2. Delete the following folder to clear the menu cache:

    • Windows:
      C:\Users\<username>\AppData\Roaming\arduino-ide\
      
      (where <username> is your Windows username)
      :exclamation: If looking for it with your file manager or command line, note that the AppData folder is hidden by default. On Windows "File Explorer", you can make it visible by opening the "View" menu, then checking the box next to "☐ Hidden items".
    • Linux:
      /home/<username>/.config/arduino-ide/
      
      (where <username> is your Linux username)
      :exclamation: The .config folder may be hidden by default in your file manager and terminal.
    • macOS:
      /Users/<username>/Library/Application Support/arduino-ide/
      
      (where <username> is your macOS username)
      :exclamation: The Library folder is hidden by default. You can make it visible by pressing the Command+Shift+. keyboard shortcut.

    :warning: Please be very careful when deleting things from your computer. When in doubt, back up!

  3. Start Arduino IDE.

  4. Select Tools > Board > Arduino UNO R4 Boards > Arduino UNO R4 WiFi from the Arduino IDE menus.

You should now see the "Arduino OTA" programmer option under the Tools > Programmer menu.

Thank you very much!

The fix worked and although the upload failed at first, when I increased the timeout (as per ArduinoOTA instructions), the sketch uploaded successfully.

However, any ideas why the OTA network port is not appearing in the tools menu, despite trying all the suggestions?

Great work on achieving a successful OTA upload!

Unfortunately I'm not very knowledgeable in this subject area. My experience is limited to using the network ports of the MKR 1000 WiFi, ESP32, and ESP8266 boards. Even then, I don't have a deep understanding of how they work at the network level. Hopefully one of the other forum helpers will be able to provide better assistance.

There are multiple layers to the system:

  • Arduino IDE displays the list of discovered ports to the user
  • Arduino CLI provides the list of all discovered ports to Arduino IDE
  • mdns-discovery provides the list of discovered "network" protocol ports to Arduino CLI
  • Mysterious (to me) network layers (something to do with mDNS)

If you would like to check whether mdns-discovery is discovering the port, I can provide instructions for doing that. Just tell me which operating system (e.g., "Windows") you are using.

This can be useful for troubleshooting because if mdns-discovery is discovering the port then you will know that the problem is at one of the layers above (and I might be able to help with that). Conversely, if mdns-discovery is not discovering the port then you will know the problem is either with mdns-discovery or a layer below it.

I am using Windows 10.

A few days ago, at one time, I saw a network port in Arduino IDE during development.
However, the next day it disappeared again. It could be that something in Windows is interfering with the discovery.

Please provide the instructions on how to debug it, if possible.

If you would like to do some troubleshooting, you can check whether the low level mdns-discovery tool used by the Arduino development software to find ports is behaving and able to see the port of your board.


:exclamation: This procedure is not intended to solve the problem. The purpose is to gather more information.


I'll provide instructions you can follow to do that:

During all this, keep an eye out for anything that doesn't match the expected behavior as described at each step.

  1. Open the following folder in Windows "File Explorer":
    C:\Users\<username>\AppData\Local\Arduino15\packages\builtin\tools\mdns-discovery
    
    (where <username> is your Windows username)
    Note that the AppData folder is hidden by default in "File Explorer". You can make it visible by opening the "View" menu, then checking the box next to "☐ Hidden items".
  2. The mdns-discovery folder will contain a subfolder for each of the versions of mdns-discovery which are installed on your computer.
    For example:
    mdns-discovery/
    ├── 0.9.2/
    ├── 1.0.2/
    └── 1.0.5/
    
  3. Hold the Shift key while clicking the right hand button on the mouse on the folder with the highest version (1.0.5 in the example above).
  4. From the context menu, click "Open PowerShell window here".
    PowerShell will now open.
  5. Type the following command:
    mdns-discovery
    
  6. Press the Enter key.
    mdns-discovery will now start. There won't be any obvious sign of this other than that there is no longer a command prompt at the cursor in the terminal.
  7. Type the following command:
    HELLO 1 "arduino-cli 0.21.0"
    
  8. Press the Enter key.
    You should now see a response printed exactly like this:
    {
      "eventType": "hello",
      "protocolVersion": 1,
      "message": "OK"
    }
    
  9. Disconnect your Arduino board from its power source if you have it powered.
  10. Type the following command:
    START_SYNC
    
  11. Press the Enter key.
    You should now see a response printed exactly like this:
    {
      "eventType": "start_sync",
      "message": "OK"
    }
    
    You might also see some additional objects in the output depending on which network ports are available on your computer.
  12. Power your Arduino board.
    You should eventually see a response printed that looks something like this:
    {
      "eventType": "add",
      "port": {
        "address": "192.168.254.127",
        "label": "esp32-b4e62dbf693d at 192.168.254.127",
        "protocol": "network",
        "protocolLabel": "Network Port",
        "properties": {
          ".": "node32s",
          "auth_upload": "no",
          "board": "node32s",
          "hostname": "esp32-b4e62dbf693d.local.",
          "port": "3232",
          "ssh_upload": "no",
          "tcp_check": "no"
        }
      }
    }
    
    This is only an example of what you might see. The output will be different depending on the board you connected.
  13. Disconnect your Arduino board from its power source.
    You should eventually see a response printed that looks something like this:
    {
      "eventType": "remove",
      "port": {
        "address": "192.168.254.127",
        "label": "esp32-b4e62dbf693d at 192.168.254.127",
        "protocol": "network",
        "protocolLabel": "Network Port",
        "properties": {
          ".": "node32s",
          "auth_upload": "no",
          "board": "node32s",
          "hostname": "esp32-b4e62dbf693d.local.",
          "port": "3232",
          "ssh_upload": "no",
          "tcp_check": "no"
        }
      }
    }
    
    This is only an example of what you might see. The port data should be the same as the "add" event you saw when you plugged the board in.

You should continue to see the same results if you repeat steps (10) and (11).

Once you are done with your experiments with the "mdns-discovery" tool, follow these instructions to exit:

  1. Type the following command:
    STOP
    
  2. Press the Enter key.
    You should now see a response printed exactly like this:
    {
      "eventType": "stop",
      "message": "OK"
    }
    
  3. Type the following command:
    QUIT
    
  4. Press the Enter key.
    You should now see a response printed exactly like this:
    {
      "eventType": "quit",
      "message": "OK"
    }
    
    You should now be back at the shell command line.

Hello, again.

Sorry for the delayed response. Last week vas very busy.

I have tried to diagnose the problem using the provided steps, but there seems to be an issue at step 12.
Nothing is happening in the mdns-discovery tool (PowerShell) when Arduino is connected. Not with my sketch, nor the ArduinoOTA example sketch.

Everything before that is exactly as provided in the steps.

Is there anything else I can do to diagnose the issue in more detail?