there are a few things. Are you using a uDriver or a TI launchpad? These are not the same thing. The uDriver is the 5x5 cm custom design board where the launchpad is the longer board sold by TI.
In addition, the mw_dual_motor_torque_ctrl you use is only for communication via SPI to the master board. This means, if you want to use CAN, you need to flash this mw_dual_motor_torque_ctrl repo.
The python script you found was from the very early days of programming the launchpad. It should still work though. These days we use the blmc_driver - see here for an example for a single motor control.
I am using the TI launchpad. I managed to flash the uC and was able to run the c++ code you are giving If I am running on the ubuntu pc meanwhile the python script, I can see that one motor and the launchpard are enabled Now I just need to figger out why my motor doesnāt rotate when I apply a non-zero torque current.
Thatās great news! When you rotate the motor by hand, do you see the position readings updating? If not something might be wrong with the encoder setup (and then also applying a current might not work).
I see. I havenāt yet installed an encoder (my goal as a starting point is just to apply a little torque and see the motor spinning). I guess I need to change up either the c++ program or the python program. Right now I am using the given python CAN program and try to manually send torque references in a while-loop after I enabled everything. Reading the mentioned CAN documentation and your c++ code, one can use 4 bytes for setting the torque_reference of one motor. Is 0x[0f,ff,ff,ff] the highest torque current (2A) and 0x[ff,ff,ff,ff] the most negative torque current (-2A)?
The encoder is essential for using the motor setup. Note that you are using a brushless motor with three phase wires. There is no simple āput some current and have the motor rotateā in our setup. The motor phase gets aligned during the initialization phase (when the motor gets enabled). Without this I donāt think you can use the current firmware setup to get the motor to turn.
If I change IQ to a non-zero value in main_2mtr.h and activate the motor, the motor spins
When I unplug the motor from the actuatormodule (but let the encoder plugged) and plug on just a motor without the actuatormodule, I can do the following. I can turn the actuatormodule motor and the connected motor turns as far as I turned the ānot connected motorā (you can see the video here).
Basically I am able to send certain commands (like motor activate) to the launchpad and I can receive values (e.g. encoder position) in the c++ program.
what is not working:
PD control of motor (c++ program) doesnāt get applied to the motor. The coils are magnitized though.
Virtual Spring Mode of launchpad firmware
Question:
Did someone manage to run the virtual spring mode of the launchpad firmware? If yes, how did you change the firmware? Because just enabling the spring mode doesnāt work for me.
we run the virtual spring mode for debugging purpose and I think we donāt change the firmware. How did you enable the spring mode - did you change the firmware or did you send the enable virtual spring command?
looking at the code, this should enable your virtual spring. Not sure why itās not working for you. You mentioned the motors calibrate nicely at the beginning? Did you try to set the virtual spring behavior manually and run the C++ code? This way the motors get enabled and the virtual spring is working.
Does someone know? Is it possible to flash the SPI dual_motor_ctrl firmware on the launchpad instead of the udriver? I want to send over SPI commands to the launchpad instead of CAN.
I think you will be able to flash but not to use the SPI firmware. That is as the lunchpad doesnāt provide pins to interface with the SPI lanes.
The launchpad uses the two SPI communication channels to boot up the motor drivers. On our custom made micro driver boards, one of the SPI lanes was changed to use for communication.
Thanks for your quick response. I see, so the udrivers have two spi connections free because they have already the inverter built in? In that case I need to find the SPI pins from the launchpad to the second inverterboard. Next, unplug that inverter board and connect the pins with a masterboard right?
It should be possible to mod the TI board to free one of the SPI and use it for communication. But you need to modify the connections between one of the boostxl and the Lanchpad.
Hello, I am jumping on this thread to keep the answers centralized
I have the same setup as OP :
Launchpad
dual_motor_ctrl over can and the python code to test
When sending the can frame to enable mtr1, the mtr moves slightly (1/100 of a turn?), is it what it is supposed to do ?
After that I can read the encoder output but enabling virtual spring mode does not work.
Iāll note that I tried increasing the current sent but the current returned by the board is still noise (rapid oscillation centered around 0, with a max amplitude of ~0.005).
But increasing this current does have a visual effect : the motor ājumpsā then stays locked and start to heat if the current is high enough.