pressed min_switch
In [28]: odrv0.axis0.min_endstop.endstop_state_
Out[28]: True
released min_switch
In [29]: odrv0.axis0.min_endstop.endstop_state_
Out[29]: False
pressed max_switch
In [30]: odrv0.axis0.max_endstop.endstop_state_
Out[30]: True
released max_switch
In [31]: odrv0.axis0.max_endstop.endstop_state_
Out[31]: False
Homing
GPIO5 is not recognised. Motor didn’t stop by pressing the min_switch
Emergency stop
Reconnected to ODrive 375F365A3137 as odrv0
In [52]: odrv0.axis0.requested_state = AXIS_STATE_CLOSED_LOOP_CONTROL
In [53]: odrv0.axis0.controller.set_pos_setpoint = 1000
has no effect. Motor is not spinning.
With an ASCII command the motor is spinning. The max_switch stops the motor. The min_switch has no effect.
odrv0.axis0.controller.set_pos_setpoint = 1000 does nothing
odrv0.axis0.controller.set_pos_setpoint(1000, 0, 0) or odrv0.axis0.controller.pos_setpoint = 1000 are the correct commands
I specifically tested GPIO5, so that’s weird. I will check the differences with ASCII commands but I don’t think that should have any difference from USB (just your incorrect command)
Oh Sorry You are right, thats the wrong command. I’m testing mostly with the ASCII interface.
Homing and emergency stop is working with GPIO 6 - 8. -> Great work!!!
GPIO 5 and 4 are recognised in AXIS_STATE_IDLE only. In AXIS_STATE_HOMING they have no effect.
For debouncing I had to add two caps 47nF between the GPIOs and GND.
I checked also if I can use one GPIO for both max_switches. That works. That stops both axis.
Just updated to firmware 4.6, was hoping this would be in it, but I can’t seem to find odrv0.axis0.max_endstop. Any news on when this branch will be merged into the main branch?
there is still a problem with GPIO less than 6. Could you verify that?
If you only need 3 switches your are fine. But some applications will need four switches and I can’t get these GPIOs to work.
My suggestion is to have ST-Link. Sometimes my ODrive wasn’t accessible after a shutdown. The only way to get it working again was to flash it with the ST-Link.
On the other hand, if you want to send ASCII commands, there is already the serial timeout bug. To do the workaround like described here: Serial Timeout Issue
you have to modify the firmware. With a ST-Link it’s much easier.
I would really like to use this feature, but it still hasn’t been included in the main release. Can I help out with testing without an ST-Link, or is it too risky? If so, how? I have the hardware setup necessary to test end switches.
Please do help out! You’ll just have to pull the Endstops branch. I’m not 100% sure how to flash the firmware without an ST-Link, you can probably do some sort of DFU once you build the firmware though.