# Installation * install arduino from official website. v1.8 is preferred. https://www.arduino.cc/en/software * install stm32 boards from STM32DUINO. link: https://github.com/stm32duino/Arduino_Core_STM32/wiki/Getting-Started * install STM32 programmer: link: https://www.st.com/en/development-tools/stm32cubeprog.html * set all parameters. link: https://www.sgbotic.com/index.php?dispatch=pages.view&page_id=49 # ROS-dependency * dependancy: ``` sudo apt install ros-noetic-rosserial-python sudo apt install ros-noetic-rosserial-arduino ``` # Build library * custom rosmsg custom rosmsg are in "stm_client" pkg. build the package. open terminal * source the workspace. ``` source {workspace}/devel/setup.bash ``` go to following directory: > cd /home/${USER}/Arduino/libraries run the following command: ``` rosrun rosserial_arduino make_libraries.py . ``` # add non-ros lib * stm_code are avialable on github. * inside the folder there is folder named "lib" or ("library") (not sure.) * copy the files inside it to the following location: > cd /home/${USER}/Arduino/libraries # Upload code you can upload code by following 2 methods: 1. DFU method 1. connect type-C port to PC. 2. open STm32-Cube-Programmer.![](https://hackmd.io/_uploads/HJKL8QE03.png) 3. Select "USB" in the top-right blue box. 4. now, follow the step: * hold "BOOT" button. * press "NRST" button. * wait for 1-second. * release the "NRST" button. * and then release the "BOOT" button. 5. Click on "refresh" symbol in front of "Serial number". 6. If the serial number gets refreshed then follow the next procedure otherwise repeat the above steps until you get the "serial_number". It may take some time. 7. open the Arduino-code that you wish to upload. 8. in the below link the procecdure is given about the settings for uploading the code. https://www.sgbotic.com/index.php?dispatch=pages.view&page_id=49 2. TTL method 1. connect USB-TTL pins to STM32. * Tx pin -> PA10(Stm32 Rx pin) * Rx pin -> PA9(Stm32 Tx pin) * gnd pin -> gnd pin * vcc pin -> 3.3V pin 2. make sure that jumper on USB-TTL is set to 3.3V. 3. connect the USB-TTL to PC. 4. follow the steps given in step-4 of the DFU-method.(now, follow the step...) 5. follow the same settings given in step-8 of DFU-method except change the following settings. * change "Upload method" to "STM32CubeProgrammer(Serial)" * Select the appropriate port. 6. Compile the code and then upload it. This should upload the code. If not repeat from step-4 again. It may take some time. **Note:** If error persists for a long time, search the error on internet. I am sure you are not the first person to encounter the error.