I did a bit more poking around, because I’m 99% confident my serial cable is ok (I can perform the RF config routine just fine, so transmit and receive are working)
Here’s what I did just now:
- I turned verbose mode on for uploads on the Arduino IDE
- From the upload output, I grabbed the avrdude command-line, which was this:
D:\dev\arduino\arduino-1.8.5\hardware\tools\avr/bin/avrdude -CD:\dev\arduino\arduino-1.8.5\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -carduino -PCOM7 -b115200 -D -Uflash:w:C:\Users\heckler\AppData\Local\Temp\arduino_build_471158/src.ino.hex:i
- In order to increase the verbosity level, I’ve added a few more "-v"s to the command line, and ended up with this version:
D:\dev\arduino\arduino-1.8.5\hardware\tools\avr/bin/avrdude -CD:\dev\arduino\arduino-1.8.5\hardware\tools\avr/etc/avrdude.conf -v -v -v -v -patmega328p -carduino -PCOM7 -b115200 -D -Uflash:w:C:\Users\heckler\AppData\Local\Temp\arduino_build_471158/src.ino.hex:i
- Now, when I ran the command above, skipping right to the part where the program is trying to upload the sketch, I see the following output:
Using Port : COM7
Using Programmer : arduino
Overriding Baud Rate : 115200
avrdude: Send: 0 [30] [20]
avrdude: Send: 0 [30] [20]
avrdude: Send: 0 [30] [20]
avrdude: Recv: c [63]
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x63
avrdude: Send: 0 [30] [20]
avrdude: Recv: t [74]
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x74
avrdude: Send: 0 [30] [20]
avrdude: Recv: 1 [31]
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x31
avrdude: Send: 0 [30] [20]
avrdude: Recv: : [3a]
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x3a
avrdude: Send: 0 [30] [20]
avrdude: Recv: 0 [30]
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x30
avrdude: Send: 0 [30] [20]
avrdude: Recv: , [2c]
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x2c
avrdude: Send: 0 [30] [20]
avrdude: Recv: c [63]
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x63
avrdude: Send: 0 [30] [20]
avrdude: Recv: t [74]
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x74
avrdude: Send: 0 [30] [20]
avrdude: Recv: 2 [32]
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x32
avrdude: Send: 0 [30] [20]
avrdude: Recv: : [3a]
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x3a
avrdude done. Thank you.
If you watch carefully the 10 attempts, you see that the avrdude starts by sending three time the sequence ‘0’ + ’ ’ (a zero, hex code 30, followed by a space, hex code 20), then does a receive, and get a ‘c’ (hex 63). On the next attempt it sends "0 " again and receives a ‘t’, and so on. If you see the characters that it received back during those 10 attempts, they are the serial log emitted by the emonTx: ct1:0,ct2:0,ct3:0,ct4:0,vrms:501,pulse:0
I’m not fully familiar with how a programmer like avrdude interacts with the bootloader in the atmega, but it seems to me that it is sending the string "0 " and hoping for some response from the board that it is not getting.
I also did a similar “verbose” test with an arduino board I have here, and I noticed that the board does respond to the initialization sequence from avrdude:
Using Port : COM4
Using Programmer : arduino
Overriding Baud Rate : 19200
avrdude: Send: 0 [30] [20]
avrdude: Send: 0 [30] [20]
avrdude: Send: 0 [30] [20]
avrdude: Recv: . [14]
avrdude: Recv: . [10]
AVR Part : ATmega168
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PC2
RESET disposition : dedicated
Any thoughts?