Hal configuration for BISS encoder

More
31 Jan 2025 10:44 #320220 by pmchetan
Hal configuration for BISS encoder was created by pmchetan
I have been trying to set up a absolute linear encoder combo from renishaw (RLS AS10 scale with LA11-2Do reader). I'm unable to get stable measurements from the scales. Steps I've followed:
1. I have mesa 6i25_7i76_7i74 boards. I made a post asking for BISS firmware for 6i25_7i77 combination here but couldn't make the smart serial expansion on 7i77 to work as a BISS interface for the encoder input. Eventually bought 7i76_7i74 boards and PCW made a bit file for 3 channel BISS protocol and I flashed 5i25_7i76_7i74biss3d.bit file onto 6i25 card.
sudo mesaflash --device 5i25 --readhmid
[sudo] password for spinnercnc:
Configuration Name: HOSTMOT2

General configuration information:

  BoardName : MESA5I25
  FPGA Size: 9 KGates
  FPGA Pins: 144
  Number of IO Ports: 2
  Width of one I/O port: 17
  Clock Low frequency: 33.3333 MHz
  Clock High frequency: 200.0000 MHz
  IDROM Type: 3
  Instance Stride 0: 4
  Instance Stride 1: 64
  Register Stride 0: 256
  Register Stride 1: 256

Modules in configuration:

  Module: DPLL
  There are 1 of DPLL in configuration
  Version: 0
  Registers: 7
  BaseAddress: 7000
  ClockFrequency: 33.333 MHz
  Register Stride: 256 bytes
  Instance Stride: 4 bytes

  Module: WatchDog
  There are 1 of WatchDog in configuration
  Version: 0
  Registers: 3
  BaseAddress: 0C00
  ClockFrequency: 33.333 MHz
  Register Stride: 256 bytes
  Instance Stride: 4 bytes

  Module: IOPort
  There are 2 of IOPort in configuration
  Version: 0
  Registers: 5
  BaseAddress: 1000
  ClockFrequency: 33.333 MHz
  Register Stride: 256 bytes
  Instance Stride: 4 bytes

  Module: BISS
  There are 3 of BISS in configuration
  Version: 0
  Registers: 4
  BaseAddress: 4A00
  ClockFrequency: 200.000 MHz
  Register Stride: 256 bytes
  Instance Stride: 4 bytes

  Module: QCount
  There are 1 of QCount in configuration
  Version: 2
  Registers: 5
  BaseAddress: 3000
  ClockFrequency: 33.333 MHz
  Register Stride: 256 bytes
  Instance Stride: 4 bytes

  Module: SSerial
  There are 1 of SSerial in configuration
  Version: 0
  Registers: 6
  BaseAddress: 5B00
  ClockFrequency: 33.333 MHz
  Register Stride: 256 bytes
  Instance Stride: 64 bytes

  Module: StepGen
  There are 5 of StepGen in configuration
  Version: 2
  Registers: 10
  BaseAddress: 2000
  ClockFrequency: 33.333 MHz
  Register Stride: 256 bytes
  Instance Stride: 4 bytes

  Module: LED
  There are 1 of LED in configuration
  Version: 0
  Registers: 1
  BaseAddress: 0200
  ClockFrequency: 33.333 MHz
  Register Stride: 256 bytes
  Instance Stride: 4 bytes

Configuration pin-out:

IO Connections for P3
DB25 pin#             I/O   Pri. func    Sec. func        Chan     Sec. Pin func   Sec. Pin Dir

 1                      0   IOPort       StepGen          0        Dir/Table2      (Out)
14                      1   IOPort       StepGen          0        Step/Table1     (Out)
 2                      2   IOPort       StepGen          1        Dir/Table2      (Out)
15                      3   IOPort       StepGen          1        Step/Table1     (Out)
 3                      4   IOPort       StepGen          2        Dir/Table2      (Out)
16                      5   IOPort       StepGen          2        Step/Table1     (Out)
 4                      6   IOPort       StepGen          3        Dir/Table2      (Out)
17                      7   IOPort       StepGen          3        Step/Table1     (Out)
 5                      8   IOPort       StepGen          4        Dir/Table2      (Out)
 6                      9   IOPort       StepGen          4        Step/Table1     (Out)
 7                     10   IOPort       SSerial          0        TXData0         (Out)
 8                     11   IOPort       SSerial          0        RXData0         (In)
 9                     12   IOPort       SSerial          0        TXData1         (Out)
10                     13   IOPort       SSerial          0        RXData1         (In)
11                     14   IOPort       QCount           0        Quad-IDX        (In)
12                     15   IOPort       QCount           0        Quad-B          (In)
13                     16   IOPort       QCount           0        Quad-A          (In)

IO Connections for P2
DB25 pin#             I/O   Pri. func    Sec. func        Chan     Sec. Pin func   Sec. Pin Dir

 1                     17   IOPort       BISS             0        Din             (In)
14                     18   IOPort       BISS             1        Din             (In)
 2                     19   IOPort       BISS             2        Din             (In)
15                     20   IOPort       None           
 3                     21   IOPort       BISS             0        Clk             (Out)
16                     22   IOPort       BISS             1        Clk             (Out)
 4                     23   IOPort       BISS             2        Clk             (Out)
17                     24   IOPort       None           
 5                     25   IOPort       None           
 6                     26   IOPort       None           
 7                     27   IOPort       None           
 8                     28   IOPort       None           
 9                     29   IOPort       None           
10                     30   IOPort       None           
11                     31   IOPort       None           
12                     32   IOPort       None           
13                     33   IOPort       None

2. Installed linuxcnc-uspace 2.9.2 on debian 12 running 6.1.0-28-rt-amd64 PREEMPT and made a few configuration to make the encoder spit some data. Found a post here about someone succesfully set up renishaw resolute glass scale and they had mentioned this line is the most important in setting up the encoder: loadrt hm2_pci config="num_encoders=1 num_pwmgens=0 num_stepgens=5 sserial_port_0=00xxxxxx biss_chan_0=null%1bzero%2uxencoder%24eerror%1bwarning%1bcrc%6f"

3. I did some more digging around to narrow down other BISS related settings in the HAL config:
setp hm2_5i25.0.biss.00.timer-number 1
setp hm2_5i25.0.biss.00.frequency-khz 1000
setp hm2_5i25.0.biss.00.xencoder.scale 1000
setp hm2_5i25.0.biss.00.xencoder.counts-per-rev 5000
setp hm2_5i25.0.dpll.01.timer-us -500
setp hm2_5i25.0.stepgen.timer-number 1

This somehow makes the encoder spit some data but it was very skipy and changed direction even when I was moving the reader head in one direction. Assuming I was moving the reader head with my hand keeping the magnetic scale on the table was not optimal, I waited till the machine was assembled to test it on proper linear stages.
Now that I have mounted the machine axis onto linear guideways and reading from the scale is still the same level of skippy and changes direction abruptly.
Asking around modern LLMs went through all the encoder related documents and suggested the my reader model LA11-2Do with 1 micro meter resolution spits 20bits of left leaning position data and suggested I need to bit shift by 6bits to correctly read the scale.
I then went on trying so many of the suggestions all failing to recognize the syntax, the LLM suggested that though
BISSTag module was included in the ModuleID, the parameter bit-shift seem to be missing. So we need to hardcode the bitshift value for example:
entity biss is
  generic (
    bit_shift : integer := 6  -- Set this to your desired value (e.g., 6)
  );
  port (...);
end entity;

It suggests me to load the firmware with loadrt hostmot2 config="firmware=/path/to/recompiled_firmware.BIT".
Though I'm skeptical about the process's validity because I heard that we don't need to load the firmware from our computer but they are stored onboard. I want to know is there a possible solution to this.

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

More
31 Jan 2025 17:57 #320246 by PCW
Replied by PCW on topic Hal configuration for BISS encoder
1. There's no need to load firmware in the hal file as 5I25s store firmware permanently on the card

2. Any bit shift error needs to be corrected in the format string (that's the  purpose of the format string)

3. You need the encoder specific information to create a format string that matches your encoder

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

More
01 Feb 2025 05:18 #320286 by pmchetan
Replied by pmchetan on topic Hal configuration for BISS encoder
I have very hard time understanding the format syntax from the documentation. I have two strings that I got from other people mentioning about them in their configurations and the chatgpt/deepseekR1 's interpretation of linuxcnc documentations.

1. loadrt hostmot2 config="firmware=hm2/5i25/SVST8_8.BIT,biss=0,0,0,6"
Even If I take out the firmware=hm2/5i25/SVST8_8.BIT part from the above line, I still get the error: Unknown parameter 'config=biss=0,0,0,6' So I am guessing this configuration string for hostmot2 driver is either invalid or not needed.

2. loadrt hm2_pci config="... biss_chan_0=start%1bxencoder%26eerror%6bwarning%6bcrc%6f"
This partially works like I said earlier. It does seem to be showing accurate measured values for small distances(within a centimeter) but it erratically jumps around if I move a little distance. changing to crc%6f instead of discarding the CRC results in an error which starting linuxcnc.

I have 3 sets of linear scales. Should I just mix and match, trying different values until something sticks like changing to xencoder%20e instead of 26e? could configuring with wrong values brake the hardware?
Page 16 in compressedLA11Do1_12.pdf I've attached has the biss related encoder details. Pages right before has SSI protocol specific details. I understand nothing from the CRCD01_01.pdf
 
Attachments:

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

More
01 Feb 2025 13:26 #320322 by pmchetan
Replied by pmchetan on topic Hal configuration for BISS encoder
You had given me a config string a few months ago in discussion from another thread:

PCW-  "Judging by the pdf I think this is correct, not sure about the initial null though

           "biss_chan_0=null%1bcrc%6fwarning%1berror%1bzero%2uencoder%24e"

            (the added "zero" is for the zeros bits in the 26 bit position code"

I didn't understand it at the time. I'll try this and report back if it works.

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

More
10 Feb 2025 09:54 - 10 Feb 2025 11:11 #321147 by pmchetan
Replied by pmchetan on topic Hal configuration for BISS encoder
For people who might be looking to set similar hardware: The hm2_pci configuration string "biss_chan_0=start%1bxencoder%24ezero%2ueerror%1bwarning%1bcrc%6f" works correctly for my setup of Renishaw (RLS) AS10 scale with LA11 reader.
To set the right scale, I noted down the total raw counts the encoder was spitting on pin: hm2_5i25.biss.0.xencoder.rawcounts and divided the total count with physical length of the scale measured in millimeter in my case. It turned out to be 1000000 counts per millimeter. I tried setting the scale with setp hm2_5i25.0.biss.00.xencoder.scale 1000000 and the linuxcnc GUI showed correct measurement.

I solved setting up the linear scale part of the equation and now am trying to make a precision servo axis with the said scale system coupled with a low cost BLDC motor and drive: robokits.co.in/automation-control-cnc/br...rmcs-6611-750w-drive

{Buying this drive was a mistake but in my defence, it did mention it has pulse input mentioned in its listing: robokits.co.in/motor-drives-drivers/brus...odbus-rtu-compatible
The seller suggests using bc547 transistor based external circuit to pull the SV pin on the drive to ground at the step frequency from 7i76 but I am unable to understand why it's not working for me when the seller setup the same circuit and sent me the video of driving the motor using pulse signals from an arduino.}

@PCW if you could make exact same 3 channel BISS firmware but with 6i25_7i77_7i74 this time. I would like to try making the available components (the motor & drive) into closed loop servo axis.
Also can we use pwmgen instead of stepgen on 7i76 to interface with the drive I have?
Last edit: 10 Feb 2025 11:11 by pmchetan. Reason: Asked for additional details about pwmgen

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

More
10 Feb 2025 17:55 #321177 by PCW
Replied by PCW on topic Hal configuration for BISS encoder
5I25/7I77/7I74-BISS
 

File Attachment:

File Name: 5i25_7i77_...ss3d.zip
File Size:91 KB


5i25/7i76 with 3 PWMgens replacing the first 3 stepgens with BISS on 7I74
 

File Attachment:

File Name: 5i25_7i76p...ss3d.zip
File Size:88 KB

 
Attachments:

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

More
11 Feb 2025 11:13 #321226 by pmchetan
Replied by pmchetan on topic Hal configuration for BISS encoder
Is there any information on which pins on 7i76 board are the pwm generators mapped onto? For instance, TB2 connector on 7i76 had GND, Step0-, step0+, Dir0-, Dir0+ and +5Vp with default stepgen firmware.
I couldn't find which pin to connect.

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

More
11 Feb 2025 15:25 #321239 by PCW
Replied by PCW on topic Hal configuration for BISS encoder
sudo mesaflash --device 5i25 --dbname1 7i76 --dbname2 7i74 --readhmid

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

More
12 Feb 2025 09:57 #321333 by pmchetan
Replied by pmchetan on topic Hal configuration for BISS encoder
Can someone help me with HAL configuration?
I'm getting joint follow error. I tried removing all the encoder feedback lines. Either linuxcnc won't start or it will start and shows join0 follow error. Could someone give me how to make a minimal HAL for openloop testing with non standard firmware generating pwm signals on 7i76?

 

File Attachment:

File Name: 5i25_7i76PWM_7i74.hal
File Size:5 KB
Attachments:

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

More
12 Feb 2025 14:47 #321341 by PCW
Replied by PCW on topic Hal configuration for BISS encoder
I would widen the following error limits in the ini file
so you can see the behavior (be careful of runaways)

Have you verified that you can control the motor with the PWM signal?

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

Time to create page: 0.080 seconds
Powered by Kunena Forum