Strange stepgen behaviour with 7i95t_1pktv2d firmware

More
05 Nov 2024 14:23 - 05 Nov 2024 14:29 #313817 by Finngineering
Thank you for investing time in this. Of course, if the issue is not reproducible for you, the "return on investment" for you looking for the cause is very low.

I have done a bit of investigation myself, by looking at the network traffic. There will be quite a bit of information here, but I would say the conclusion is that the jump in position-fb is not visible in the packets from the 7i95T. In other words, the cause almost has to be somewhere on the linuxcnc side.

I changed my config to enable some debugging information and reducing the "modules" as much as possible (while still having the jump in position-fb):
loadrt threads name1=servo-thread period1=1000000
loadrt hostmot2 debug_module_descriptors=1 debug_modules=1
loadrt hm2_eth board_ip="10.10.10.10" config="num_stepgens=5 num_ssrs=0 num_inmuxs=0 num_leds=0" # This causes jumps in hm2_7i95.0.stepgen.00.position-fb

addf hm2_7i95.0.read          servo-thread
addf hm2_7i95.0.write         servo-thread

loadrt maho_vfd ports=hm2_7i95.0.pktuart.0
addf maho_vfd.00 servo-thread

start

The console output from starting the script is:
$ halcmd -f pktuart_bug.hal 
Note: Using POSIX realtime
hm2: loading Mesa HostMot2 driver version 0.15
hm2_eth: loading Mesa AnyIO HostMot2 ethernet driver version 0.2
hm2_eth: 10.10.10.10: INFO: Hardware address (MAC): 00:60:1b:15:80:02
hm2_eth: discovered 7I95T
hm2/hm2_7i95.0: Low Level init 0.15
hm2/hm2_7i95.0: Module Descriptor 0 at 0x0440:
hm2/hm2_7i95.0:     General Function Tag: 26 (Hostmot2 DPLL)
hm2/hm2_7i95.0:     Version: 0
hm2/hm2_7i95.0:     Clock Tag: 1 (100.000 MHz)
hm2/hm2_7i95.0:     Instances: 1
hm2/hm2_7i95.0:     Base Address: 0x7000
hm2/hm2_7i95.0:     -- Num Registers: 7
hm2/hm2_7i95.0:     Register Stride: 0x00000100
hm2/hm2_7i95.0:     -- Instance Stride: 0x00000004
hm2/hm2_7i95.0:     -- Multiple Registers: 0x00000000
hm2/hm2_7i95.0: Module Descriptor 1 at 0x044C:
hm2/hm2_7i95.0:     General Function Tag: 2 (Watchdog)
hm2/hm2_7i95.0:     Version: 0
hm2/hm2_7i95.0:     Clock Tag: 1 (100.000 MHz)
hm2/hm2_7i95.0:     Instances: 1
hm2/hm2_7i95.0:     Base Address: 0x0C00
hm2/hm2_7i95.0:     -- Num Registers: 3
hm2/hm2_7i95.0:     Register Stride: 0x00000100
hm2/hm2_7i95.0:     -- Instance Stride: 0x00000004
hm2/hm2_7i95.0:     -- Multiple Registers: 0x00000000
hm2/hm2_7i95.0: Module Descriptor 2 at 0x0458:
hm2/hm2_7i95.0:     General Function Tag: 3 (IOPort)
hm2/hm2_7i95.0:     Version: 0
hm2/hm2_7i95.0:     Clock Tag: 1 (100.000 MHz)
hm2/hm2_7i95.0:     Instances: 2
hm2/hm2_7i95.0:     Base Address: 0x1000
hm2/hm2_7i95.0:     -- Num Registers: 5
hm2/hm2_7i95.0:     Register Stride: 0x00000100
hm2/hm2_7i95.0:     -- Instance Stride: 0x00000004
hm2/hm2_7i95.0:     -- Multiple Registers: 0x0000001F
hm2/hm2_7i95.0: Module Descriptor 3 at 0x0464:
hm2/hm2_7i95.0:     General Function Tag: 12 (Muxed Encoder)
hm2/hm2_7i95.0:     Version: 4
hm2/hm2_7i95.0:     Clock Tag: 1 (100.000 MHz)
hm2/hm2_7i95.0:     Instances: 6
hm2/hm2_7i95.0:     Base Address: 0x3600
hm2/hm2_7i95.0:     -- Num Registers: 5
hm2/hm2_7i95.0:     Register Stride: 0x00000100
hm2/hm2_7i95.0:     -- Instance Stride: 0x00000004
hm2/hm2_7i95.0:     -- Multiple Registers: 0x00000003
hm2/hm2_7i95.0: Module Descriptor 4 at 0x0470:
hm2/hm2_7i95.0:     General Function Tag: 13 (Muxed Encoder Select)
hm2/hm2_7i95.0:     Version: 0
hm2/hm2_7i95.0:     Clock Tag: 1 (100.000 MHz)
hm2/hm2_7i95.0:     Instances: 1
hm2/hm2_7i95.0:     Base Address: 0x0000
hm2/hm2_7i95.0:     -- Num Registers: 0
hm2/hm2_7i95.0:     Register Stride: 0x00000100
hm2/hm2_7i95.0:     -- Instance Stride: 0x00000004
hm2/hm2_7i95.0:     -- Multiple Registers: 0x00000000
hm2/hm2_7i95.0: Module Descriptor 5 at 0x047C:
hm2/hm2_7i95.0:     General Function Tag: 27 (PktUART Transmit Channel)
hm2/hm2_7i95.0:     Version: 2
hm2/hm2_7i95.0:     Clock Tag: 1 (100.000 MHz)
hm2/hm2_7i95.0:     Instances: 1
hm2/hm2_7i95.0:     Base Address: 0x6100
hm2/hm2_7i95.0:     -- Num Registers: 4
hm2/hm2_7i95.0:     Register Stride: 0x00000100
hm2/hm2_7i95.0:     -- Instance Stride: 0x00000004
hm2/hm2_7i95.0:     -- Multiple Registers: 0x0000000F
hm2/hm2_7i95.0: Module Descriptor 6 at 0x0488:
hm2/hm2_7i95.0:     General Function Tag: 28 (PktUART Receive Channel)
hm2/hm2_7i95.0:     Version: 2
hm2/hm2_7i95.0:     Clock Tag: 1 (100.000 MHz)
hm2/hm2_7i95.0:     Instances: 1
hm2/hm2_7i95.0:     Base Address: 0x6500
hm2/hm2_7i95.0:     -- Num Registers: 4
hm2/hm2_7i95.0:     Register Stride: 0x00000100
hm2/hm2_7i95.0:     -- Instance Stride: 0x00000004
hm2/hm2_7i95.0:     -- Multiple Registers: 0x0000000F
hm2/hm2_7i95.0: Module Descriptor 7 at 0x0494:
hm2/hm2_7i95.0:     General Function Tag: 193 (Smart Serial Interface)
hm2/hm2_7i95.0:     Version: 0
hm2/hm2_7i95.0:     Clock Tag: 1 (100.000 MHz)
hm2/hm2_7i95.0:     Instances: 1
hm2/hm2_7i95.0:     Base Address: 0x5B00
hm2/hm2_7i95.0:     -- Num Registers: 6
hm2/hm2_7i95.0:     Register Stride: 0x00000100
hm2/hm2_7i95.0:     -- Instance Stride: 0x00000040
hm2/hm2_7i95.0:     -- Multiple Registers: 0x0000003C
hm2/hm2_7i95.0: Module Descriptor 8 at 0x04A0:
hm2/hm2_7i95.0:     General Function Tag: 5 (StepGen)
hm2/hm2_7i95.0:     Version: 2
hm2/hm2_7i95.0:     Clock Tag: 1 (100.000 MHz)
hm2/hm2_7i95.0:     Instances: 6
hm2/hm2_7i95.0:     Base Address: 0x2000
hm2/hm2_7i95.0:     -- Num Registers: 10
hm2/hm2_7i95.0:     Register Stride: 0x00000100
hm2/hm2_7i95.0:     -- Instance Stride: 0x00000004
hm2/hm2_7i95.0:     -- Multiple Registers: 0x000001FF
hm2/hm2_7i95.0: Module Descriptor 9 at 0x04AC:
hm2/hm2_7i95.0:     General Function Tag: 195 (SSR)
hm2/hm2_7i95.0:     Version: 0
hm2/hm2_7i95.0:     Clock Tag: 1 (100.000 MHz)
hm2/hm2_7i95.0:     Instances: 1
hm2/hm2_7i95.0:     Base Address: 0x7D00
hm2/hm2_7i95.0:     -- Num Registers: 2
hm2/hm2_7i95.0:     Register Stride: 0x00000100
hm2/hm2_7i95.0:     -- Instance Stride: 0x00000004
hm2/hm2_7i95.0:     -- Multiple Registers: 0x00000003
hm2/hm2_7i95.0: Module Descriptor 10 at 0x04B8:
hm2/hm2_7i95.0:     General Function Tag: 30 (InMux Input Mux)
hm2/hm2_7i95.0:     Version: 0
hm2/hm2_7i95.0:     Clock Tag: 1 (100.000 MHz)
hm2/hm2_7i95.0:     Instances: 1
hm2/hm2_7i95.0:     Base Address: 0x8000
hm2/hm2_7i95.0:     -- Num Registers: 5
hm2/hm2_7i95.0:     Register Stride: 0x00000100
hm2/hm2_7i95.0:     -- Instance Stride: 0x00000004
hm2/hm2_7i95.0:     -- Multiple Registers: 0x0000001F
hm2/hm2_7i95.0: Module Descriptor 11 at 0x04C4:
hm2/hm2_7i95.0:     General Function Tag: 128 (LED)
hm2/hm2_7i95.0:     Version: 0
hm2/hm2_7i95.0:     Clock Tag: 1 (100.000 MHz)
hm2/hm2_7i95.0:     Instances: 1
hm2/hm2_7i95.0:     Base Address: 0x0200
hm2/hm2_7i95.0:     -- Num Registers: 1
hm2/hm2_7i95.0:     Register Stride: 0x00000100
hm2/hm2_7i95.0:     -- Instance Stride: 0x00000004
hm2/hm2_7i95.0:     -- Multiple Registers: 0x00000000
hm2/hm2_7i95.0: created PktUART Interface function hm2_7i95.0.pktuart.0.
hm2/hm2_7i95.0: Smart Serial Firmware Version 43
Board hm2_7i95.0.7i84.0.0 Hardware Mode 0 = standard
Board hm2_7i95.0.7i84.0.0 Software Mode 0 = input_output
Board hm2_7i95.0.7i84.0.0 Software Mode 1 = io_analog_fieldvoltage
Board hm2_7i95.0.7i84.0.0 Software Mode 2 = io_encoder_analog
hm2/hm2_7i95.0: 58 I/O Pins used:
hm2/hm2_7i95.0:     IO Pin 000 (TB3-02/TB3-03): StepGen #0, pin Step (Output)
hm2/hm2_7i95.0:     IO Pin 001 (TB3-04/TB3-05): StepGen #0, pin Direction (Output)
hm2/hm2_7i95.0:     IO Pin 002 (TB3-08/TB3-09): StepGen #1, pin Step (Output)
hm2/hm2_7i95.0:     IO Pin 003 (TB3-10/TB3-11): StepGen #1, pin Direction (Output)
hm2/hm2_7i95.0:     IO Pin 004 (TB3-14/TB3-15): StepGen #2, pin Step (Output)
hm2/hm2_7i95.0:     IO Pin 005 (TB3-16/TB3-17): StepGen #2, pin Direction (Output)
hm2/hm2_7i95.0:     IO Pin 006 (TB3-20/TB3-21): StepGen #3, pin Step (Output)
hm2/hm2_7i95.0:     IO Pin 007 (TB3-22/TB3-23): StepGen #3, pin Direction (Output)
hm2/hm2_7i95.0:     IO Pin 008 (TB4-02/TB4-03): StepGen #4, pin Step (Output)
hm2/hm2_7i95.0:     IO Pin 009 (TB4-04/TB4-05): StepGen #4, pin Direction (Output)
hm2/hm2_7i95.0:     IO Pin 010 (TB4-08/TB4-09): IOPort
hm2/hm2_7i95.0:     IO Pin 011 (TB4-10/TB4-11): IOPort
hm2/hm2_7i95.0:     IO Pin 012 (TB4-14/TB4-15): Smart Serial Interface #0, pin rx0 (Input)
hm2/hm2_7i95.0:     IO Pin 013 (TB4-16/TB4-17): Smart Serial Interface #0, pin tx0 (Output)
hm2/hm2_7i95.0:     IO Pin 014 (TB3-16/TB3-17): Smart Serial Interface #0, pin txen0 (Output)
hm2/hm2_7i95.0:     IO Pin 015 (TB4-20/TB4-21): PktUART Receive Channel #0, pin RX Data (Input)
hm2/hm2_7i95.0:     IO Pin 016 (TB4-22/TB4-23): PktUART Transmit Channel #0, pin TX Data (Output)
hm2/hm2_7i95.0:     IO Pin 017 (TB4-22/TB4-23): PktUART Transmit Channel #0, pin Drv Enable (Output)
hm2/hm2_7i95.0:     IO Pin 018 (TB1-01/TB1-09): Muxed Encoder #0, pin Muxed A (Input)
hm2/hm2_7i95.0:     IO Pin 019 (TB1-04/TB1-12): Muxed Encoder #0, pin Muxed B (Input)
hm2/hm2_7i95.0:     IO Pin 020 (TB1-07/TB1-15): Muxed Encoder #0, pin Muxed Index (Input)
hm2/hm2_7i95.0:     IO Pin 021 (TB1-17/TB2-01): Muxed Encoder #1, pin Muxed A (Input)
hm2/hm2_7i95.0:     IO Pin 022 (TB1-20/TB2-04): Muxed Encoder #1, pin Muxed B (Input)
hm2/hm2_7i95.0:     IO Pin 023 (TB1-23/TB2-07): Muxed Encoder #1, pin Muxed Index (Input)
hm2/hm2_7i95.0:     IO Pin 024 (TB2-09/TB2-17): Muxed Encoder #2, pin Muxed A (Input)
hm2/hm2_7i95.0:     IO Pin 025 (TB2-12/TB2-20): Muxed Encoder #2, pin Muxed B (Input)
hm2/hm2_7i95.0:     IO Pin 026 (TB2-15/TB2-23): Muxed Encoder #2, pin Muxed Index (Input)
hm2/hm2_7i95.0:     IO Pin 027 (Internal EncMux): Muxed Encoder Select #0, pin Mux Select 0 (Output)
hm2/hm2_7i95.0:     IO Pin 028 (Internal InMux0): IOPort
hm2/hm2_7i95.0:     IO Pin 029 (Internal InMux1): IOPort
hm2/hm2_7i95.0:     IO Pin 030 (Internal InMux2): IOPort
hm2/hm2_7i95.0:     IO Pin 031 (Internal InMux3): IOPort
hm2/hm2_7i95.0:     IO Pin 032 (Internal InMux4): IOPort
hm2/hm2_7i95.0:     IO Pin 033 (Internal InMuxData): IOPort
hm2/hm2_7i95.0:     IO Pin 034 (TB5-13/TB5-14): IOPort
hm2/hm2_7i95.0:     IO Pin 035 (TB5-15/TB5-16): IOPort
hm2/hm2_7i95.0:     IO Pin 036 (TB5-17/TB5-18): IOPort
hm2/hm2_7i95.0:     IO Pin 037 (TB5-19/TB5-20): IOPort
hm2/hm2_7i95.0:     IO Pin 038 (TB5-21/TB5-22): IOPort
hm2/hm2_7i95.0:     IO Pin 039 (TB5-23/TB5-24): IOPort
hm2/hm2_7i95.0:     IO Pin 040 (internal): IOPort
hm2/hm2_7i95.0:     IO Pin 041 (P1-01/DB25-01): IOPort
hm2/hm2_7i95.0:     IO Pin 042 (P1-02/DB25-14): IOPort
hm2/hm2_7i95.0:     IO Pin 043 (P1-03/DB25-02): IOPort
hm2/hm2_7i95.0:     IO Pin 044 (P1-04/DB25-15): IOPort
hm2/hm2_7i95.0:     IO Pin 045 (P1-05/DB25-03): IOPort
hm2/hm2_7i95.0:     IO Pin 046 (P1-06/DB25-16): IOPort
hm2/hm2_7i95.0:     IO Pin 047 (P1-07/DB25-04): IOPort
hm2/hm2_7i95.0:     IO Pin 048 (P1-08/DB25-17): IOPort
hm2/hm2_7i95.0:     IO Pin 049 (P1-09/DB25-05): IOPort
hm2/hm2_7i95.0:     IO Pin 050 (P1-11/DB25-06): IOPort
hm2/hm2_7i95.0:     IO Pin 051 (P1-13/DB25-07): IOPort
hm2/hm2_7i95.0:     IO Pin 052 (P1-15/DB25-08): IOPort
hm2/hm2_7i95.0:     IO Pin 053 (P1-17/DB25-09): IOPort
hm2/hm2_7i95.0:     IO Pin 054 (P1-19/DB25-10): IOPort
hm2/hm2_7i95.0:     IO Pin 055 (P1-21/DB25-11): IOPort
hm2/hm2_7i95.0:     IO Pin 056 (P1-23/DB25-12): IOPort
hm2/hm2_7i95.0:     IO Pin 057 (P1-25/DB25-13): IOPort
hm2/hm2_7i95.0: HM2 Modules used:
hm2/hm2_7i95.0: Encoders: 6
hm2/hm2_7i95.0:     clock_frequency: 100000000 Hz (100.000 MHz)
hm2/hm2_7i95.0:     version: 4
hm2/hm2_7i95.0:     counter_addr: 0x3600
hm2/hm2_7i95.0:     latch_control_addr: 0x3700
hm2/hm2_7i95.0:     timestamp_div_addr: 0x3800
hm2/hm2_7i95.0:     timestamp_count_addr: 0x3900
hm2/hm2_7i95.0:     filter_rate_addr: 0x3A00
hm2/hm2_7i95.0:     timestamp_div: 0x0000
hm2/hm2_7i95.0:     instance 0:
hm2/hm2_7i95.0:         hw:
hm2/hm2_7i95.0:             counter = 4aec.0001
hm2/hm2_7i95.0:             latch/control = 0000.0800
hm2/hm2_7i95.0:             prev_control = 0000.0800
hm2/hm2_7i95.0:     instance 1:
hm2/hm2_7i95.0:         hw:
hm2/hm2_7i95.0:             counter = 0000.0000
hm2/hm2_7i95.0:             latch/control = 0000.0800
hm2/hm2_7i95.0:             prev_control = 0000.0800
hm2/hm2_7i95.0:     instance 2:
hm2/hm2_7i95.0:         hw:
hm2/hm2_7i95.0:             counter = 90db.ffff
hm2/hm2_7i95.0:             latch/control = 0000.0800
hm2/hm2_7i95.0:             prev_control = 0000.0800
hm2/hm2_7i95.0:     instance 3:
hm2/hm2_7i95.0:         hw:
hm2/hm2_7i95.0:             counter = 003d.ffff
hm2/hm2_7i95.0:             latch/control = 0000.0800
hm2/hm2_7i95.0:             prev_control = 0000.0800
hm2/hm2_7i95.0:     instance 4:
hm2/hm2_7i95.0:         hw:
hm2/hm2_7i95.0:             counter = 0000.0000
hm2/hm2_7i95.0:             latch/control = 0000.0800
hm2/hm2_7i95.0:             prev_control = 0000.0800
hm2/hm2_7i95.0:     instance 5:
hm2/hm2_7i95.0:         hw:
hm2/hm2_7i95.0:             counter = 0000.0000
hm2/hm2_7i95.0:             latch/control = 0000.0800
hm2/hm2_7i95.0:             prev_control = 0000.0800
hm2/hm2_7i95.0: SSerial: 1
hm2/hm2_7i95.0:   version 43
hm2/hm2_7i95.0:     instance 0:
hm2/hm2_7i95.0:         Command Addr 0x5b00
hm2/hm2_7i95.0:         Data Addr    0x5c00
hm2/hm2_7i95.0:         port 0 device hm2_7i95.0.7i84.0.0
hm2/hm2_7i95.0:              Parameters:
hm2/hm2_7i95.0:                    RecordType = 0xa0
hm2/hm2_7i95.0:                    DataLength = 0x20
hm2/hm2_7i95.0:                    DataType = 0x01
hm2/hm2_7i95.0:                    DataDir = 0x00
hm2/hm2_7i95.0:                    ParmMax 1.00
hm2/hm2_7i95.0:                    ParmMin 0.00
hm2/hm2_7i95.0:                    SizeOf ParmMin 0x04
hm2/hm2_7i95.0:                    ParmAddr = 0x0808
hm2/hm2_7i95.0:                    UnitString = none
hm2/hm2_7i95.0:                    NameString = input

hm2/hm2_7i95.0:                    RecordType = 0xa0
hm2/hm2_7i95.0:                    DataLength = 0x10
hm2/hm2_7i95.0:                    DataType = 0x01
hm2/hm2_7i95.0:                    DataDir = 0x80
hm2/hm2_7i95.0:                    ParmMax 1.00
hm2/hm2_7i95.0:                    ParmMin 0.00
hm2/hm2_7i95.0:                    SizeOf ParmMin 0x04
hm2/hm2_7i95.0:                    ParmAddr = 0x0800
hm2/hm2_7i95.0:                    UnitString = none
hm2/hm2_7i95.0:                    NameString = output

hm2/hm2_7i95.0:              Globals:
hm2/hm2_7i95.0:                    RecordType = 0xa0
hm2/hm2_7i95.0:                    DataLength = 0x08
hm2/hm2_7i95.0:                    DataType = 0x02
hm2/hm2_7i95.0:                    DataDir = 0x00
hm2/hm2_7i95.0:                    ParmMax 36.29
hm2/hm2_7i95.0:                    ParmMin 0.00
hm2/hm2_7i95.0:                    SizeOf ParmMin 4
hm2/hm2_7i95.0:                    ParmAddr = 0x0810
hm2/hm2_7i95.0:                    UnitString = volts
hm2/hm2_7i95.0:                    NameString = analogin0

hm2/hm2_7i95.0:                    RecordType = 0xa0
hm2/hm2_7i95.0:                    DataLength = 0x08
hm2/hm2_7i95.0:                    DataType = 0x02
hm2/hm2_7i95.0:                    DataDir = 0x00
hm2/hm2_7i95.0:                    ParmMax 36.29
hm2/hm2_7i95.0:                    ParmMin 0.00
hm2/hm2_7i95.0:                    SizeOf ParmMin 4
hm2/hm2_7i95.0:                    ParmAddr = 0x0811
hm2/hm2_7i95.0:                    UnitString = volts
hm2/hm2_7i95.0:                    NameString = analogin1

hm2/hm2_7i95.0:                    RecordType = 0xa0
hm2/hm2_7i95.0:                    DataLength = 0x08
hm2/hm2_7i95.0:                    DataType = 0x02
hm2/hm2_7i95.0:                    DataDir = 0x00
hm2/hm2_7i95.0:                    ParmMax 36.29
hm2/hm2_7i95.0:                    ParmMin 0.00
hm2/hm2_7i95.0:                    SizeOf ParmMin 4
hm2/hm2_7i95.0:                    ParmAddr = 0x0812
hm2/hm2_7i95.0:                    UnitString = volts
hm2/hm2_7i95.0:                    NameString = analogin2

hm2/hm2_7i95.0:                    RecordType = 0xa0
hm2/hm2_7i95.0:                    DataLength = 0x08
hm2/hm2_7i95.0:                    DataType = 0x02
hm2/hm2_7i95.0:                    DataDir = 0x00
hm2/hm2_7i95.0:                    ParmMax 36.29
hm2/hm2_7i95.0:                    ParmMin 0.00
hm2/hm2_7i95.0:                    SizeOf ParmMin 4
hm2/hm2_7i95.0:                    ParmAddr = 0x0813
hm2/hm2_7i95.0:                    UnitString = volts
hm2/hm2_7i95.0:                    NameString = analogin3

hm2/hm2_7i95.0:                    RecordType = 0xa0
hm2/hm2_7i95.0:                    DataLength = 0x08
hm2/hm2_7i95.0:                    DataType = 0x08
hm2/hm2_7i95.0:                    DataDir = 0x00
hm2/hm2_7i95.0:                    ParmMax 0.00
hm2/hm2_7i95.0:                    ParmMin 0.00
hm2/hm2_7i95.0:                    SizeOf ParmMin 4
hm2/hm2_7i95.0:                    ParmAddr = 0x09a0
hm2/hm2_7i95.0:                    UnitString = counts
hm2/hm2_7i95.0:                    NameString = enc0

hm2/hm2_7i95.0:                    RecordType = 0xa0
hm2/hm2_7i95.0:                    DataLength = 0x08
hm2/hm2_7i95.0:                    DataType = 0x08
hm2/hm2_7i95.0:                    DataDir = 0x00
hm2/hm2_7i95.0:                    ParmMax 0.00
hm2/hm2_7i95.0:                    ParmMin 0.00
hm2/hm2_7i95.0:                    SizeOf ParmMin 4
hm2/hm2_7i95.0:                    ParmAddr = 0x09a2
hm2/hm2_7i95.0:                    UnitString = counts
hm2/hm2_7i95.0:                    NameString = enc1

hm2/hm2_7i95.0:                    RecordType = 0xa0
hm2/hm2_7i95.0:                    DataLength = 0x10
hm2/hm2_7i95.0:                    DataType = 0x02
hm2/hm2_7i95.0:                    DataDir = 0x00
hm2/hm2_7i95.0:                    ParmMax 36.29
hm2/hm2_7i95.0:                    ParmMin 0.00
hm2/hm2_7i95.0:                    SizeOf ParmMin 4
hm2/hm2_7i95.0:                    ParmAddr = 0x08a6
hm2/hm2_7i95.0:                    UnitString = volts
hm2/hm2_7i95.0:                    NameString = fieldvoltagea

hm2/hm2_7i95.0:                    RecordType = 0xa0
hm2/hm2_7i95.0:                    DataLength = 0x10
hm2/hm2_7i95.0:                    DataType = 0x02
hm2/hm2_7i95.0:                    DataDir = 0x00
hm2/hm2_7i95.0:                    ParmMax 36.29
hm2/hm2_7i95.0:                    ParmMin 0.00
hm2/hm2_7i95.0:                    SizeOf ParmMin 4
hm2/hm2_7i95.0:                    ParmAddr = 0x08a8
hm2/hm2_7i95.0:                    UnitString = volts
hm2/hm2_7i95.0:                    NameString = fieldvoltageb

hm2/hm2_7i95.0:                    RecordType = 0xa0
hm2/hm2_7i95.0:                    DataLength = 0x10
hm2/hm2_7i95.0:                    DataType = 0x02
hm2/hm2_7i95.0:                    DataDir = 0x00
hm2/hm2_7i95.0:                    ParmMax 0.00
hm2/hm2_7i95.0:                    ParmMin 0.00
hm2/hm2_7i95.0:                    SizeOf ParmMin 4
hm2/hm2_7i95.0:                    ParmAddr = 0x095c
hm2/hm2_7i95.0:                    UnitString = none
hm2/hm2_7i95.0:                    NameString = swrevision

hm2/hm2_7i95.0:                    RecordType = 0xa0
hm2/hm2_7i95.0:                    DataLength = 0x10
hm2/hm2_7i95.0:                    DataType = 0x02
hm2/hm2_7i95.0:                    DataDir = 0x00
hm2/hm2_7i95.0:                    ParmMax 0.00
hm2/hm2_7i95.0:                    ParmMin 0.00
hm2/hm2_7i95.0:                    SizeOf ParmMin 4
hm2/hm2_7i95.0:                    ParmAddr = 0x0974
hm2/hm2_7i95.0:                    UnitString = none
hm2/hm2_7i95.0:                    NameString = hwrevision

hm2/hm2_7i95.0:                    RecordType = 0xa0
hm2/hm2_7i95.0:                    DataLength = 0x20
hm2/hm2_7i95.0:                    DataType = 0x04
hm2/hm2_7i95.0:                    DataDir = 0x00
hm2/hm2_7i95.0:                    ParmMax 0.00
hm2/hm2_7i95.0:                    ParmMin 0.00
hm2/hm2_7i95.0:                    SizeOf ParmMin 4
hm2/hm2_7i95.0:                    ParmAddr = 0x0078
hm2/hm2_7i95.0:                    UnitString = none
hm2/hm2_7i95.0:                    NameString = nvunitnumber

hm2/hm2_7i95.0:                    RecordType = 0xa0
hm2/hm2_7i95.0:                    DataLength = 0x10
hm2/hm2_7i95.0:                    DataType = 0x04
hm2/hm2_7i95.0:                    DataDir = 0x40
hm2/hm2_7i95.0:                    ParmMax 0.00
hm2/hm2_7i95.0:                    ParmMin 0.00
hm2/hm2_7i95.0:                    SizeOf ParmMin 4
hm2/hm2_7i95.0:                    ParmAddr = 0x0064
hm2/hm2_7i95.0:                    UnitString = none
hm2/hm2_7i95.0:                    NameString = nvwatchdogtimeout

hm2/hm2_7i95.0:                    RecordType = 0xa0
hm2/hm2_7i95.0:                    DataLength = 0x10
hm2/hm2_7i95.0:                    DataType = 0x02
hm2/hm2_7i95.0:                    DataDir = 0x40
hm2/hm2_7i95.0:                    ParmMax 0.00
hm2/hm2_7i95.0:                    ParmMin 0.00
hm2/hm2_7i95.0:                    SizeOf ParmMin 4
hm2/hm2_7i95.0:                    ParmAddr = 0x0998
hm2/hm2_7i95.0:                    UnitString = none
hm2/hm2_7i95.0:                    NameString = encmode0

hm2/hm2_7i95.0:                    RecordType = 0xa0
hm2/hm2_7i95.0:                    DataLength = 0x10
hm2/hm2_7i95.0:                    DataType = 0x02
hm2/hm2_7i95.0:                    DataDir = 0x40
hm2/hm2_7i95.0:                    ParmMax 0.00
hm2/hm2_7i95.0:                    ParmMin 0.00
hm2/hm2_7i95.0:                    SizeOf ParmMin 4
hm2/hm2_7i95.0:                    ParmAddr = 0x099a
hm2/hm2_7i95.0:                    UnitString = none
hm2/hm2_7i95.0:                    NameString = encmode1

hm2/hm2_7i95.0:                    RecordType = 0xa0
hm2/hm2_7i95.0:                    DataLength = 0x10
hm2/hm2_7i95.0:                    DataType = 0x04
hm2/hm2_7i95.0:                    DataDir = 0x40
hm2/hm2_7i95.0:                    ParmMax 0.00
hm2/hm2_7i95.0:                    ParmMin 0.00
hm2/hm2_7i95.0:                    SizeOf ParmMin 4
hm2/hm2_7i95.0:                    ParmAddr = 0x0066
hm2/hm2_7i95.0:                    UnitString = none
hm2/hm2_7i95.0:                    NameString = nvencmode0

hm2/hm2_7i95.0:                    RecordType = 0xa0
hm2/hm2_7i95.0:                    DataLength = 0x10
hm2/hm2_7i95.0:                    DataType = 0x04
hm2/hm2_7i95.0:                    DataDir = 0x40
hm2/hm2_7i95.0:                    ParmMax 0.00
hm2/hm2_7i95.0:                    ParmMin 0.00
hm2/hm2_7i95.0:                    SizeOf ParmMin 4
hm2/hm2_7i95.0:                    ParmAddr = 0x0068
hm2/hm2_7i95.0:                    UnitString = none
hm2/hm2_7i95.0:                    NameString = nvencmode1

hm2/hm2_7i95.0:              Modes:
hm2/hm2_7i95.0:                RecordType = 0xb0
hm2/hm2_7i95.0:                ModeIndex = 0x00
hm2/hm2_7i95.0:                ModeType = 0x00
hm2/hm2_7i95.0:                Unused = 0
hm2/hm2_7i95.0:                NameString = standard

hm2/hm2_7i95.0:                RecordType = 0xb0
hm2/hm2_7i95.0:                ModeIndex = 0x00
hm2/hm2_7i95.0:                ModeType = 0x01
hm2/hm2_7i95.0:                Unused = 0
hm2/hm2_7i95.0:                NameString = input_output

hm2/hm2_7i95.0: 
hm2/hm2_7i95.0: StepGen: 5
hm2/hm2_7i95.0:     clock_frequency: 100000000 Hz (100.000 MHz)
hm2/hm2_7i95.0:     version: 2
hm2/hm2_7i95.0:     step_rate_addr: 0x2000
hm2/hm2_7i95.0:     accumulator_addr: 0x2100
hm2/hm2_7i95.0:     mode_addr: 0x2200
hm2/hm2_7i95.0:     dir_setup_time_addr: 0x2300
hm2/hm2_7i95.0:     dir_hold_time_addr: 0x2400
hm2/hm2_7i95.0:     pulse_width_addr: 0x2500
hm2/hm2_7i95.0:     pulse_idle_width_addr: 0x2600
hm2/hm2_7i95.0:     table_sequence_data_setup_addr: 0x2700
hm2/hm2_7i95.0:     table_sequence_length_addr: 0x2800
hm2/hm2_7i95.0:     master_dds_addr: 0x2900
hm2/hm2_7i95.0:     instance 0:
hm2/hm2_7i95.0:         enable = 0
hm2/hm2_7i95.0:         hw:
hm2/hm2_7i95.0:             step_rate = 0x00000000
hm2/hm2_7i95.0:             accumulator = 0x00000000
hm2/hm2_7i95.0:             mode = 0x00000000
hm2/hm2_7i95.0:             dir_setup_time = 0x00003FFF (163830 ns)
hm2/hm2_7i95.0:             dir_hold_time = 0x00003FFF (163830 ns)
hm2/hm2_7i95.0:             pulse_width = 0x00003FFF (163830 ns)
hm2/hm2_7i95.0:             pulse_idle_width = 0x00003FFF (163830 ns)
hm2/hm2_7i95.0:     instance 1:
hm2/hm2_7i95.0:         enable = 0
hm2/hm2_7i95.0:         hw:
hm2/hm2_7i95.0:             step_rate = 0x00000000
hm2/hm2_7i95.0:             accumulator = 0x00000000
hm2/hm2_7i95.0:             mode = 0x00000000
hm2/hm2_7i95.0:             dir_setup_time = 0x00003FFF (163830 ns)
hm2/hm2_7i95.0:             dir_hold_time = 0x00003FFF (163830 ns)
hm2/hm2_7i95.0:             pulse_width = 0x00003FFF (163830 ns)
hm2/hm2_7i95.0:             pulse_idle_width = 0x00003FFF (163830 ns)
hm2/hm2_7i95.0:     instance 2:
hm2/hm2_7i95.0:         enable = 0
hm2/hm2_7i95.0:         hw:
hm2/hm2_7i95.0:             step_rate = 0x00000000
hm2/hm2_7i95.0:             accumulator = 0x00000000
hm2/hm2_7i95.0:             mode = 0x00000000
hm2/hm2_7i95.0:             dir_setup_time = 0x00003FFF (163830 ns)
hm2/hm2_7i95.0:             dir_hold_time = 0x00003FFF (163830 ns)
hm2/hm2_7i95.0:             pulse_width = 0x00003FFF (163830 ns)
hm2/hm2_7i95.0:             pulse_idle_width = 0x00003FFF (163830 ns)
hm2/hm2_7i95.0:     instance 3:
hm2/hm2_7i95.0:         enable = 0
hm2/hm2_7i95.0:         hw:
hm2/hm2_7i95.0:             step_rate = 0x00000000
hm2/hm2_7i95.0:             accumulator = 0x00000000
hm2/hm2_7i95.0:             mode = 0x00000000
hm2/hm2_7i95.0:             dir_setup_time = 0x00003FFF (163830 ns)
hm2/hm2_7i95.0:             dir_hold_time = 0x00003FFF (163830 ns)
hm2/hm2_7i95.0:             pulse_width = 0x00003FFF (163830 ns)
hm2/hm2_7i95.0:             pulse_idle_width = 0x00003FFF (163830 ns)
hm2/hm2_7i95.0:     instance 4:
hm2/hm2_7i95.0:         enable = 0
hm2/hm2_7i95.0:         hw:
hm2/hm2_7i95.0:             step_rate = 0x00000000
hm2/hm2_7i95.0:             accumulator = 0x00000000
hm2/hm2_7i95.0:             mode = 0x00000000
hm2/hm2_7i95.0:             dir_setup_time = 0x00003FFF (163830 ns)
hm2/hm2_7i95.0:             dir_hold_time = 0x00003FFF (163830 ns)
hm2/hm2_7i95.0:             pulse_width = 0x00003FFF (163830 ns)
hm2/hm2_7i95.0:             pulse_idle_width = 0x00003FFF (163830 ns)
hm2/hm2_7i95.0: IO Ports: 2
hm2/hm2_7i95.0:     clock_frequency: 100000000 Hz (100.000 MHz)
hm2/hm2_7i95.0:     version: 0
hm2/hm2_7i95.0:     data_addr: 0x1000
hm2/hm2_7i95.0:     ddr_addr: 0x1100
hm2/hm2_7i95.0:     alt_source_addr: 0x1200
hm2/hm2_7i95.0:     open_drain_addr: 0x1300
hm2/hm2_7i95.0:     output_invert_addr: 0x1400
hm2/hm2_7i95.0:     instance 0:
hm2/hm2_7i95.0:         data_read = 0x1427BFFF
hm2/hm2_7i95.0:         data_write = 0x000000
hm2/hm2_7i95.0:         ddr = 0x8036000
hm2/hm2_7i95.0:         alt_source = 0xFFFF3FF
hm2/hm2_7i95.0:         open_drain = 0x000000
hm2/hm2_7i95.0:         output_invert = 0x000000
hm2/hm2_7i95.0:     instance 1:
hm2/hm2_7i95.0:         data_read = 0x1FFFFFEF
hm2/hm2_7i95.0:         data_write = 0x000000
hm2/hm2_7i95.0:         ddr = 0x000000
hm2/hm2_7i95.0:         alt_source = 0x000000
hm2/hm2_7i95.0:         open_drain = 0x000000
hm2/hm2_7i95.0:         output_invert = 0x000000
hm2/hm2_7i95.0: Watchdog: 1
hm2/hm2_7i95.0:     clock_frequency: 100000000 Hz (100.000 MHz)
hm2/hm2_7i95.0:     version: 0
hm2/hm2_7i95.0:     timer_addr: 0x0C00
hm2/hm2_7i95.0:     status_addr: 0x0D00
hm2/hm2_7i95.0:     reset_addr: 0x0E00
hm2/hm2_7i95.0:     instance 0:
hm2/hm2_7i95.0:         param timeout_ns = 5000000
hm2/hm2_7i95.0:         pin has_bit = 0
hm2/hm2_7i95.0:         reg timer = 0x80000000
hm2/hm2_7i95.0: registered

I took a network capture of running the script and stopped it only once I had seen a position-fb peak in halscope. The file is attached. I also created a small python program to parse the capture file, and I have attached that as well. With the parse and capture file, I run the following commands:
$ ./lbp16.py capture.pcap > capture.txt
$
$ cat capture.txt | grep "ADDRESS 0x2000" | grep -v "DATA 0x0000000000000000000000000000000000000000"
$
$ cat capture.txt | grep "ADDRESS 0x2100" | grep -v "DATA 0x0000000000000000000000000000000000000000"
$

None of the commands generate any output. This means that step rate register 0x2000 is never written anything else than 0, and the accumulator registers 0x2100 never reads anything else than 0.

I'm not exactly sure what my next step is at the moment. But if you think mesa modbus is the prime suspect, I might start looking around at that code.
 

File Attachment:

File Name: capture.zip
File Size:381 KB

 

File Attachment:

File Name: lbp16.py
File Size:5 KB


edit: I added the the output from parsing the capture file by lbp16.py (plain text)
 

File Attachment:

File Name: capture-parsed.zip
File Size:1,083 KB

edit2: Editing messed up the code codes... hopefully fixed now
Attachments:
Last edit: 05 Nov 2024 14:29 by Finngineering. Reason: Added capture file parse by lbp16.py

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

More
05 Nov 2024 18:05 #313834 by Finngineering
For information, and in case it gives somebody any ideas. I started looking at the mesa_modbus.c.tmpl code, and modified it to output its internal state as a HAL pin. Attached a screenshot from halscope where the state is visible alongside the jump in position-fb.
 

The states are defined by:
enum {
    START,
    WAIT_FOR_SEND_BEGIN,
    WAIT_FOR_SEND_COMPLETE,
    WAIT_FOR_DATA_FRAME,
    WAIT_FOR_FRAME_SIZES,
    WAIT_FOR_DATA,
    FETCH_MORE_DATA,
    WAIT_A_BIT,
    WAIT_FOR_RX_CLEAR,
    RESET_WAIT,
};

So, we start in state WAIT_FOR_DATA_FRAME, then go to RESET_WAIT for a few cycles, and the in either state START or WAIT_FOR_SEND_BEGIN, the jump in position-fb occurs.
Attachments:

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

More
05 Nov 2024 18:24 - 05 Nov 2024 18:26 #313837 by Finngineering
Well, I found something already. There is a divide-by-zero on line 525 below (line numbers differ slightly from official code), because inst->hal->rate is not initialized in the code, and at least in my case it defaults to zero. Changing it to 1 from halshow causes the jumps in position-fb to stop. At least for now :)
 

I guess the divide by zero causes a fault/interrupt handler to be called and the execution state/context may be lost/upset? At least I'm imagining something like that. If somebody can produce a better or more accurate explanation, it would be interesting to hear.

This seems to me like a clear bug. Is somebody able to take this forward from here, or give me advice on how I can make a bug report?

edit: The hal pin related to inst->hal->rate is named update-hz. I though I'd point that out, as the connection is by no means apparent from the screenshot.
Attachments:
Last edit: 05 Nov 2024 18:26 by Finngineering. Reason: Clarification

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

More
05 Nov 2024 18:58 #313842 by PCW
Maybe related to the bug I mentioned with update rate:

   If you ever set the update rate to 0 (maximum), changing to a
    non-zero rate will not work (communication stops)

 

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

More
05 Nov 2024 20:45 #313851 by Finngineering
Yes, that may very well be the case. The following lines are from the code (but not directly following each other like shown):
static long timer = 0;
...
if (inst->hal->rate > 0 && (timer -= period) > 0) break;
...
timer = 1e9 / inst->hal->rate;
When update-hz is 0, then there is also a division by zero in the last line. Maybe what effects this have depends on the system. The result of the division may be +infinity (which is a valid float). When that is the casted to a 64 bit(?) long, that may give a very big number, which during the next iteration causes the if statement to take the "break" branch for practically all time in the future. There are lots of "ifs" here, and I think that at least some things are implementation dependent.

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

Moderators: PCWjmelson
Time to create page: 0.089 seconds
Powered by Kunena Forum