Lichuan 4 axis stepper need help-

More
9 months 6 days ago #341927 by Hakan
38? -3 here.
What made it work?

Don't know why they don't allow switching between csp and csv.
You switch to homing mode and back, so you do switch modes on the fly.
Had a guy in here that switched modes, although he switched between two cia402 components,
one was Dominik's for CSP and one was mine for PV mode (mostly a quick hack  github.com/MetalMusings/cia402pv )

Searched and found many drives that allow dynamic switching while in op-enabled.
That's not a proof it is universally allowed, at least it isn't forbidden.

The current component is quite limited in that respect. It could support CSP, CSV, PV, PP, Homing, maybe also Torque Profile mode.
The main difference is which pins are active as inputs and outputs I guess. Plus the feedback position/velocity/ferror

 

Please Log in or Create an account to join the conversation.

More
9 months 6 days ago #341934 by rodw

38? -3 here.
What made it work?
 
Actually hit 41.8 deg C here today so a bit hotter. (Therefore I did not get that much done!)
I cheated and only moved the one working motor for the video oops!
I saw that: Modes can be switched while the drive is in the "Operation enabled" state
Probing could also be handy.
I'll keep you in the loop
The following user(s) said Thank You: NWE

Please Log in or Create an account to join the conversation.

More
9 months 6 days ago #341969 by Hakan
From what I can see, different modes can live side by side in the cia402 component without problem.
They already do today. Different pins, yes. For example PV needs two accelerations and a speed pin.
Homing, probing etc their own set of pins. And possibly some small piece of logic, like "at-speed" indication.
And then handle the switching of modes with the position feedback, a bit optimistic this can be done in a general way.
The following user(s) said Thank You: rodw, NWE

Please Log in or Create an account to join the conversation.

More
9 months 2 days ago #342190 by rodw
Well, I made a start and at least have some pins displaying (see attached text file). Still so much to do after a full day on this!

Not sure if this is final but the states should look like
Code:
// CiA 402 states typedef enum {     STATE_NOT_READY_TO_SWITCH_ON,     STATE_SWITCH_ON_INHIBITED,     STATE_READY_TO_SWITCH_ON,     STATE_SWITCHED_ON,     STATE_OPERATION_ENABLED,     STATE_QUICK_STOP_ACTIVE,     STATE_FAULT_REACTION_ACTIVE,     STATE_FAULT,     STATE_HOMING } DriveState;

I need to make sure everything is seperated into readall and writeall functions.
We rtapi_malloc structured data storage when we loadrt so I hope that will work.

The statusword structure looks something like this so the bit fields are mapped overthe status word
Code:
// CiA 402 Statusword union typedef union { hal_u32_t raw; struct { unsigned char ready_to_switch_on :1; // 0 unsigned char switched_on :1; // 1 unsigned char operation_enabled :1; // 2 unsigned char faulted :1; // 3 unsigned char voltage_enabled :1; // 4 unsigned char quick_stop :1; // 5 unsigned char switch_on_inhibited :1; // 6 unsigned char warning :1; // 7 unsigned char manufacturer_specific1 :1; // 8 unsigned char remote_cmd :1; // 9 unsigned char target_reached :1; // 10 unsigned char internal_limit_active :1; // 11 unsigned char opmode_specific1 :1; // 12 (homing attained / target reached) unsigned char opmode_specific2 :1; // 13 (homing error) unsigned char manufacturer_specific2 :2; // 14-15 } bits; } StatusWord;

When I get a bit further, I'll share via github

Please Log in or Create an account to join the conversation.

More
9 months 2 days ago - 9 months 2 days ago #342191 by rodw
Ooops no attachment
 

File Attachment:

File Name: pins_2026-01-30-2.txt
File Size:1.8 KB
Last edit: 9 months 2 days ago by rodw.

Please Log in or Create an account to join the conversation.

More
9 months 2 days ago - 9 months 2 days ago #342213 by Hakan
FWIW, I thought is was nice that pins are named stat_* in Donomik's version.

My mind was into naming pins after the mode they are used in. Problem being there are overlaps.
For example there are many velocities: Homing velocity fast, homing velocity slow, PV velocity,
CSP velocity, CSV velocity, PP velocity, all using different PDOs, except CSP and CSV velocity which is the same PDO.
I would guess also Probe velocity, probably several versions.

On the other hand, it would be a bit convoluted for the user to use .csp-commanded-velocity when they already selected csp mode and see it as natural to use .commanded-velocity.


 
Last edit: 9 months 2 days ago by Hakan.

Please Log in or Create an account to join the conversation.

Time to create page: 0.605 seconds
Powered by Kunena Forum