End switches an interrupts

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 :relaxed: 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!!! :clap:
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. :+1:

Thanks / Greetings / Zennix

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?

1 Like

Hi,

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.

Greetings / Zennix

I’m not really sure how to install the end-stop branch to my odrive with the DFU tool, since I don’t have an ST-Link.

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.

Greetings Zennix

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.

1 Like

An STlink clone is stupid cheap. Like cheaper than the screw terminals on the ODrive.
$2.02 (US) free shipping on AliExpress


Less than $10 on amazon
I consider it pretty much a requirement to work with the ODrive.

Hi @Wetmelon

where can I download the V3.6 compatible version?

what GPIO’s are supported?

Is there a list of the specific commands?

cheers

Carelsbergh Stijn

Hello?

I need to finish my project, can you guys please help me?

Thankssssss

Cheers

Carelsbergh Stijn

Hi Stijn,
all you need to get it running with the end stop branch is documented in this thread.

Greetings / Zennix

Hi

Is there a v3.6 file available?

Do the switches need to be connected to 5v or gnd?

Are the switches NO or NC?

Cheers

Carelsbergh Stijn

Hi Stijn,

you have to use https://github.com/Wetmelon/ODrive/tree/Endstops

Switch against 3.3V. You can define high or low active. I had to use some capacitors on the GPIOs for preventing debouncing.

Greetings / Zennix

Hi,

What USB driver do you have to use?

Cheers

Carelsbergh Stijn

Hi,

My end switches are not recognized, what should I do?

Cheers

Carelsbergh Stijn

Hello

When I press the button, button state is false, when I don’t press the button, button state is false too, what can I do?

Hi Stijn,

This my config for an endstop that switches GND to GPIO 8.

odrv0.axis0.min_endstop.config

Out[37]:
gpio_num = 8 (int)
enabled = True (bool)
offset = -500 (int)
is_active_high = False (bool)
debounce_ms = 100.0 (float)

Greetings Zennix

Hi

Thank you, I’m now on vacation, I will try it afterwords.

Cheers

Carelsbergh Stijn

The Endstops branch has been updated to the most recent Devel HEAD. It compiles but I have no way to test, so please let me know if there are any issues.