AX58100 IN OUT PINES

More
02 Dec 2024 01:13 #315762 by COFHAL
Replied by COFHAL on topic AX58100
Have you been able to get the encoder to work?

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

More
02 Dec 2024 02:18 #315763 by SOLD
Replied by SOLD on topic AX58100

Have you been able to get the encoder to work?

I haven't tested that part yet, in fact I'm waiting for you to finish so I can copy it.

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

More
02 Dec 2024 09:58 #315774 by Hakan
Replied by Hakan on topic AX58100
@COFHAL: You didn't get it to work? I'll try to connect up one as I haven't tested it on this board. It may take a few days though.

@SOLD: Where do you need that extra speed in the Ethercat client? Anyways, it should work with the existing soes library. Check SPI settings, reset line pin, and the SYNC0 pin.
The following user(s) said Thank You: SOLD

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

More
02 Dec 2024 11:12 - 02 Dec 2024 14:34 #315778 by Hakan
Replied by Hakan on topic AX58100
Well, I had it right here on the table.
Add encoder_config() to setup() like this

// Compute this scale factor only once
input_freq = FrequencyTimer->getTimerClkFreq() / FrequencyTimer->getPrescaleFactor();

encoder_config(); // Needed by encoder, possibly breaks some timers.

ecat_slv_init(&config);
attachInterrupt(digitalPinToInterrupt(PC0), globalInt, RISING); // For testing, should go into Enable_interrupt later on
}

Also, in the call to the constructor, change the Index_Z pin to PA3 according to the schematics. I didn't check that, leave it to you to check that the callback is triggered when the encoder passes the index slot
MyEncoder Encoder1(TIM2, PA3, indexPulseEncoderCB1);
Last edit: 02 Dec 2024 14:34 by Hakan. Reason: Fighting the editor
The following user(s) said Thank You: COFHAL, SOLD

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

More
03 Dec 2024 07:41 #315861 by SOLD
Replied by SOLD on topic AX58100
I followed your advice. 
 
 
and enable 
 
Create new esi, connect pdo 

Create a new config and find the pin command inside Hal.
 
I get response in encfrequenry when I spin the motor
And there is response in encpos but not perfect. When I don't set scale, the encpos number will change up and down but not much.
When I set scale, the encpos value will become decimal as shown in the picture.

What should I do next?
 
Attachments:

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

More
03 Dec 2024 08:51 #315869 by Hakan
Replied by Hakan on topic AX58100
You should enter problem-solving mode and try to solve it

First, verify that the encoder as such works and gives the right values.
Check schematics and hardware setup since you use your own pcb. A and B must go in to PA0 and PA1. They electric signal must be NPN open collector. Use interface circuitry if needed.

Check that it counts up and down using the debugger.
Add a line first in loop()
double pos =Encoder1.currentPos();
Use this a breakpoint and watch that pos changes value as you rotate the encoder shaft.
Read up on debugger usage if you haven't used it before. But it is basically just to start it with Run -> Start debugging and then single step into or single step over and watch values in the left column.



 
The following user(s) said Thank You: SOLD

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

More
03 Dec 2024 09:36 #315872 by SOLD
Replied by SOLD on topic AX58100
I think so too. For the circuit I designed AB, I am PA0 PA1, will check the signal to be NPN again.
 

Is this part enabled correct?
#if 1 Obj.IndexStatus = Encoder1.indexHappened(); Obj.EncPos = Encoder1.currentPos(); Obj.EncFrequency = Encoder1.frequency(longTime.extendTime(micros())); Obj.IndexByte = Encoder1.getIndexState();


Is this setScale value to be enabled or not? Or use the value from RXPDO 0x7000 "Scale"
//Encoder1.setScale(2000);
Attachments:

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

More
03 Dec 2024 09:56 #315874 by Hakan
Replied by Hakan on topic AX58100
But don't work in linuxcnc when there is a problem. First, work in the MCU so you eliminate many steps that can be wrong. And use the debugger.

Leave the scale statement commented out. It is set to 1.0 in the class as default.
When you set it to 2000, there are 2000 per revolution, or 500 pulses. One revolution is 1.0. Set scale to 1.0 to see every step more easily.

If it does count up and down, it works, doesn't it. What exactly doesn't work?
The following user(s) said Thank You: SOLD

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

More
03 Dec 2024 10:18 #315875 by SOLD
Replied by SOLD on topic AX58100
When the motor shaft rotates, the steps are counted in the encpos but not continuously. I am short-circuiting without passing TXS0108EPWR to test again.

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

More
03 Dec 2024 13:43 #315886 by SOLD
Replied by SOLD on topic AX58100
Now I unplug the TXS0108EPWR and connect it directly to mcu with R1.5k pull up to 5V. it work 

I can find the counting up when the motor shaft is rotated, but sometimes when I let go of the rotation the numbers will continue to count until the shaft is rotated again.
Another problem is that the numbers will only count one way even when the motor is rotated in reverse direction. This may be due to a faulty Z phase for the index. I am investigating further.
 
Attachments:

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

Time to create page: 0.155 seconds
Powered by Kunena Forum