Upload hex file from odroid to arduino - AutoModelCar/AutoModelCarWiki GitHub Wiki
Installation process:
Download arduino IDE Linux ARM. Unzip the folder. Copy the folder to odroid.
scp -r arduino-1.8.5 [email protected]:./
Connect to the odroid and install it:
ssh [email protected]
cd arduino-1.8.3
./install.sh
cd ..
Don't care about warnings and errors.
Make Hex file:
Compile your main code, you can find the main code in auto_arduino_nano repository :
git clone [email protected]:AutoModelCar/auto_arduino_nano.git
Checkout based on your car version. For example for model car version three:
git checkout version-3
You can download auto_arduino_nano Folder as well, just select the desired branch from left side, and click on the download ZIP from right side.
Add Libraries to arduino-1.8.5/libraries
Open the arduino IDE. Make the hex file of main code from your computer using Arduino IDE.
- Sketch-> verfiy/compile
- Sketch-> Export compiled Binary
- Sketch-> Show Sketch Folder
You can find the path of the file in terminal by activating show verbose:
File->Prefrences-> Show verbose output during: compilation
For me it is in the main folder. Copy the file to odroid.
cd main
scp main.ino.eightanaloginputs.hex main [email protected]:./
Uploading process:
Make sure that ttyArduino port is not busy by ROS. You can kill whole packages using:
pkill ros
Run the line below to upload the hex file to arduino, the path of hex file should be between w: and :i, for example here the path is "/root/main.ino.eightanaloginputs.hex":
/root/arduino-1.8.3/hardware/tools/avr/bin/avrdude -C/root/arduino-1.8.3/hardware/tools/avr/etc/avrdude.conf -v -patmega328p -carduino -P/dev/ttyArduino -b57600 -D -Uflash:w:/root/main.ino.eightanaloginputs.hex:i
You should see at the end avrdude: ? bytes of flash verified and avrdude done. Thank you..
Reading | ################################################## | 100% 7.86s
avrdude: verifying ...
avrdude: 18612 bytes of flash verified
avrdude: safemode: hfuse reads as 0
avrdude: safemode: efuse reads as 0
avrdude: safemode: Fuses OK (E:00, H:00, L:00)
avrdude done. Thank you.
Show output of arduino
You can use the terminal program minicom to see the output of the arduino board in the odroid terminal window. It should be installed by default. Setup the correct serial port and baud rate first:
minicom -s
Then select 'Serial port setup'. Change 'Serial Device' to /dev/ttyArduino and 'Bps/Par/Bits' to 115200 8N1 (for main.ino) or 9600 8N1 (for initial IMU calibration with IMU_Zero.ino). After that press Enter to go back to main menu. In the 'Screen and keyboard' section you may set the 'Add carriage return' option to Yes. In the main menu select 'Save setup as dfl' and 'Exit from Minicom' to close minicom.
Open minicom again without the setup flag:
minicom
Now you can see the output of the running arduino program. To close the program press Ctrl+A, then Z to open the menu and Q (when pressing X here the configuration will be reset).