Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot flash Arduino R3 through ESP-Link #582

Open
OevreFlataeker opened this issue Sep 22, 2024 · 1 comment
Open

Cannot flash Arduino R3 through ESP-Link #582

OevreFlataeker opened this issue Sep 22, 2024 · 1 comment

Comments

@OevreFlataeker
Copy link

I am using "esp-link v2.2.3 - 2016-06-21 21:58:48 - 1bcdc62", with a Wemos D1 ESP8266 v4 and am not able to flash a connected Arduino Uno R3 and cannot figure out what's the issue.

Flashing through Arduino IDE works without issues.

Log from Arduino IDE:

"C:\Users\daubsi\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude" "-CC:\Users\daubsi\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf" -v -V -patmega328p -carduino "-PCOM7" -b115200 -D "-Uflash:w:C:\Users\daubsi\AppData\Local\Temp\arduino\sketches\B8D716BED634ADE6A4F71C75ED0486D9/Blink2.ino.hex:i"

avrdude: Version 6.3-20190619
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Users\daubsi\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"

         Using Port                    : COM7
         Using Programmer              : arduino
         Overriding Baud Rate          : 115200
         AVR Part                      : ATmega328P
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PC2
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : Arduino
         Description     : Arduino
         Hardware Version: 3
         Firmware Version: 4.4
         Vtarget         : 0.3 V
         Varef           : 0.3 V
         Oscillator      : 28.800 kHz
         SCK period      : 3.3 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: reading input file "C:\Users\daubsi\AppData\Local\Temp\arduino\sketches\B8D716BED634ADE6A4F71C75ED0486D9/Blink2.ino.hex"
avrdude: writing flash (1992 bytes):

Writing | ################################################## | 100% 0.33s

avrdude: 1992 bytes of flash written

avrdude done.  Thank you.

I've disconnected USB and connected RX, TX, GND, Reset and VCC (to VBus of Wemos) between the Arduino Uno R3 and the Wemos and can see the serial output from the Uno R3 on the esp-links' web console.

It prints "Reset!" during the setup() function and then "OnOffOnOff.." during the loop() function and blinks the LED.

image

When I click "Reset" on the web-console the MC resets and restarts the program without issue. ESP-link and Uno R3 are connected at 115200 baud.

When I try AVRdude I can never get the initial sync to complete:

PS D:\avrdude63> .\avrdude.exe -DV -patmega328p -Pnet:192.168.0.175:23 -carduino -b115200 -U -C avrdude.conf flash:w:C:\Users\daubsi\AppData\Local\Temp\arduino\sketches\B8D716BED634ADE6A4F71C75ED0486D9/Blink2.ino.hex:i
avrdude.exe: ser_drain(): read error: The parameter is incorrect.

avrdude.exe: ser_drain(): read error: The parameter is incorrect.

avrdude.exe: ser_drain(): read error: The parameter is incorrect.

avrdude.exe: stk500_getsync() attempt 1 of 10: not in sync: resp=0x4f
avrdude.exe: stk500_getsync() attempt 2 of 10: not in sync: resp=0x66
avrdude.exe: stk500_getsync() attempt 3 of 10: not in sync: resp=0x66
avrdude.exe: stk500_getsync() attempt 4 of 10: not in sync: resp=0x52
avrdude.exe: stk500_getsync() attempt 5 of 10: not in sync: resp=0x65
avrdude.exe: stk500_getsync() attempt 6 of 10: not in sync: resp=0x73
avrdude.exe: stk500_getsync() attempt 7 of 10: not in sync: resp=0x65
avrdude.exe: stk500_getsync() attempt 8 of 10: not in sync: resp=0x74
avrdude.exe: stk500_getsync() attempt 9 of 10: not in sync: resp=0x21
avrdude.exe: stk500_getsync() attempt 10 of 10: not in sync: resp=0x0d
avrdude.exe: ser_drain(): read error: The parameter is incorrect.


avrdude.exe done.  Thank you.

PS D:\avrdude63> .\avrdude.exe -DV -patmega328p -Pnet:192.168.0.175:23 -carduino -b115200 -U -C avrdude.conf flash:w:C:\Users\daubsi\AppData\Local\Temp\arduino\sketches\B8D716BED634ADE6A4F71C75ED0486D9/Blink2.ino.hex:i
avrdude.exe: ser_drain(): read error: The parameter is incorrect.

avrdude.exe: ser_drain(): read error: The parameter is incorrect.

avrdude.exe: ser_drain(): read error: The parameter is incorrect.

avrdude.exe: stk500_getsync() attempt 1 of 10: not in sync: resp=0x4f
avrdude.exe: stk500_getsync() attempt 2 of 10: not in sync: resp=0x6e


avrdude.exe: stk500_getparm(): (a) protocol error, expect=0x14, resp=0x52

avrdude.exe: stk500_getparm(): (a) protocol error, expect=0x14, resp=0x65
avrdude.exe: stk500_initialize(): (a) protocol error, expect=0x14, resp=0x73
avrdude.exe: initialization failed, rc=-1
             Double check connections and try again, or use -F to override
             this check.

avrdude.exe: stk500_disable(): protocol error, expect=0x14, resp=0x65

avrdude.exe done.  Thank you.

PS D:\avrdude63> .\avrdude.exe -DV -patmega328p -Pnet:192.168.0.175:23 -carduino -b115200 -U -C avrdude.conf flash:w:C:\Users\daubsi\AppData\Local\Temp\arduino\sketches\B8D716BED634ADE6A4F71C75ED0486D9/Blink2.ino.hex:i
avrdude.exe: ser_drain(): read error: The parameter is incorrect.

avrdude.exe: ser_drain(): read error: The parameter is incorrect.

avrdude.exe: ser_drain(): read error: The parameter is incorrect.

avrdude.exe: stk500_getsync() attempt 1 of 10: not in sync: resp=0x4f
avrdude.exe: stk500_getsync() attempt 2 of 10: not in sync: resp=0x6e
avrdude.exe: stk500_getsync() attempt 3 of 10: not in sync: resp=0x52
avrdude.exe: stk500_getsync() attempt 4 of 10: not in sync: resp=0x65
avrdude.exe: stk500_getsync() attempt 5 of 10: not in sync: resp=0x73
avrdude.exe: stk500_getsync() attempt 6 of 10: not in sync: resp=0x65
avrdude.exe: stk500_getsync() attempt 7 of 10: not in sync: resp=0x74
avrdude.exe: stk500_getsync() attempt 8 of 10: not in sync: resp=0x21
avrdude.exe: stk500_getsync() attempt 9 of 10: not in sync: resp=0x0d
avrdude.exe: stk500_getsync() attempt 10 of 10: not in sync: resp=0x0a
avrdude.exe: ser_drain(): read error: The parameter is incorrect.


avrdude.exe done.  Thank you.

As you can see from the "resp" bytes, avrdude seems to receive the serial output from the Arduino: 0x4f 0x64 = On
0x52 0x65 0x73 0x65 0x74 0x21 = "Reset!"....

During avrdude's connection attempt I can see the LED on the Arduino blinking a little bit faster then returning to normal.

There is no difference, no matter if I have esp-links MC console open or not.
image

image

GPIO 5 == D1 == SCL
I can see activity when the board should reset during connection setup.

Debug log:

358684> HTTP GET /log/text: 200, 188ms, h=20424
358756> HTTP GET /log/dbg: 200, 1344ms, h=22448
364211> HTTP GET /log/dbg: 200, 269ms, h=22080
364235> HTTP GET /log/text: 200, 193ms, h=22440
375860> Accept port 23, conn=0x3fff6458, pool slot 0
376184> MCU Reset=gpio5 ISP=gpio12
376721> serbridge: connection reset err=-9
378861> HTTP GET /log/dbg: 200, 271ms, h=22072
379001> HTTP GET /log/text: 200, 280ms, h=22456
386582> Accept port 23, conn=0x3fff6458, pool slot 0
386893> MCU Reset=gpio5 ISP=gpio12
388469> serbridge: connection reset err=-9

ISP/Flash on GPIO 12 is NOT connected - I don't need that one, right?

I've also tried the HTTP Upload but can't get it to work either:

daubsi@bigigloo $ curl -X POST http://192.168.0.175/pgm/sync
daubsi@bigigloo $ curl http://192.168.0.175/pgm/sync
NOT READY%                                                                                                                       
daubsi@bigigloo $ curl http://192.168.0.175/pgm/sync
SYNC at 115200 baud: bootloader v4.4%                                                                                            
daubsi@bigigloo $ curl -v -X POST --data-binary '@/tmp/Blink2.ino.hex' http://192.168.0.175/pgm/
*   Trying 192.168.0.175:80...
* Connected to 192.168.0.175 (192.168.0.175) port 80 (#0)
> POST /pgm/upload HTTP/1.1
> Host: 192.168.0.175
> User-Agent: curl/7.88.1
> Accept: */*
> Content-Length: 5524
> Content-Type: application/x-www-form-urlencoded
>
* HTTP 1.0, assume close after body
< HTTP/1.0 400 ERROR
< Server: esp-link
< Connection: close
< Cache-Control: no-cache, no-store, must-revalidate
< Pragma: no-cache
< Expires: 0
<
* Closing connection 0
Timeout waiting for flash page to be programmed%  
@uzi18
Copy link
Contributor

uzi18 commented Sep 23, 2024

update to 3.2.x first

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants