Remora - ethernet NVEM cnc board

More
11 Jul 2023 21:25 #275237 by tuxcnc

PA_0 is likely referring to the STM pin number. I dont know what board you have but if you have a RT1052 board the pin numbers/names will be different.
 

I have got EC500, and I suspect the same.
Usually, PWM can only be on specific pins internally connected to the correct timer.
I don't know how is it in  RT1052, because Chinese documentation is terrible.
Anyway, where is it this PWM, it is not known ...
 

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

More
11 Jul 2023 21:55 #275238 by scotta

I'll ask you now to read the docs!
 
You don't understand me.
Did you test the encoder?
If you did tests, you must have the config.
Why don't you share the config instead "read the docs" advice?
For example the docs says "loadrt PRUencoder names=encoder.0", but I have no PRUencoder.so file, I don't know where from can I get the PRUencoder.so file, so this is useless for me.
Second example is PWM. There is wrote in the header of spindlePwm.cpp file "Module for NVMEM spindle RPM on pin PA_0", but I don't know where is the PA_0 pin in my EC500, so I don't know where I should connect the spindle driver...
I suspect you know, but you don't share this knowledge...

I've tested the functionality of the encoder module to ensure that the encoder count is available in LinuxCNC. I can't test your application of it.

If you would like to see the application of the encoder feedback for a closed loop stepper application, you can look at the freely shared and available example configuration.

github.com/scottalford75/Remora/tree/mai...s/remora-closed-loop

I spend time to research and understand problems and scratch my head to solve them. And yes I share my learnings and the results. Maybe look back over this exact thread where the journey to get to where we are now has been shared every step of the way.

When you read the Digital Dream documentation for your controller board, you will find that there is only one pin for the 0-10V output for spindle control. It's labelled VSO. 

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

More
12 Jul 2023 04:07 #275253 by cakeslob
I guess it is about time to do some docs for the nvem, what everyone thinking? Whole new docs or merge with current docs? Maybe an NVEM section in the current docs? Theres many reference to SPI and mbed in the current docs, so I didnt want to make too much work out of it but we dont want it to be confusing. Im not to up on the nvem so I dont know all the specifics.

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

More
13 Jul 2023 20:15 #275371 by tuxcnc

the encoder module also supports an index input as well.
 

Could you write these few lines of hal file, how to configure an encoder in the EC500, using an internal "Index Pin", not Hal input pin as in PRUencoder examples ?
(I'm trying to configure lathe spindle for threading, not closed loop motors).

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

More
13 Jul 2023 21:36 #275373 by cakeslob
Hey tux, thats not exactly within the scope of the remora project, and more of a general linuxcnc thing.


But since I am also trying to do lathe threading, here is my attempt so far. the encoder/spindle portion is at the bottom

github.com/cakeslob/Remora/blob/nucleo_s...nuc_q/remora-xyz.hal

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

More
14 Jul 2023 03:44 #275395 by tuxcnc

Hey tux, thats not exactly within the scope of the remora project, and more of a general linuxcnc thing.


But since I am also trying to do lathe threading, here is my attempt so far. the encoder/spindle portion is at the bottom

github.com/cakeslob/Remora/blob/nucleo_s...nuc_q/remora-xyz.hal
 

You don't understand the question.
There is this line in config file you linked:
net encoder-phaseZ <= remora.input.15 => encoder.0.phase-Z
The remora.input.15 is a HAL PIN, not internal EC500 pin declared in this line of github.com/scottalford75/Remora-RT1052-c.../encoder/encoder.cpp file:
const char* pinI = module["Index Pin"];
The HAL pin is read by HAL and must be at least as long as HAL servo-thread period. This causes problem and produce big angle error.
There is internal "Index Pin" read by RT1052 in EC500, works immediately when encoder device's index signal change, but of course there is no information how to use it...
The configuration with HAL pin I already have.
Let's assume 3000 rpm and 1 ms HAL servo thread.
This is 20 ms per rotate, the encoder index must be at least 18 degree (1 ms of 20 ms is 5%, 5% of 360 degrees is 18 degrees) and the possible error will be 18 degree too. This is useless in practice, because if synchronize lost (for example G0 between G33) you will not hit the same thread.
Don't ask who make threads at 3000 rpm, it must work even if nobody.

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

More
14 Jul 2023 04:01 #275396 by scotta
Hi, 

Yes, LinuxCNC can only read IO as fast as the servo thread frequency. So some "smarts" are built into the LinuxCNC encoder component and the Remora PRU encoder module / component. The encoder count is latched internally in the controller board and sent to LinuxCNC for a number of servo periods. This way LinuxCNC will see the correct encoder count when it sees the index input.
        // handle index, index pulse and pulse count
        if (this->pinI->get() && (this->pulseCount == 0))    // rising edge on index pulse
        {
            this->indexCount = this->count;                 //  capture the encoder count at the index, send this to linuxCNC for one servo period 
            *(this->ptrEncoderCount) = this->indexCount;
            this->pulseCount = this->indexPulse;        
            *(this->ptrData) |= this->mask;                 // set bit in data source high
        }

Also, please check that you can actually keep up with the encoder pulses per rev. If not then I'll need to look at how we can implement hardware counting which may / may not be available on the pins.

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

More
14 Jul 2023 16:38 #275421 by tuxcnc

Also, please check that you can actually keep up with the encoder pulses per rev. If not then I'll need to look at how we can implement hardware counting which may / may not be available on the pins.
 

I try to explain what I did.

### Test 1 ###

In the ec500-rt1052.txt :

{
    "Thread": "Base",
    "Type": "Encoder",
        "Comment":            "Encoder A-IN9 B-IN10",
        "PV":            0,
        "ChA Pin":            "P3_19",
        "ChB Pin":            "P3_20"
    }
    
In the remora-ec500.hal :

# Initialize the encoder (spindle)
    loadrt PRUencoder names=encoder.1
    addf PRUencoder.capture-position servo-thread
    setp encoder.1.position-scale 1200.000000 #6
# connect the hal encoder to linuxcnc
    net encoder-count remora.PV.0 encoder.1.raw_count
    net encoder-phaseZ remora.input.11 encoder.1.phase-Z

I removed the blocks configured IN9 and IN10 as inputs from ec500-rt1052.txt (I suspect the pins may be defined only once).

Works as expected.
I ran halmeter, chose encoder.1.position and seen that value changed when encoder turned.
I ran halcmd setp encoder.1.index-enable 1
The pin changed state to True, but when encoder changed index output the index-enable changed to False and position changed to zero.

### Test 2 ###

In the remora-ec500.hal I removed the line with net encoder-phaseZ remora.input.11 encoder.1.phase-Z
In the ec500-rt1052.txt I added this line : "Index Pin": "P3_21" and removed declaration this pin as input.
I can change value of encoder.1.position, but encoder Z output does nothing, the encoder.1.index-enable after set is always True, and positon not resets.

What I do wrong ?

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

More
14 Jul 2023 22:43 #275454 by scotta

Also, please check that you can actually keep up with the encoder pulses per rev. If not then I'll need to look at how we can implement hardware counting which may / may not be available on the pins.
 
I try to explain what I did.

### Test 1 ###

In the ec500-rt1052.txt :

{
    "Thread": "Base",
    "Type": "Encoder",
        "Comment":            "Encoder A-IN9 B-IN10",
        "PV[i]":            0,
        "ChA Pin":            "P3_19",
        "ChB Pin":            "P3_20"
    }
    
In the remora-ec500.hal :

# Initialize the encoder (spindle)
    loadrt PRUencoder names=encoder.1
    addf PRUencoder.capture-position servo-thread
    setp encoder.1.position-scale 1200.000000 #6
# connect the hal encoder to linuxcnc
    net encoder-count remora.PV.0 encoder.1.raw_count
    net encoder-phaseZ remora.input.11 encoder.1.phase-Z

I removed the blocks configured IN9 and IN10 as inputs from ec500-rt1052.txt (I suspect the pins may be defined only once).

Works as expected.
I ran halmeter, chose encoder.1.position and seen that value changed when encoder turned.
I ran halcmd setp encoder.1.index-enable 1
The pin changed state to True, but when encoder changed index output the index-enable changed to False and position changed to zero.

### Test 2 ###

In the remora-ec500.hal I removed the line with net encoder-phaseZ remora.input.11 encoder.1.phase-Z
In the ec500-rt1052.txt I added this line : "Index Pin": "P3_21" and removed declaration this pin as input.
I can change value of encoder.1.position, but encoder Z output does nothing, the encoder.1.index-enable after set is always True, and positon not resets.

What I do wrong ?[/i]

Good to see you are making progress. 
This is your original working index pin input, correct?
    {
    "Thread": "Servo",
    "Type": "Digital Pin",
        "Comment":            "IN08",
        "Pin":                "P3_21",
        "Mode":                "Input",
        "Data Bit":            11,
        "Invert":            "False"
    },

You will also need to set the Data Bit in the encoder configuration.
{
    "Thread": "Base",
    "Type": "Encoder",
        "Comment":            "Encoder A-IN9 B-IN10",
        "PV[i]":            0,
        "ChA Pin":            "P3_19",
        "ChB Pin":            "P3_20",
    "Data Bit":          11,
        "Index Pin":          "P3_21",
    }

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

More
15 Jul 2023 03:51 - 15 Jul 2023 03:56 #275481 by tuxcnc

[i][code]You will also need to set the Data Bit in the encoder configuration.


[code]{
    "Thread": "Base",
    "Type": "Encoder",
        "Comment":            "Encoder A-IN9 B-IN10",
        "PV[i]":            0,
        "ChA Pin":            "P3_19",
        "ChB Pin":            "P3_20",
    "Data Bit":          11,
        "Index Pin":          "P3_21",
    }[/i]
[/code][/i][/code]

Works with line < net encoder-phaseZ remora.input.11 encoder.1.phase-Z > in remora-ec500.hal, but I suspect the PRUencoder component works, not internal EC500 procedure.
If you remove that line from hal config, index input does not work - counter works, but you can't reset it.
You wrote, you do not have 24V encoder. It is not problem for tests, you can use switch connected to index input and com- terminals, it is enough to see is the index-enable pin resets on index edge.
Run < halcmd setp encoder.1.index-enable 1 >, click switch, see encoder.1.index-enable in halmeter, if it is still TRUE, the code not works.
Last edit: 15 Jul 2023 03:56 by tuxcnc.

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

Time to create page: 0.192 seconds
Powered by Kunena Forum