I got an AST CAN485 board last year and had no problem uploading the code several times during development. It’s been running in my EV for a year. Now, I’m trying to upload a new version of my sketch and I get the following error:
Sketch uses 10890 bytes (8%) of program storage space. Maximum is 130048 bytes.
Global variables use 647 bytes (15%) of dynamic memory, leaving 3449 bytes for local variables. Maximum is 4096 bytes.
An error occurred while uploading the sketch
avrdude: verification error, first mismatch at byte 0x0000
0x14 != 0x0c
avrdude: verification error; content mismatch
The sketch compiles and appears to upload but then fails immediately on verify. The board is still working in my car but I need to upload a new version of the sketch.
Nothing else has changed. I’m using the same computer, same usb cable, same FTDI interface. I just made a tiny change to the code to fix a bug. I can see the DTR pin go low during upload. It’s at 5v before upload, goes to 0v during upload and then returns to 5v. The computer, cable and FTDI interface work on another CAN485 board.
Does anyone have an idea what might be wrong?
What FTDI are you using? Is it a CH340 based USB to serial adapter? We’ve seen this happen sometimes with the CH340.
Is the code actually working after the upload? Sometimes when this happens your code makes it to the board and the verification fails but everything is OK.
Hi Chris,
Thanks for the quick response. I’m using the SparkFun FTDI Basic Breakout - 5V DEV-09716.
The code works but I just assumed it was the old version. My update is for a rare case that I didn’t test. I guess I could make some sort of change that would be easier to test if you think it might be working.
Hey again. My apologies for the delay.
Okay, I am actually not entirely sure what the issue is with that device. I suppose you could try a different version of Arduino and see if that works, though you mention the same exact setup works on a different CAN485 board.
I think the part might just have a defect somewhere. Could have been due to static shock somewhere. If I had to guess it sounds like the board is not getting the reset signal needed to erase the old sketch.
I suppose you could try a manual reset during upload and see if that works.
See this post for more info and try googling “manual reset Arduino during upload” for more info: https://forum.arduino.cc/index.php?topic=283360.0
I hope this helps.
Thank you again for your help.
I’ve tried hitting reset many times during the upload. I’ve tried to time it after the compile and after the apparent upload before the verify. I’ve been able to get some different errors but never had a successful upload/verify.
I will try to upload a self-running test program to see if any upload is successful. That will be the easiest way to tell if the upload is actually working even though there is an error.