Yet another "Mega +WiFi R3 ATmega2560+ESP8266 (32Mb memory)" thread
Sorry! - I have been reading up and down in many many threads - I just never seem to find a thread with a happy ending and a solution.
I burned bootloader from Juraj "my_board" through a genuine UNO onto the Mega2560
I put on the ESP8266 the "ESP8266 NonOS AT Bin V1.7.1" to the addresses from the readme.md
When I compile the wifi-link, everything uploads fine - I can then connect the AP fine, there's just no web-panel when entering 192.168.240.1
from what I read, the two best options for OTA on mega2560 is WIFI-LINK or ESP-LINK.
So in another test I wanted to try ESP-LINK.
I managed to get ESP-LINK working with a simple NTP test on mega2560 module.
I can't get OTA to the mega2560 to work through ESP-LINK, which is important to me
I put on a wire from GPIO12 on ESP to RST on Mega, and the Mega is rebooting fine from web interface, when I click "reset uc" but on web page an error occurs after few settings "Error resetting uC"
it seems this "reset error" also hunts me when I try to OTA with megascript, with ip-address port, with "ESPLINK3" in programmer
esp-link has two OTA ways. one is a built in stk500 coded in the firmware. it is only for ATmega 328p with Optiboot.
the other way is a transparent connection for avrdude. it should work for Mega. I never tested that, but there is some discussion in issues on GitHub.
The WiFiLink firmware has build in OTA only for ATmega328p too. But with WiFiLink you can use for Mega the ArduinoOTA library for which the bootloader you burned is created. And for this, the WiFiLink doesn't need the built in OTA support.
btw: the AT firmware doesn't help you at all because you replaced it right away with the esp-link firmware.
TroelsDK:
There's just no webpage on the IP address
did you upload SPIFFS? with the right flash size selected in Tools menu (and same as for sketch upload)?
but you can use the firmware without the WebPanel.
try the examples of the library. do you use the Serial3 connection dip switch selection? then do not forget to set Serial3 to WiFi.init
[SPIFFS] data : C:\Users\Development\Desktop\Sketches\arduino-firmware-wifilink-master\ArduinoFirmwareEsp\data
[SPIFFS] size : 1004
[SPIFFS] page : 256
[SPIFFS] block : 8192
/img/favicon.ico
/img/icons.png
/img/logo.ico
/img/logo.png
/img/logoOtto.ico
/img/logoOtto.png
/img/logoPrimo.ico
/img/logoPrimo.png
/img/logoUnoWiFi.ico
/img/logoUnoWiFi.png
/index.html
/pure.css
/style.css
/ui.js
/wifi.html
/wifi.js
[SPIFFS] upload : C:\Users\DEVELO~1\AppData\Local\Temp\arduino_build_528389/ArduinoFirmwareEsp.spiffs.bin
[SPIFFS] address : 0x300000
[SPIFFS] reset : ck
[SPIFFS] port : COM10
[SPIFFS] speed : 115200
[SPIFFS] python : C:\Data\arduino-1.8.9-windows\portable\packages\esp8266\tools\python\3.7.2-post1\python.exe
[SPIFFS] uploader : C:\Data\arduino-1.8.9-windows\portable\packages\esp8266\hardware\esp8266\2.5.2\tools\upload.py
esptool.py v2.6
Serial port COM10
Connecting....
Chip is ESP8266EX
Features: WiFi
MAC: ec:fa:bc:39:85:17
Uploading stub...
Running stub..
Stub running...
Configuring flash size...
Auto-detected Flash size: 4MB
Compressed 1028096 bytes to 91019...
Writing at 0x00300000... (16 %)
Writing at 0x00304000... (33 %)
Writing at 0x00308000... (50 %)
Writing at 0x0030c000... (66 %)
Writing at 0x00310000... (83 %)
Writing at 0x00314000... (100 %)
Wrote 1028096 bytes (91019 compressed) at 0x00300000 in 9.3 seconds (effective 880.2 kbit/s)...
Hash of data verified.
Leaving...
Hard resetting via RTS pin...
Today I tried using an example from WifiLink
I chose 'ConnectWithWPA' and the DIP to Serial3
it did the trick!
so now I have a ESP on wifi with WifiLink and I just need to crack the OTA nut
I have remembered to uncomment the "MCU_OTA define" in WifiLink.
I connected "ESP GPIO12 " to "RST" on mega board and I tried to insert ArduinoOTA into the chosen example
but when I choose the web port in IDE, it says
Sketch uses 13558 bytes (5%) of program storage space. Maximum is 261120 bytes.
Global variables use 1144 bytes (13%) of dynamic memory, leaving 7048 bytes for local variables. Maximum is 8192 bytes.
Resetting the board
Failed to reset the board, upload failed
An error occurred while uploading the sketch
my sketch is :
#include <WiFiLink.h>
#if !defined(ESP_CH_SPI) && !defined(HAVE_HWSERIAL3)
#endif
#include <ArduinoOTA.h>
char ssid[] = "xxxx"; // your network SSID (name)
char pass[] = "xxxx"; // your network password
int status = WL_IDLE_STATUS; // the Wifi radio's status
void setup() {
//Initialize serial and wait for port to open:
Serial.begin(115200);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
Serial.print("Hello world 1-2-3");
#if !defined(ESP_CH_SPI)
Serial3.begin(9600); // speed must match with BAUDRATE_COMMUNICATION setting in firmware config.h
WiFi.init(&Serial3);
#endif
if (WiFi.checkFirmwareVersion("1.1.0")) {
WiFi.resetESP(); // to clear 'sockets' after sketch upload
delay(500); // let firmware initialize
}
//Check if communication with the wifi module has been established
if (WiFi.status() == WL_NO_WIFI_MODULE_COMM) {
Serial.println("Communication with WiFi module not established.");
while (true);// don't continue:
}
// attempt to connect to Wifi network:
while ( status != WL_CONNECTED) {
Serial.print("Attempting to connect to WPA SSID: ");
Serial.println(ssid);
// Connect to WPA/WPA2 network:
status = WiFi.begin(ssid, pass);
// wait 10 seconds for connection:
delay(10000);
}
// you're connected now, so print out the data:
Serial.print("You're connected to the network");
ArduinoOTA.begin(WiFi.localIP(), "Arduino", "password", InternalStorage);
}
void loop() {
// check for WiFi OTA updates
ArduinoOTA.poll();
delay(5000);
}
thank you!
I thought to look in %userprofiles%/appdata/local/arduino15/extras/avr
I have now copied into \hardware\my_boards\avr next to platform.txt
I have restarted IDE 1.8.9 and tried to update through web port for 'MEGA 2560 (optiboot)'
it seems like the platform.local.txt doesn't kick in
Sketch uses 6146 bytes (2%) of program storage space. Maximum is 261120 bytes.
Global variables use 565 bytes (6%) of dynamic memory, leaving 7627 bytes for local variables. Maximum is 8192 bytes.
C:\Data\arduino-1.8.9-windows\hardware\tools\avr/bin/arduinoOTA -address 172.20.23.100 -port {upload.network.port} -sketch C:\Users\DEVELO~1\AppData\Local\Temp\arduino_build_298605/mega_ota_test.ino.hex -upload {upload.network.endpoint_upload} -sync {upload.network.endpoint_sync} -reset {upload.network.endpoint_reset} -sync_exp {upload.network.sync_return}
Resetting the board
Failed to reset the board, upload failed
An error occurred while uploading the sketch
I have tried to run the arduinoOTA.exe manually in CMD with the commands from platform.local.txt
now I also copied platform.local.txt into "\hardware\arduino\avr"
so the correct cmd is used from IDE now..
Sketch uses 6174 bytes (2%) of program storage space. Maximum is 261120 bytes.
Global variables use 575 bytes (7%) of dynamic memory, leaving 7617 bytes for local variables. Maximum is 8192 bytes.
C:\Data\arduino-1.8.9-windows\hardware\tools\avr/bin/arduinoOTA -address 172.20.23.100 -port 65280 -username arduino -password -sketch C:\Users\DEVELO~1\AppData\Local\Temp\arduino_build_277364/mega_ota_test.ino.bin -upload /sketch -b
and IDE writes "Done uploading." - but the sketch is not updated (I have a simple serial.print("Hello world"; that I change to "goodbye world" to check the sketch changes
#include <WiFiLink.h>
#if !defined(ESP_CH_SPI) && !defined(HAVE_HWSERIAL3)
#endif
#include <ArduinoOTA.h>
char ssid[] = "censur"; // your network SSID (name)
char pass[] = "censur"; // your network password
int status = WL_IDLE_STATUS; // the Wifi radio's status
void setup() {
//Initialize serial and wait for port to open:
Serial.begin(115200);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
Serial.print("Hello world 3-2-3");
#if !defined(ESP_CH_SPI)
Serial3.begin(9600); // speed must match with BAUDRATE_COMMUNICATION setting in firmware config.h
WiFi.init(&Serial3);
#endif
if (WiFi.checkFirmwareVersion("1.1.0")) {
WiFi.resetESP(); // to clear 'sockets' after sketch upload
delay(500); // let firmware initialize
}
//Check if communication with the wifi module has been established
if (WiFi.status() == WL_NO_WIFI_MODULE_COMM) {
Serial.println("Communication with WiFi module not established.");
while (true);// don't continue:
}
// attempt to connect to Wifi network:
while ( status != WL_CONNECTED) {
Serial.print("Attempting to connect to WPA SSID: ");
Serial.println(ssid);
// Connect to WPA/WPA2 network:
status = WiFi.begin(ssid, pass);
// wait 10 seconds for connection:
delay(10000);
}
// you're connected now, so print out the data:
Serial.print("You're connected to the network");
ArduinoOTA.begin(WiFi.localIP(), "Arduino", "password", InternalStorage);
}
void loop() {
// check for WiFi OTA updates
ArduinoOTA.poll();
}
Build options changed, rebuilding all
Sketch uses 13048 bytes (4%) of program storage space. Maximum is 261120 bytes.
Global variables use 1112 bytes (13%) of dynamic memory, leaving 7080 bytes for local variables. Maximum is 8192 bytes.
C:\Data\arduino-1.8.9-windows\hardware\tools\avr/bin/arduinoOTA -address 172.20.23.100 -port 65280 -username arduino -password -sketch C:\Users\DEVELO~1\AppData\Local\Temp\arduino_build_958660/mega_ota_test.ino.bin -upload /sketch -b
I saw that the "-password" doesn't contain the actual word 'password'
if I add 'password' after the switch, I get the three lines you mention.
So here's my commands from a regular cmd.exe