AX58100 IN OUT PINES

More
05 Dec 2024 06:54 #315997 by SOLD
Replied by SOLD on topic AX58100
I understand the speed, it's hard to see the index pulse.
What I don't understand is when an index is detected, how does your encoder command element change the state?
For example:
Obj.IndexStatus = Encoder1.indexHappened();
Checks if an index pulse has occurred (uses the indexPulseFired variable).
If it has, it returns 1 and resets the state.

Obj.IndexByte = Encoder1.getIndexState();
Reads the digital value of the index pin directly (0 or 1).
Used to check the current state of the index signal.

This information, even monitoring with Twincat, does not detect any.

I am now starting to practice debugging and serial monitoring.

And next I think I will try EaserCAT-2000 with AX58100, but it is still difficult to change from LAN9295 to AX58100 with the original firmware of EaserCAT-2000.

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

More
05 Dec 2024 07:05 #315998 by Hakan
Replied by Hakan on topic AX58100
You can also add a PDO just for debugging, I had several of those during development.
Just to assign Obj.D1 = interesting_value and watch that value.
An alternative to the index shift is to have a counter counting up when the callback happens, there is
actually one already in my code "encCnt" which increments every time the index callback is called.
Just quickly checked in the debugger, here the callback is triggered when index passes by.
The following user(s) said Thank You: SOLD

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

More
05 Dec 2024 07:09 #315999 by Hakan
Replied by Hakan on topic AX58100
And for LAN9252, it is better to copy the whole lib/soes from Easercat 2000 and go from there. That should work right away.
 
The following user(s) said Thank You: SOLD

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

More
05 Dec 2024 07:11 #316000 by SOLD
Replied by SOLD on topic AX58100
Thank you. I will study more.

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

More
05 Dec 2024 20:42 #316045 by Hakan
Replied by Hakan on topic AX58100
I'll try to explain how the spindle-index-enable works.
This is the traditional syntax in hal to enable synchronization on index signal
linuxcnc.org/docs/html/examples/spindle...._synchronized_motion

net spindle-index-enable encoder.3.index-enable => spindle.0.index-enable


First look at what motion.spindle.M.index-enable says

spindle.M.index-enable I/O BIT
For correct operation of spindle synchronized moves,
this signal must be hooked to the index-enable pin
of the spindle encoder.


Then look at what the encoder's index-enable pin says
linuxcnc.org/docs/html/man/man9/encoder.9.html

encoder.N.index-enable bit i/o
When true, counts and position are reset to zero on the
next rising edge of Phase-Z. At the same time, index-enable
is reset to zero to indicate that the rising edge has occurred.

These three lines say a lot. This is the behavior the EtherCAT client tries to replicate.
index-enable is a I/O bit, that means read AND write variable. As mentioned, EtherCAT variables
are read OR write. The metalmusings_encoder component split index-enable in two variables
one read variable that forwards the value to the EtherCAT client, and one write variable
that when set will change index-enable, as specified above.

In the EaserCAT 3000 client, when Obj.IndexLatchEnable is set, i.e. when index-enable is set, it waits for the next Z-index interrupt, which then then zeroes the counters. This needs to be done exactly when the Z index happens, not any time afterwards. Because this happens in an ISR it communicates to the rest of EaserCAT with indexPulseFired variable. So in cb_get_inputs() when setting whether the index fired it will know that from this variable.
It is pretty indirect programming, but that is how I have been taught to communicate with ISRs.
Then it will set Obj.IndexHappened, which will go the the metalmusings_encoder component whioch will reset the i/o variable.

Not sure this clears things up, not so easy to write a good clear answer to this.
The following user(s) said Thank You: SOLD

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

More
06 Dec 2024 07:07 - 06 Dec 2024 07:19 #316080 by SOLD
Replied by SOLD on topic AX58100
I'm familiar with the orient function.
After receiving your explanation, I'll go back to metalmusings_encoder.comp to double check the bindings with the GPT explanation.

Components and pins:

Component metalmusings_encoder: This component represents the encoder's function related to the index signal.
Index-c-enable pin (bit): This pin is used to control whether the index-enable signal is on or off.
Index-status pin (u32): This pin holds the status of the index signal, indicating whether the index is latched.
Index-latch-enable pin (u32): This pin is used to latch the index-enable state to synchronize it with the correct position.
Main function logic:
Initialization:
index_latch_enable = index_c_enable;

This causes index-latch-enable to follow the value of index_c_enable , if index_c_enable Set to true (high), index-latch-enable will be enabled.
When index_latch_enable is true:

If index_latch_enable is set to true (when index_c_enable is high), it checks whether index_status is true.
If index_status is true (i.e., a jitter occurs on the index signal), it resets index_c_enable to 0.
if (index_status) { index_c_enable = 0; }

This means that when the index signal is detected, index_c_enable will be reset to prevent re-jittering.
When index_latch_enable is false:

If index_latch_enable is false (i.e., not synchronized), the system will wait for index_status to trigger index_c_enable to true.
index_c_enable = index_status;

This means that index_c_enable will be set based on the state of index_status and wait for a jitter from the index signal.
Overall behavior:
When index_c_enable is true:
The system checks index_status. If index_status is true (i.e. the index is latched), index_c_enable is set to 0 to prevent re-latching.
When index_c_enable is false:
The system waits for index_status to be true to trigger index_c_enable again, which causes synchronization when the index signal is latched.

Summary:
This component handles the index-enable signal by varying the value of index_c_enable depending on the state of index_status. It causes position synchronization to occur when the index signal is latched, and when index_latch_enable is set, the system resets index_c_enable after a latch from the index, which allows position synchronization to occur at the appropriate time.

 
Last edit: 06 Dec 2024 07:19 by SOLD.

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

More
06 Dec 2024 07:36 - 06 Dec 2024 07:46 #316081 by SOLD
Replied by SOLD on topic AX58100
I'm trying to learn and here's the summary
Information about Name Data type in Obj Direction Data type EEPROM Generator Associated function Description

IndexLatchEnable  uint8_t        UNSIGNED8       cb_set_outputs() Enable or disable Index Pulse latch
EncPos                 double         REAL32             cb_get_inputs() + MyEncoder.currentPos() Current position of the Encoder
EncFrequency       double         REAL32             cb_get_inputs() + MyEncoder.frequency() Frequency of the Encoder
IndexStatus          uint8_t         UNSIGNED8      cb_get_inputs() + MyEncoder.indexHappened() Status of the Index Pulse
IndexByte             uint8_t        UNSIGNED8       cb_get_inputs() + MyEncoder.getIndexState() Status of the Index
Velocity                double         REAL32             cb_get_inputs() Speed ​​of the system (calculated from the Encoder or other data)
Last edit: 06 Dec 2024 07:46 by SOLD.

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

More
06 Dec 2024 16:32 - 06 Dec 2024 17:25 #316117 by SOLD
Replied by SOLD on topic AX58100
I think I successfully entered debug mode, but when I rotate the shaft, no change is detected in encCtn. Or I am viewing incorrect information. 



Eventually, as I tested the method further, I found that it actually counted…it worked.
 
Attachments:
Last edit: 06 Dec 2024 17:25 by SOLD.

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

More
06 Dec 2024 18:05 #316122 by Hakan
Replied by Hakan on topic AX58100
Congrats to that, the debugger is a big big help, for some problems.
As you found out, the variable updates when the program is paused, or stepping.
The following user(s) said Thank You: SOLD

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

More
06 Dec 2024 20:48 - 06 Dec 2024 20:49 #316135 by COFHAL
Replied by COFHAL on topic AX58100 IN OUT PINES
I have been playing with the inputs and outputs of the card and I realized that these are of type u32 and in order to be used in LCN they must be converted to BITs with the conv_u32_bit component, this is because some pins that LCN automatically creates are of type bit, such as joint.N.amp-fault.in, iocontrol.o.emc.enable-in, or any other pin that has been declared as type bit.
Last edit: 06 Dec 2024 20:49 by COFHAL.

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

Time to create page: 0.122 seconds
Powered by Kunena Forum