Problem with "Upload Arduino Firmware"failed


Today,I burn my friend’s code to controlboard via ISP. My partner wanted to revert original code,so we Upload Arduino Firmware via cockpit.But I was told that Arduino Firmware compile failed.I apply Image to BBB again,but Arduino Firmware compile still failed.And I retry ISP via Arduino IDE,it come up with this issue:

Now,my controlboard is running my friends testing code,without original control code.And I can’t revert original code.What should I do? Is it possible that ATmega2560 is broken? I am so scared:cry:


@Brian_Grau @badevguru could you help me:sob:


If the test code that was loaded on the controller board running and working?

I’ll need to see more of the error log to see why the upload firmware failed. I can see it failed during the compile step (before it ever tries to send code to the Arduino). If you open a terminal to the ROV, and execute

sudo avrdude -P /dev/spidev1.0 -c linuxspi -vv -p m2560 > /dev/null 2>&1

You should get a value of 0. If it is a value of 1, the beaglebone is having trouble talking to the Arduino over the SPI line.


I do Upload Arduino Firmware via cockpit again,it was also failed.I enter
sudo avrdude -P /dev/spidev1.0 -c linuxspi -vv -p m2560 > /dev/null 2>&1
and terminal print nothing.This is what terminal print when I enter
sudo avrdude -P /dev/spidev1.0 -c linuxspi -vv -p m2560:


I use terminal to upload firmware and get error with this:
src/CControllerBoard.cpp:29:18: error: ‘A8’ was not declared in this scope
int temppin = A8;
.build/uno/Makefile:392: recipe for target ‘.build/uno/src/CControllerBoard.o’ failed
make: *** [.build/uno/src/CControllerBoard.o] Error 1
Make failed with code 2


Uhm, that’s so strange. Last month I also came up with this problem and annoys me a lot.


Did you guys get any progress ?


That error is a little tricky to figure out. What is happening to cause that is that the script in /opt/openrov/cockpit/linux/ is unable to detect which controller board you are on. It checks that by trying to communicate to the ATmega2560 over the SPI port. If you have altered your linux setup in a way that makes the SPI port inaccessible, or if your controllerboard is damaged in some way that damages the ATMega or the SPI bus, the script will fail to detect the arduino. Since that version of the software still supports the Cape setup, it will assume that a lack of Arduino on the SPI port means you must be connected to an Arduino ATMega328p on the cape, and will attempt to build the firmware for that target. The 328p does not have an A8 pin, so the compilation will fail in the manner you are seeing.

In summary, you may have a damaged controllerboard or you may have inadvertently compromised your SPI interface on the BBB and may want to contact support.


I have use another new BBB but it still fail,I think I need contact support…If controllerboard was actually broken, what should I do:cry:


I had also faced the same issue.Just remove the A from A8.It will start working


While that would work to fix the compilation step, it won’t fix your ability to communicate over SPI to the atmega, so you won’t be able to upload the code you compiled.

@Trinh I just noticed in one of your earlier posts that you tried to build your code using:

sudo ino build

I hadn’t noticed that before. The better way to compile and upload to your board is going to be the command:

sudo /opt/openrov/cockpit/linux/arduino/

This will call the correct configuration and board detection scripts and set up the ino build for the proper chipset, then after compilation will upload the binary to the MCU. Try this first. If you still run into the same issue, then I believe you are looking at a damaged controller board, as described before.