Hi everyone. I am very new to the Arduino coding thing and I am having issues with getting the basic sketch uploaded to my controller. I am using a MacBook Air with atmel mega 328pb nano micro controller and when I try to upload the sketch I am getting the following error.
Failed uploading: cannot execute upload tool: fork/exec /Users//Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino9/bin/avrdude: bad CPU type in executable
I have installed Rosetta 2 and it is still not working. I have also noticed that the rx light on the MC is also not coming on but the pwr and tx is permanently on.
Just to be sure, by "still not working", do you mean that you are still encountering that "bad CPU type in executable" error when you attempt to upload a sketch to the board? Or are you experiencing a different problem now after installing Rosetta 2?
I see the cause of the error now. The problem is that the version of the AVRDUDE tool being used to upload a sketch to the board is a 32-bit application.
Support for such applications was dropped starting from macOS Catalina:
In order to understand the best way to solve this problem, I'm going to ask you to provide the full verbose output from a compilation.
This procedure is not intended to solve the problem. The purpose is to gather more information.
Please do this:
Open any sketch in Arduino IDE.
Configure Arduino IDE for use with the "atmel mega 328pb nano micro controller", just as you did before when the upload failed.
Select File > Preferences... (or Arduino IDE > Settings... for macOS users) from the Arduino IDE menus.
The "Preferences" dialog will open.
Check the box next to "Show verbose output during: ☐ compile" in the "Preferences" dialog.
Click the "OK" button.
The "Preferences" dialog will close.
Select Sketch > Verify/Compile from the Arduino IDE menus.
Wait for the compilation to finish.
Right click on the black "Output" panel at the bottom of the Arduino IDE window.
A context menu will open.
Select Copy All from the menu.
Open a reply here on this forum topic by clicking the "Reply" button.
Click the <CODE/> icon on the post composer toolbar.
This will add the forum's code block markup (```) to your reply to make sure the error messages are correctly formatted.
Press the Ctrl+V keyboard shortcut (Command+V for macOS users).
This will paste the compilation output into the code block.
Move the cursor outside of the code block markup before you add any additional text to your reply.
Click the "Reply" button to publish the post.
In case the output is longer than the forum software will allow to be added to a post, you can instead save it to a .txt file and then attach that file to a reply here.
Select the .txt file you saved from the "Open" dialog.
Click the "Open" button.
The dialog will close.
Click the "Reply" button to publish the post.
Alternatively, instead of using the "Upload" icon on the post composer toolbar as described in steps (5) - (7) above, you can simply drag and drop the .txt file onto the post composer field to attach it.
OK, I see you are using the 3rd party "Atmel AVR Xplained-minis" boards platform. Maintenance of this platform was abandoned a decade ago, so that is why it still uses a version of the upload tool that has been obsolete for many years.
If you are using one of the Chinese ATmega328PB-based Nano derivative boards that are common on online marketplaces, then you should be able to use the board definition for the original Arduino Nano board (even though the derivative boards use a different microcontroller model, they have configured the boards to work like the original):
Select Tools > Board > Arduino AVR Boards > Arduino Nano from the Arduino IDE menus.
Select Sketch > Upload from the Arduino IDE menus.
Hopefully the upload will be successful and everything will work as expected. If not, provide the output from the upload attempt in a reply here on the forum topic and we'll provide assistance with overcoming the new problem.
Copy the avrdude executable from the current Arduino AVR board install to the Xplained-mini board install. Something like (in "terminal"):
# save old avrdude, just in case
mv ~/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino9 ~/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino9-old
# replace it with the newer avrdude
cp -R ~/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/ ~/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino9
This worked for my (albeit on an Intel Mac.) There may have been a time when the main avrdude did not support the Xplained boards, but that's long past...