Arduino Sketch is not Uploading into Arduino Mega 2560 - arduino

I am trying to upload a sketch into Arduino Mega 2560, but it's not uploading. It's showing an error message-
avrdude: verification error, first mismatch at byte 0x0000
0xbf != 0x06
avrdude: verification error; content mismatch
It was just working fine since I used it last time. Suddenly it has just stopped working.

i would check that avrdude was able to write any bytes of the flash section:
read current flash:
avrdude -c arduino -p atmega2560 -P /dev/arduino -b 57600 -U flash:r:flash.0.bin:r
write something(different) into it
avrdude -c arduino -p atmega2560 -P /dev/arduino -b 57600 -U flash:w:something.hex:i
read it back
avrdude -c arduino -p atmega2560 -P /dev/arduino -b 57600 -U flash:r:flash.2.bin:r
check if anything have changed:
md5sum flash*
if the 2 sums are the same...avrdude can't change the fw inside the device...there are lockbits which may prevent it...because lockbits can't be turned back on: in this case you should write a new bootloader into the device using another arduino or a stock avrisp...(dont worry...it's easy)
if the sums are different...and the board is apparently running the firmware you have loaded...something inside the arduino ide is messed up
hope this helps ;)

Related

How to read arduino flash memory

Imagine i'have lost my source code.
Is there a way to dump an arduino flash memory ?
What i want to do is to get an hex file on my PC that represent byte per byte the arduino flash memory (including bootloader)
I have 3 arduino types:
Arduino UNO (rev3)
Arduino MEGA
Leonardo Ethernet
Thanks
avrdude can do that for you. The specifics will depend on which arduino you have, but something like:
avrdude -p m328p -P usb -c usbtiny -U flash:r:flash.bin:r
will get you the contents of the flash memory.
Here's a site with more info:
http://www.evilmadscientist.com/2011/avr-basics-reading-and-writing-flash-contents/
It seems that using an Arduino board, the programmer (option -c) must be set to arduino (see the avrdude manual for details). Also, I had to specify the ACM port (in my case /dev/ttyACM0 on a Linux machine).
The full command to read (and backup the flash to flash.bin) is thus:
avrdude -p m328p -P /dev/ttyACM0 -c arduino -U flash:r:flash.bin:r
And to restore the flash, you can use:
avrdude -p m328p -P /dev/ttyACM0 -c arduino -U flash:w:flash.bin

FT232RL out of sync

Hi I have a FT232RL board that I'm trying to use to program an arduino (ATmega328p). Ive tried to use the arduino IDE to upload the sketch but it keeps giving me programmer not responding. I also tried to use avrdude from the command line and that gave me:
avrdude -p m328p -c stk500v1 -P com4 -b 115200
avrdude: stk500_getsync(): not in sync: resp=0x00
I have tried multiple baudrates and still same thing.
When its trying to upload I do see a light blink which I presume to be the Rx but don't see the Tx one light.
Here is the link to the board I am using.
After some more testing and playing around with the the chips, I found out what the problem was. When trying to upload a sketch to the atmega it was placed in the arduino board. Everything was wired up correctly even added a 100nf Cap for the reset and still nothing, but apparently with the arduino board I had to hold the reset till the IDE said uploading and for avrdude when I hit enter. I then tried this on my DIY arduino board and I didnt have to hit the reset button... Anyways it was just a bootloader timing problem.
avrdude -cstk500v1 -pm328p -Pcom4 -b115200 -U flash:w:Test.hex -F
This is the avrdude command line command I used to get it working.
Thanks for everyones help

Updating Arduino Wifi shield firmware update

I was trying to upgrade the wifi shield firmware as per the instructions provided on
http://arduino.cc/en/Hacking/WiFiShieldFirmwareUpgrading
But I am getting the messege as
root#Joms-PC:/home/joms/arduino-1.0.5/hardware/arduino/firmwares/wifishield/scripts# ./ArduinoWifiShield_upgrade.sh -f all
Arduino WiFi Shield upgrade
=========================================
Instructions:
To access to the USB devices correctly, the dfu-programmer needs to have the root permissions.
You can upgrade the firmware of the antenna togheter with the shield firmware or only the shield firmware
if there aren't changes on the antenna firmware.
Use the '-h' parameter for help
=========================================
How to provide root permission for dfu-programmer which I installed by
sudo apt-get install dfu-programmer
if that is the issue??? Or should I try something else
You need to run the script with sudo:
sudo ./ArduinoWifiShield_upgrade.sh -f all
also you will need to add the path to your Arduino IDE files with the -a switch (it has to be before the -f switch) so:
sudo ./ArduinoWifiShield_upgrade.sh -a PATH/TO/ARDUINO/FILES -f all
replace PATH/TO/ARDUINO/FILES with the path to where you have extracted the Arduino files.

Can´t upload code to Arduino Uno using stino and Ubuntu 12.04 (Precise Pangolin)

I have installed stino on Sublime Text 2 succesfully, but when I try to upload my code to Arduino Uno, the output is the following:
Uploading /home/lucas/Arduino_Build/programa_teste/programa_teste.hex to Arduino Uno...
avrdude: ser_open(): can't open device "/dev/ttyACM0": Permission denied
ioctl("TIOCMGET"): Inappropriate ioctl for device
[Stino - Error while uploading.]
I have the Arduino IDE installed, and it is working fine, only Sublime Text can´t upload the code.
well, as #Bibhas says, your problem is that /dev/ttyACM0 is having the wrong permissions, and that has nothing to do with Arduino or sublime text. It's the linux kernel who creates character devices per default with no user permissions.
But good thing is that it can be changed!
The fast and easy solution is to add your current user to the dialout group:
sudo adduser YOU dialout
where YOU is your username and then log out and log back in to have those new permissions propagated into your shells.
Hint:
There's a solution that is a bit more complicated, is to create a udev rule such as:
/etc/udev/rules.d/48-arduino.rules
SUBSYSTEM!="usb_device", ACTION!="add", GOTO="arduino_end"
SUBSYSTEM=="tty", ATTRS{idVendor}=="2341", ATTRS{idProduct}=="0036", MODE="660", GROUP="arduino", SYMLINK+="arduino.leonardo"
LABEL="arduino_end"
which creates a /dev/arduino device readable and writable by the arduino group, that you need to create (or you can use the default dialout group which is perfectly fine):
addgroup arduino
adduser YOU arduino
and then reload your rules:
sudo udevadm control --reload-rules
The nice thing about that second hint is that when you unplug replug your arduino, you won't have it change device number oddly, it will be kept to the name. If you're not using an arduino leonardo, you can check your device idvendor/idproduct using lsusb:
% lsusb
… ↓↓↓↓ ↓↓↓↓
Bus 006 Device 105: ID 2341:0036 Arduino SA
…
HTH
Accoding the Troubleshooting doc, I use
sudo usermod -a -G tty yourUserName
sudo usermod -a -G dialout yourUserName
fix my problem.
I have the same problem today, and the incredible happend. The USB cable gave power to the Arduino, but doesn't allow the communication. The solution for us was to change the USB cable, and after that everything worked

Agilent 66332A DC Source RS232 Ubuntu 12.04 SCPI

I have an Agilent 66332A DC Source, and I want to program it so that I can set the current, voltage, and output on/off. I'm using Ubuntu 12.04 64bit so the drivers don't work. I've contacted Agilent support, and they gave me nothing. I know that the DC source uses SCPI. Is there some way that I can talk to the DC source using the terminal and send SCPI commands? I've tried minicom, but I couldn't get it to work. I'm using a RS232 connection.
There might be manual for this DC source so read SCPI commands from there.
I assume that minicom sends line-feed character after each enter you press, but SCPI requires \n for command separator. Hence the Minicom does not work.
However you can just echo commands to serial port from bash command line.
Setup serial port
stty -F /dev/ttyS0 raw speed 9600 -cstopb cs8 -ixon
Echo commands to /dev/ttyS0
echo -en '*RST\n' > /dev/ttyS0
Notice: I'm assuming your device is connected to /dev/ttyS0.

Resources