End switches an interrupts

Stijn, it looks like your configuration saved properly, now try requesting current_state = AXIS_STATE_HOMING and see what happens.

Hi Stijn,

if you switch GND to the GPIO then you should have a config like this:

In [37]: odrv0.axis0.min_endstop.config
Out[37]:
gpio_num = 8 (int)
enabled = True (bool)
is_active_high = False (bool)
debounce_ms = 100.0 (float)

Greetings / Zennix

Hi

Are there pullup resistors present?

Cheers

Carelsbergh Stijn

Hi,

is_active_high = False -> sets a internal pullup.
I placed a 47nF capacitor between GND and the GPIOs for debouncing.
You can set a 10k resistor against 3.3V as pullup.

greetings / Zennix

Hi

End switches working but it doesn’t go into closed loop control anymore, here is what I do:

Change config and save ✓
Reboot ✓
Motor calibration ✓
Encoder offset calibration ✓
Closed loop control X

What could be the problem?

Cheers
Carelsbergh Stijn

Hi,

did a

odrv0.axis0.requested_state = AXIS_STATE_HOMING

do anything?

Greetings / Zennix

Hi

It doesn’t do anything

Cheers

Carelsbergh Stijn

Hi,
make a crosscheck with the standard firmware to see if your board is fried.
Alternatively you can try my older version:

greetings / Zennix

what does dump_errors(odrv0) say?

Hi

When do I need to type the command?
After trying to go in closed loop control?

Cheers

Carelsbergh Stijn

Hello,

I’m having a problem:
Motor calibration works
Encoder offset calibration works
Closed loop control works
HOMING DOES NOT WORK

Motor says it is homing but it is not moving

What is the problem?

Cheers

Carelsbergh Stijn

Make sure your closed-loop control is properly tuned first. Then try increasing the homing speed, but be aware that it may suddenly start moving a lot faster than you expect, and possibly in the wrong direction.

Also, try manually turning your axis in both directions when it is homing to see if you experience more resistance in one direction than the other. That would indicate your control effort is too low.

Hello guys van you please help me?

Motor startup calib works
Encoder offset startup works
But when I do startup homing and closed loop, it goes immediately into closed loop control without homing, if It ask for the homing state it says 2 or 0

Thanks in advance

Cheers

Carelsbergh Stijn

Hi Stijn,

do your testing without going automatically in closed loop and homing. For testing do it manually.
<axis>.config.startup_closed_loop_control=False
<axis>.config.startup_homing = False>

Are your switches detected correctly?

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

Greetings / Zennix

Try changing odrv0.axis0.min_endstop.config.is_active_high

Hi

@Zennix
Ik tried it manually, didn’t work
Switches are read correctly
Any other thoughts?

@Riewert
My switches are wired correctly, so no problem there. But thanks for the advise
Any other thoughts?

Cheers

Carelsbergh Stijn

Hi Stijn,

three more questions:

  1. did you erase the config after flashing?
    You have to remove the old settings.

  2. Did you try my older but working version posted before?

  3. Wetmelon released a new version of the endstop branch yesterday.
    Try it.

Greetings / Zennix

Have you tried increasing odrv0.axis1.controller.config.homing_speed? Also, make sure you save-reboot-and check when you change these values.

Hi

Homing is working, but it seems that the current to the motor is not correct, because it doesn’t move easly.

The homing state is defined in the new firmware as 11, as of previous firmware where it was 9. In the enums.py file, it stills says it’s 9, but there is lockspin also defined as 9, I don’t think thats correct.

When homing, the rotation direction was incorrect, therefore I changed the A and B signals off the encoder to turn it around, But now, when in closed loop controll, positive commands give a negative movement, how can I change this so that the homing direction stays the same as it now is?

I want to use my switches in normal closed mode, but when trying this, it seemed that the switches needer to be connected in normal open mode because otherwise the actuator already thought it was in the home position.

Thanks in advance

Cheers

Carelsbergh Stijn

Good to hear it’s working.

I have the same issues with not enough power going to the motors in homing mode. The only solutions I found are:

  1. increase odrv0.axis1.controller.config.homing_speed or
  2. increase odrv0.axis1.motor.config.current_lim, this obviously also affects closed_loop_control

I have no idea what is causing this, but at least you are seeing the same behaviour.

For the direction it might be a better idea to leave your A-B cables normally and configure a odrv0.axis0.max_endstop instead of a odrv0.axis0.min_endstop.