Motor drive: Difference between revisions

From Rsewiki
Line 50: Line 50:
* some other minor stuff.
* some other minor stuff.


== Compile and upload ==
== Moror drive ==


Compile and upload to Teensy
Compile and upload to Teensy.


  cd ~/scorpi/motor_drive
  cd ~/scorpi/motor_drive
  make
  make


This should produce a file called motor_drive.hex ready to be uploaded:
This should produce a file called motor_drive.hex, ready to be uploaded:


NB! before you upload, press the power reset button, to avoid power shutdown.
NB! Before you upload, press the power reset button to avoid power shutdown.


  Press had hold "power reset"
  Press had hold "power reset"

Revision as of 20:41, 18 April 2024

Back to scorpi

Load arduino and Teensyduino

Install Arduino version 1.8.19 for the platform, find it here https://www.arduino.cc/en/software

Unpack in the Downloads directory (to fit the path in the Makefile)

cd ~/Downloads
tar -xf arduino-1.8.19-linuxaarch64.tar.xz

Install Teensyduino from https://www.pjrc.com/teensy/td_download.html

Make the installer executable and install it on top of the Arduino installation.

chmod +x TeensyduinoInstall.linuxaarch64
./TeensyduinoInstall.linuxaarch64

Additional Arduino libraries

Additional libraries from Ardufruit are needed for the small display:

  • Adafruit_BusIO to get additional services from the I2C interface
  • Adafruit-GFX-Library to get the paint functions for the display
  • Adafruit_SSD1306 to get the specifics for the used display
git clone https://github.com/adafruit/Adafruit_BusIO.git
git clone https://github.com/adafruit/Adafruit_SSD1306.git
git clone https://github.com/adafruit/Adafruit-GFX-Library
git clone https://github.com/pfeerick/elapsedMillis.git

The obtained libraries should be included in the Arduino/Teensyduino library list, e.g. if the GIT repositories are in a ~/git directory:

cd Arduino-1.8.19/hardware/teensy/avr/libraries
ln -s ~/git/Adafruit_BusIO
ln -s ~/git/Adafruit-GFX-Library
ln -s ~/git/Adafruit_SSD1306
ln -s ~/git/elapsedMillis

Get code from SVN

The code is available on SVN:

cd
svn checkout svn://repos.gbar.dtu.dk/jcan/scorpi

There are three main packages:

  • The motor_driver firmware for Teensy 4.1
  • The teensy_interface for a Raspberry - for now not fully compatible with the firmware
  • In ros2 is the start of ROS2-iron code, with a YDLidar driver. Further is the slam toolbox and the base ros2-iron compiled successfully on Raspberry pi 5 on Raspberry OS 64bit.
  • Some 3D print STL files.
  • some other minor stuff.

Moror drive

Compile and upload to Teensy.

cd ~/scorpi/motor_drive
make

This should produce a file called motor_drive.hex, ready to be uploaded:

NB! Before you upload, press the power reset button to avoid power shutdown.

Press had hold "power reset"
make upload
Release "power reset" when "alive" LED starts blinking

Raspberry 5

Compiling motor drive on the Raspberry 5 failed in one of the Teensy libraries.

This was fixed by renaming a few files in the library:

cd ~/Downloads/arduino-1.8.19/hardware/teensy/avr/libraries/USBHost_t36/
mv BluetoothConnection.cpp BluetoothConnection.cpp.not  
mv bluetooth.cpp bluetooth.cpp.not
mv joystick.cpp joystick.cpp.not

It was probably in the Bluetooth part, but I failed to remove Bluetooth from joystick.cpp, so all USB-host joystick support has gone.

No joystick is OK for this project.

The code compiles but does not run! The same code runs fine when compiled on a normal Ubuntu.