StepperServoCAN

Sonarcloud Status CodeFactor Codacy Badge

StepperServoCAN - firmware

Hardware

Firmware

Build and upload

Configuration

LED indicators

BLUE LED (Function):

RED LED (Error):

CAN interface

Actuator accepts commands via CANbus as defined by dbc file in Retropilot/Opendbc/ocelot_controls.dbc

CAN Command - expect rate is 10ms

Actuator will report back its status every 10ms:

Interfacing with Openpilot

Reference implementation can be found in my bmw openpilot repo:

Interfacing from a PC

Use this StepperServoCANtester.py GUI program to quickly test the StepperServoCAN motor.

Requirements

pip install tkinter cantools python-can

git submodule init opendbc
git submodule update opendbc

Usage

  1. Connect the StepperServoCAN motor to the computer via CAN interface supported by python-can.

  2. Run the program:
     python StepperServoCANtester.py
    
  3. Upon startup, the program will automatically attempt to connect to the default CAN interface, which is pcan. If you are using a different interface, you can select the desired CAN interface from the dropdown menu in the program. Once you have selected the interface, the program will establish a connection and start sending the 0x22E STEERING_COMMAND message with initial values of 0 for torque and angle.
  4. In addition to the CAN interface dropdown menu, the program also provides two input fields where you can enter the desired motor torque and angle values. Note that torque values can be entered as floats.
  5. You can update the injected values to the motor by clicking the “Update Torque/Angle Value” button or by pressing the “Return” key on your keyboard or changing Steer mode.
  6. After selecting either “TorqueControl” and providing a “Steer Torque” value, or selecting “AngleControl” and providing a “Steer Angle” value, the StepperServoCAN motor will start spinning accordingly.
  7. To exit the program, you can click the “Exit” button, press the “ESC” key, or simply close the window.

Notes

Contributing

Debugging

The debugging session is setup to use semihosting when debugging and some debug information is printed to the debug console. When debugging, the motor calibration can be initiated by liong pressing F1 as usual, but then to start calibration used can press any key in the console. This is not very reliable though and sometimes calibration will start on debug events.

Signal logging

STM32 has an ability to view and edit global variables using SWD debug interface

BSP Firmware License

Atributions

For initial software and hardware: