I am attempting to program an Arduino Pro Mini OTA via Telnet using an ESP-01S module, using a slightly modified version of JAndrassy's ESP8266 sketch AvrDudeTelnet. This code programs the AVR via the serial port.
The ESP outputs the expected messages on Serial, including IP address. The AVR is in reset while any printing to terminal occurs, but the issue seems to be connecting avrdude to the Telnet server.
My PC is running Ubuntu 18.04.
The terminal output:
$ avrdude -Cavrdude.conf -v -pm328p -carduino -Pnet:192.168.0.104:23 -D -Uflash:w:Blink10x.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 "avrdude.conf"
User configuration file is "/home/bjorn/.avrduderc"
User configuration file does not exist or is not a regular file, skipping
Using Port : net:192.168.0.104:23
Using Programmer : arduino
ioctl("TIOCMGET"): Inappropriate ioctl for device
ioctl("TIOCMGET"): Inappropriate ioctl for device
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x00
...
The error message ioctl("TIOCMGET"): Inappropriate ioctl for device occurs only with option -carduino. I've tried -cstk500v1 and -cstk500v2 but they also time out.
What is wrong here?
Thanks for your help.
I changed the option back to -patmega328p but after 10 times avrdude gives up again.
I have the plain Blink sketch running on the AVR, the one I am trying to upload is 10x faster so it will be obvious when it works. Not so far.
I am running avrdude from the command line. I suppose there is a way to use the IDE set up for network rather than serial ports. I will look for it.
Yes, GPIO0 is connected to the AVR reset pin via an N-MOS transistor and pull-ups for level shifting. This is a quad level shifting module I've used with these modules before.
I added delay(2000) after the ESP Telnet sketch pulls reset low so that I could see the reset pin voltage on a meter. It is indeed pulling it low and the AVR stops blinking.
I double-checked my breadboard wiring, TXD and RXD are cross-connected, both level shifted like reset. Supply voltages are OK, 4.94V and 3.24V.
I also tried a delay(1000) after the reset pin is released, in case the AVR is slow to respond. Nothing so far.
I updated the board libraries to the latest release. I had used 2.7.4 until now because there was a problem with the MySQL connector library with later board defs.
Now using:
ESP8266 Boards (3.0.2), Generic ESP8266 Module
nonos-sdk 2.2.1+100
It made no difference.
I do however see some Serial output from The ESP8266 TXD. I do not have a connection to the AVR TXD.
START
192.168.0.104
0 0 0 0 0 0 0 0 0 0 0 0
The "0 " occur 12 times. Each attempt by avrdude adds "0 ".
This was also present before the board SW upgrade.
It looks like the ESP is trying to communicate with the AVR but something gets hung up.
Is 115200 the right baud rate?
That was it, solved!
I noticed that when the IDE programs the Pro Mini over serial, avrdude gets the option -b57600.
I changed the Serial speed in AvrDudeTelnet to 57600 and now the upload works. Using the same chip as the Uno, I though the Pro Mini would use the same baudrate. An older boot loader perhaps?
Thanks Juraj for your help troubleshooting this issue. And thanks for the very simple solution to program the Arduino OTA with Telnet. I have been looking for something like this for a long time.