I've been able to connect my XIAO ESP32-C3 to my home network, but when I try to compile code for IOT-Cloud I get this error when trying to compile locally after downloading the basic code that is auto-generated. So I thought I might have some of the wrong libraries or something like that.
/Users/marc/Documents/Arduino/libraries/ArduinoIoTCloud/src/utility/ota/OTA-esp32.cpp: In function 'String esp32_getOTAImageSHA256()':
/Users/marc/Documents/Arduino/libraries/ArduinoIoTCloud/src/utility/ota/OTA-esp32.cpp:79:33: error: 'SPI_FLASH_SEC_SIZE' was not declared in this scope
79 | uint8_t *b = (uint8_t*)malloc(SPI_FLASH_SEC_SIZE);
| ^~~~~~~~~~~~~~~~~~
Then when I try to compile in the cloud using the cloud IDE I get a red x in this icon that seems to be showing me whether or not I'm connected to my device. Furthermore, when I hover over serial monitor it says "Serial Port Unavailable No device connected via usb".
What is strange about that is that it is definitely connected and the local arduino IDE agrees.
Any help here would be great. Let me know if you need screenshots or code. Just know that I haven't written a single line of code when it's not working. The code is all auto-generated.
The Nano ESP32 section of the forum is specifically for the Arduino Nano ESP32, not for other ESP32 based board. Hence your topic has been moved to a more suitable section of the forum.
Yeah, I can compile, load, and run simple programs via the local IDE. I've even got one working that connects to my wifi and I can ping the device.
I cannot do jack with the cloud IDE because it doesn't seem to see it on the USB/serial connection. If I download the simplest auto-generated arduino IOT code it fails to compile with the error above. It's all the OTA stuff that seems to be the issue. OTA (I assume this is over the air). If I put a #define for that missing variable it just discovers another missing one.
Hey Arduino, you know what would be really handy is if I could download a compiled binary from the cloud IDE. That would at least mitigate this situation with the OTA not working with a XIAO BLE ESP32C3.
Ok, after some more digging I can say the following. I simply have some wrong .h files somewhere, but it's not my fault. What I can say is that I get no error compiling some basic connect to wifi sketch using the same wifi library as in the IOT OTA sketch from the arduino IOT cloud examples. To get beyond the first error I simply put a
#define SPI_FLASH_SEC_SIZE 4096
and then I run into my next compiler issues. To determine if it's the wifi library being used I compared the libraries used by both a basic WORKING wifi sketch I have to what is being used by IOT OTA. They're using the same wifi library, but one is using it incorrectly.
multiple libraries were found for "WiFi.h"
Used: /Users/marc/Library/Arduino15/packages/esp32/hardware/esp32/3.0.0-rc1/libraries/WiFi
Not used: /Users/marc/git/Personal/Arduino/libraries/WiFiNINA
Using library WiFi at version 2.0.0 in folder: /Users/marc/Library/Arduino15/packages/esp32/hardware/esp32/3.0.0-rc1/libraries/WiFi
But I do get an error using that same library in the IOT OTA sketch as shown below:
/Users/marc/git/Personal/Arduino/libraries/Arduino_ESP32_OTA/src/Arduino_ESP32_OTA.cpp: In member function 'int Arduino_ESP32_OTA::download(const char*)':
/Users/marc/git/Personal/Arduino/libraries/Arduino_ESP32_OTA/src/Arduino_ESP32_OTA.cpp:125:19: error: expected type-specifier before 'WiFiClient'
125 | _client = new WiFiClient();
| ^~~~~~~~~~
Multiple libraries were found for "WiFi.h"
Used: /Users/marc/Library/Arduino15/packages/esp32/hardware/esp32/3.0.0-rc1/libraries/WiFi
Not used: /Users/marc/git/Personal/Arduino/libraries/WiFiNINA
The problem of compilation of the "ArduinoIoTCloud" library failing when using Arduino IDE is caused by a breaking change made in the "esp32" boards platform. The "ArduinoIoTCloud" library is compatible with the latest release version of the "esp32" boards platform (2.0.15), but you are using the pre-release version 3.0.0-rc1. Arduino only provides support for using the "ArduinoIoTCloud" library with release versions of the platforms. The pre-release versions of the platforms are primarily intended for use by those who want to contribute to the development of the platform by doing beta testing; not for normal everyday usage.
So you can solve this problem by installing the latest release version of the platform, following the instructions here:
OK, I'm back with information about this part of your report.
Due to a non-standard configuration in the 3rd party ESP32 boards platform, it is not possible to upload to this board via the "new" Arduino Cloud Editor.
Please use Arduino IDE to upload sketches for this particular board.
Arduino IDE has Arduino Cloud integration, which provides convenient access to the sketches from your Arduino Cloud account:
Note that you can use Arduino IDE for development of Arduino CloudThing sketches. It is convenient to use the Arduino Cloud web interface for the initial setup of the Thing, but after that you can open the sketch in Arduino IDE for editing and uploading to your board. You will see newly created Thing sketches under the "Cloud Sketchbook" tab of the IDE's "SKETCHBOOK" panel after you click the "Sync" icon at the bottom right corner of the panel.
That was a bunch of very good help. Thank you so much. I'm afraid I somehow ended up with the dev branch in my boards manager without realizing it.
The local IDE is compiling and uploading as expected now. That said, it is a little finicky wrt the port I'm uploading to. Sometimes it takes hitting reset a few times on the Xiao despite the IDE clearly seeing it (bold text "XIAO_ESP32_C3" next to usb symbol). Not sure whose fault that is.
You are welcome. I'm glad if I was able to be of assistance.
It could be caused by the behavior of the sketch program. The USB stack runs on the same microcontroller as the sketch program on this board, which means that the sketch program can interfere with the USB CDC serial port used for the upload. This might be an expected result of the sketch code (e.g., putting the microcontroller to sleep), or an unexpected result of a bug.
I have good news to share about this. The Arduino Cloud developers have now implemented a workaround for the problem caused by the non-standard configuration of the "esp32" boards platform. You can now use Arduino Cloud with all ESP32-C3, ESP32-S2, and ESP32-S3 based boards.
I'll provide usage instructions:
Start by clicking the "SELECT DEVICE" button on the Arduino Cloud Editor toolbar:
The "Select device" dialog will open. When using one of these boards, an entry for the board's port will be shown in the dialog, but labeled "Unknown":
Click on the port in the dialog. The "Unknown Device Found" dialog will now open. Select the appropriate board model from the list of search results:
The dialog will close. You will now see that the board and port have been configured:
You are now all set to use the board in Cloud Editor.
There is a bit more room for error when using this type of board compared to one of the boards that produce a serial port Cloud Editor can automatically identify, but as long as you are careful to make sure to select the correct port and board model from those dialogs, everything will work just fine.
Please give it a try and let us know if you have any problems or questions.