jeelabs / esp-link

esp8266 wifi-serial bridge, outbound TCP, and arduino/AVR/LPC/NXP programmer
Other
2.82k stars 720 forks source link

Can't get Arduino Pro Micro Atmega32u4 16Mhz with Optiboot 8.0 bootloader to work OTA flashing #480

Open jharwinbarrozo opened 4 years ago

jharwinbarrozo commented 4 years ago

I'm not really sure what's the problem here. I thought I just need to burn my pro micro with optiboot bootloader for it to work. But it isn't.

So I've tried attaching an Arduino nano atmega328p with optiboot and 100% of the time I can flash it OTA using curl thru postman even from Arduino IDE sketch using network port (esp-link IP address)

I always have this error for Pro Micro.

Resetting the board
Waiting for the upload to start
An error occurred while uploading the sketch
Connecting to board ...  done
Uploading sketch ...  done
Flashing sketch ...  done
Error flashing the sketch:Bad programmer signature: 0x1e 0x95 0x87

I don't get it why it says bad programmer signature. I can see though that my nodemcu 12-E can reset the uC prior to flashing, but after the reset, nothing happens until the error above shows.

Btw, I'm using esp-link v3.2.47-g9c6530d

baervers23 commented 4 years ago

Is the standard arduino bootloader working? for me it looks like he dont know that he should flash a optiboot. And post esp console log is a good way to go to help you :)

normal bootloader should work fine .. at me it does ..

jharwinbarrozo commented 4 years ago

@baervers23 I've tried the normal bootloader for pro micro using arduino ide 1.8.10 but it isn't working. I read from the wiki that optiboot should be in sync with the uC for OTA flashing to work. I haven't seen any documentation about normal bootloader available in IDE that it has optiboot. So my last resort was to burn a bootloader with optiboot following this guide https://www.instructables.com/id/How-to-upload-sketches-to-Pro-MicroLeonardo-via-se/

uzi18 commented 4 years ago

@jharwinbarrozo @baervers23 I can try to add signatues to test build if you want to try?

jharwinbarrozo commented 4 years ago

@jharwinbarrozo @baervers23 I can try to add signatues to test build if you want to try?

Very sure! Thank you so much!

uzi18 commented 4 years ago

but you both need to reflash optiboot one more time ;)

jharwinbarrozo commented 4 years ago

@uzi18 not a huge problem for me.

uzi18 commented 4 years ago

@jharwinbarrazo @baervers23 mega 2560 + atmega32u4 added for test esp-link-v3.2.47.alpha.22-g6895442-dirty-Lucjan.tgz.zip

jharwinbarrozo commented 4 years ago

@uzi18 Wow first try, and it worked for Arduino pro micro with optiboot bootloader.

Resetting the board
Waiting for the upload to start
SYNC at 115200 baud: bootloader v6.3
Connecting to board ...  done
Uploading sketch ...  done
Flashing sketch ...  done
Success. 21474 bytes at 115200 baud in 3.7s, 5724B/s 49% efficient
Sketch uploaded successfully
Resetting the board
jharwinbarrozo commented 4 years ago

btw, I'm using this precompiled optiboot bootloader for 32u4 (leonardo and pro micro)- https://cdn.instructables.com/ORIG/FNM/AXYK/IDMXJSF2/FNMAXYKIDMXJSF2.zip

@uzi18 I wanted to know what you did so I can fork it. Thanks alot again for your help!

I have Arduino mega2560 here too that I can't get it to work on esp-link v3.2.47-g9c6530d, so I will try it on your version and will report back.

gieza commented 4 years ago

Hi, in cgioptiboot.c line 503 is the line: if (responseBuf[1] == 0x1e && responseBuf[2] == 0x95 && responseBuf[3] == 0x0f) { i.e. it supports only flashing devices with signature " 0x1e, 0x95, 0x0f", while your device reports "0x1e 0x95 0x87"

One of the workarounds is to use avrdude over telnet

baervers23 commented 4 years ago

@jharwinbarrazo @baervers23 mega 2560 + atmega32u4 added for test esp-link-v3.2.47.alpha.22-g6895442-dirty-Lucjan.tgz.zip

hey uzi im glad to hear you worked on the 2560 optiboot support .. i will test it tomorrow :) can i normally use it with IDE Network upload ? Greetz

EDIT: Im sorry but my computer dont allow me to flash esp. idk why and im so sad about. @Win 10 64 bit, i7-8700k (overclocked to 4,8 Ghz), 16GB DDR4HyperX 3000Mhz

Git Bash: all working, i got no errors, all from console is exactly like the tutorial. i got read, write success, than reset via rst pin (printed in console). At starting esp and connect to it i got the first issues: sometimes i cant connect to ap, sometimes i am connected but cant reach Interface 192.168.4.1, sometimes i got into the interface, see the "frame/design" loading but where the variables and dropdownbuttons should be he is infinite loading the functions.

Ubuntu WIndows Subsystem Kernel: After giving up flashing on windows i tried the subsystem to flash my esp. i remember i get it anyhow working but the esp was very "slow/laggy". But most time exactly the same problems like with git bash

@Win 7 64 bit, i5-4670k : I tried the computer of my girlfriend i thought its maybe my microsoft cleaned windows. I tried with GIT Bash because my GF has Windows 7 on her computer. Same problems like above. This CPU is overclocked too.

@Win 10 64 bit, i7-7700k : I visited my pal and we try it on his computer. first time flashing was enough. no connection probs, no speed isssues, no laggy interface. I dont know why because we used exactly the same tutorial and the same esptool flash command for 32Mbit/4MB ESP we found on ur "serial Flashing" Readme

He tell me that maybe its the overclock because serial dont like oc'ed. Maybe avast and/or comodo didnt shut down if i exit and this block? I gave up. So i have to visit him again for testing your mega2650 support. god damn, cruel world

I will tell you my news in a few days ... Greetings

jharwinbarrozo commented 4 years ago

@uzi18 Mega2560 with arduino IDE 1.8.10 pre-included bootloader won't work with the esp-link v3.2.47.alpha.22-g6895442-dirty-Lucjan. So I will be burning it with bootloader from this https://github.com/MCUdude/optiboot_flash, hopefully it will work.

Will report back in few hours.

baervers23 commented 4 years ago

Untitled Thats why i didnt getting any flash working -.- please dont use comodo its crap. Now i got my ESP flashed .. today i will reflash the mcucore optiboot and give u report

jharwinbarrozo commented 4 years ago

@uzi18 Mega2560 with arduino IDE 1.8.10 pre-included bootloader won't work with the esp-link v3.2.47.alpha.22-g6895442-dirty-Lucjan. So I will be burning it with bootloader from this https://github.com/MCUdude/optiboot_flash, hopefully it will work.

Will report back in few hours.

@uzi18 I'm not able to test your build using the bootloader from mcudude just yet.

But I have an interesting issue with your v3.2.47.alpha.22-g6895442-dirty-Lucjan. It works well with my pro micro with optiboot bootloader. I can upload via HTTP using curl as well as direct from IDE only when I am connected to my main wifi router inside my room., but when I connect this same esp with the same build and setup on the wifi bridge wifi router located at the living room, arduino IDE won't detect its network port. Though I can access it esp-link panel using its ip address on the computer's browser that is connected to the main router. Any insight on this?

baervers23 commented 4 years ago

@uzi18 First thanks a lot for the fix but in my case im not able to OTA with optiboot using this fix. I writed down my errors in my OTA Issue, i hope it help for debug. But it seems i get no connection because in optiboot is no port. the port variable is used for choose UART. Does i maybe only forget to paste any lines in a config file?

Greetz