Arduino Setup Linux
Contents
- USB port settings
- Compiler Settings
- Install the Arduino IDE
- Run the Arduino IDE
- Porting the OpenCR board to the Arduino IDE
- Install the OpenCR package via Boards Manager
- Modemmanager removal
- Bootloader writing
USB port settings
Make the OpenCR USB port be able to upload the Arduino IDE program without root permission.
wget https://raw.githubusercontent.com/ROBOTIS-GIT/OpenCR/master/99-opencr-cdc.rules
sudo cp ./99-opencr-cdc.rules /etc/udev/rules.d/
sudo udevadm control --reload-rules
sudo udevadm trigger
Compiler Settings
Since the OpenCR libraries is built for 32 bit platform, 64 bit PC needs the 32 bit compiler relevants for the ArduinoIDE.
sudo apt-get install libncurses5-dev:i386
Install the Arduino IDE
Download the latest version of Arduino IDE from the official arduino homepage, and install it. Currently, the OpenCR will be on service in the version 1.6.4 or later.
https://www.arduino.cc/en/Main/Software
Then, extract the downloaded file to the desired folder and execute the installation file from the terminal. In this case, the example shown below makes the folder tools in the user’s top folder (~/). This folder will act as the Arduino IDE folder.
cd ~/tools/arduino-1.16.0
./install.sh
Set the file path of installed Arduino IDE as an absolute path named PATH in the bashrc file. Here recommends to use gedit editor. (Use another editor, if necessary.) Finally, source it to apply the changes.
gedit ~/.bashrc
export PATH=$PATH:$HOME/tools/arduino-1.16.0
source ~/.bashrc
Run the Arduino IDE
To run the Arduino IDE on Linux platform, type into the terminal as follows.
arduino
Porting the OpenCR board to the Arduino IDE
Preferences
After Arduino IDE is run, click File → Preferences in the top menu of the IDE. When the Preferences window appears, copy and paste following link to the Additional Boards Manager URLs textbox. (This step may take about 20 min.)
https://raw.githubusercontent.com/ROBOTIS-GIT/OpenCR/master/arduino/opencr_release/package_opencr_index.json
Install the OpenCR package via Boards Manager
Click Tools → Board → Boards Manager.
Type OpenCR into the textbox to find the OpenCR by ROBOTIS package. After it finds out, click Install.
After the installation, “INSTALLED” will be appeared.
See if OpenCR Board is now on the list of Tools → Board. Click this to import the OpenCR Board source.
Port setting
This step shows the port setting for the program uploads. The OpenCR should be connected to the PC and the OpenCR via the USB ports.
Select Tools → Port → /dev/ttyACM0.
The value of /dev/ttyACM0 may be different depending on the environment connected to the PC.
(TODO : the programmer in the picture should be changed into not the AVRISP mkll)
Modemmanager removal
After programming with the Arduino IDE and uploading the program to the OpenCR, the OpenCR will be restarted and be reconnected. At the same moment, the modem-related packages of the Linux will send the AT command to manage the device. Thus indicates an connection error on the OpenCR, so this step should be done previously.
sudo apt-get purge modemmanager
Bootloader writing
Update only if the boot loader version has been changed.
The STM32F7xx, which is used for the main MCU on the OpenCR board, supports DFU(Device Firmware Upgrade). This enables the built-in bootloader of the MCU by itself to boot the DFU protocol by using USB, primarily for the bootloader initialization, the recovery mode, and the bootloader update. The biggest advantage to let the users be able to use bootloader with USB but no other JTAG equipment. Write the firmware by using the DFU mode which is embedded in MCU without writing / debugging equipment, such as STLink.
Programmer Setting
Select Tools → DFU-UTIL
Run DFU mode.
Press the Reset button while the Boot button is being pushed. This activates the DFU mode.
Download the bootloader.
Click Tools → Burn Bootloader to download the bootloader.