Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to deal with different encoder type with the same protocol? #58

Open
sacidu93 opened this issue Feb 5, 2017 · 12 comments
Open

How to deal with different encoder type with the same protocol? #58

sacidu93 opened this issue Feb 5, 2017 · 12 comments

Comments

@sacidu93
Copy link

sacidu93 commented Feb 5, 2017

I made a custom hardware based on the stmbl V4, and I managed it to work with Yaskawa servomotor. As my servomotor use 13bit incremental encoder instead of 16bits absolute encoder, the received frame data from this encoder is different, and contain more interesting data field like the Hal sensors state, compensation data and status bit that indicate if this last field is valid or no.

position 7: one bit indicate if Z index has been observed at least once since powering up the encoder, this is used to indicate if the compensation data is valid, ( 1: data not valid, 0: data is valid ) the absolute shaft angle can be calculated by subtract the compensation data from the incremental position data counter.

Position 58, 59 and 60 are the Hal sensors state ( U, V, and W ), can take six value (2, 3,1, 5, 4 and 6 ) this sequence repeat 3 times per revolution ( All Sigma II SGMAH series are 3 pole-pairs motors ) this signal can be used to do initial phasing without enabling auto-phasing feature .

Position 67: 13 bits of incremental position data.

position 81: 11 bits of compensation data ( need to be 2bits left shifted if used as absolute offset from Z index)

My question is how to deal with this kind of situation, 16bits absolute, 17bits incremental, 13bit incremental or absolute, 20bit and higher for Sigma III and Sigma V.. and the same situation with Mitsubishi encoders.

Is it doable to make each encoder type in separate .COMP file and rename it some thing like:

"Yaskawa_13b_inc.comp", "Mitsubishi_17b_abs.comp"...

or may be use only one .comps file that can handle all types but in this case each protocol must have sub-non-volatile parameter to indicate how to decode data frame.

Here a .comp file that handle Yaskawa Sigma II 13bits incremental encoder ( SGMAH series ) using FB0_45 ( some optimization still to be done ) and the config file for SGMAH-04-AAA .

yaskawa_13b_inc_FB0_45.txt
Yaskawa_SGMAH-04AAA.txt

@crinq
Copy link
Collaborator

crinq commented Feb 20, 2017

We don't have a good solution for protocol variants or hw instances yet. There are multiple options:

  1. multiple comps (one / variant, see enc_fb.comp and enc_cmd.comp)
    "+" fast
    "-" code duplication

  2. preprocessor switch in comp
    "+" fast
    "-" ugly code
    "-" config at compile time

  3. runtime switch in comp
    "+" config at runtime
    "-" slow

  4. load time switch in comp (bend function pointers in RT_INIT)
    "+" fast
    "-" needs a lot "setup" code (could be implemented in HAL)

  5. multiple comps (hw, protocol, interpretation)
    "+" separation of concerns
    "-" runtime overhead
    "-" communication is limited to float or float[]
    "-" complex HAL graph

Currently i would prefer option 4 with better support in HAL.

@andypugh
Copy link
Contributor

The Mesa BiSS / SSI etc functions handle this using a string parameter that encodes the number of bits and their HAL pin names:
http://linuxcnc.org/docs/2.7/html/man/man9/hostmot2.9.html#Synchronous Serial Interface (SSI)
This might have too much overhead for STMBL, however. It re-uses the code that allows smart-serial devices to choose their own pin-names and types.

@rene-dev
Copy link
Owner

good idea, but our hal implementation cannot do that.
components and their pins are fixed at compiletime.
I also support option 4.

@andypugh
Copy link
Contributor

Components and pins used to be fixed at compile-time in LinuxCNC too. I had to change that to support smart-serial. It's just a matter of keeping the pins in a Union with a type code:
https://github.com/LinuxCNC/linuxcnc/blob/master/src/hal/drivers/mesa-hostmot2/sserial.c#L1385
But I did mention that I thought there might be too much overhead for STMBL.

@crinq crinq mentioned this issue Apr 17, 2018
17 tasks
@corrylaz
Copy link

This isn't related to the issue, but sacidu93, do you have information on the sigma-V protocols? The project I wasn't to use the STMBL on I need to read some existing Yaskawa sigma-V motors for position information. Can you point me to information on reading the encoder data?

@crinq
Copy link
Collaborator

crinq commented Nov 27, 2020

@HUANGJIN169 that's an incremental encoder with 2500 pulses per revolution

@HUANGJIN169
Copy link

HUANGJIN169 commented Nov 27, 2020 via email

@HUANGJIN169
Copy link

HUANGJIN169 commented Nov 27, 2020 via email

@HUANGJIN169
Copy link

HUANGJIN169 commented Nov 27, 2020 via email

@crinq
Copy link
Collaborator

crinq commented Nov 27, 2020

Yes you could flash other firmware, but you have to modify it. MMOS ffb will not run out of the box.
You can use STMBL to drive the motor and run stock MMOS ffb on a different board.

@artayasa
Copy link

good idea, but our hal implementation cannot do that. components and their pins are fixed at compiletime. I also support option 4.

Hi sir it posible to modif the hardware sir? I want to used only main board with stm32f4, i just want to used arount 40-60v dc input sir. Or that need modif the frimeware also?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants