LitexCNC: firmware and driver for 5A-75B and 5A-75E

More
2 years 8 months ago #292881 by TOLP2
Could you also try with two less PWMs to see whether this resolves the issue with the stepgen:
Code:
{     "board_name": "5A-75B:V8.0",     "board_type": "5A-75B v8.0",     "clock_frequency": 40000000,     "connection": {         "connection_type": "etherbone",         "tx_delay": 0,         "ip_address": "10.0.0.10",         "mac_address": "0x10e2d5000000"     },     "watchdog": {         "pin":"j1:8"     },     "modules": [         {             "module_type": "gpio",             "instances": [                 {"direction": "out", "pin":"j1:9",  "name":"j1:10"},                 {"direction": "out", "pin":"j1:10", "name":"j1:11"},                 {"direction": "out", "pin":"j1:11", "name":"j1:12"},                 {"direction": "out", "pin":"j1:12", "name":"j1:13"},                 {"direction": "out", "pin":"j1:13", "name":"j1:14"},                 {"direction": "out", "pin":"j1:14", "name":"j1:15"},                 {"direction": "in",  "pin":"j1:0",  "name":"j1:1" },                 {"direction": "in",  "pin":"j1:1",  "name":"j1:2" },                 {"direction": "in",  "pin":"j1:2",  "name":"j1:3" },                 {"direction": "in",  "pin":"j1:4",  "name":"j1:5" },                 {"direction": "in",  "pin":"j1:5",  "name":"j1:6" },                 {"direction": "in",  "pin":"j1:6",  "name":"j1:7" },                 {"direction": "in",  "pin":"j2:0",  "name":"j2:1" },                 {"direction": "in",  "pin":"j2:1",  "name":"j2:2" },                 {"direction": "in",  "pin":"j2:2",  "name":"j2:3" },                 {"direction": "in",  "pin":"j2:4",  "name":"j2:5" },                 {"direction": "in",  "pin":"j2:5",  "name":"j2:6" },                 {"direction": "in",  "pin":"j2:6",  "name":"j2:7" },                 {"direction": "out", "pin":"j5:0",  "name":"j5:1" },                 {"direction": "out", "pin":"j5:1",  "name":"j5:2" },                 {"direction": "out", "pin":"j5:2",  "name":"j5:3" },                 {"direction": "out", "pin":"j5:4",  "name":"j5:5" },                 {"direction": "out", "pin":"j5:5",  "name":"j5:6" },                 {"direction": "out", "pin":"j5:6",  "name":"j5:7" }             ]         }, {             "module_type": "pwm",             "instances": [                 {"pin":"j6:0", "name":"j6:1"},                 {"pin":"j6:1", "name":"j6:2"},                 {"pin":"j6:2", "name":"j6:3"},                 {"pin":"j6:4", "name":"j6:5"}             ]         }, {             "module_type": "encoder",             "instances": [                 {"pin_A":"j3:0", "pin_B":"j3:1"},                 {"pin_A":"j3:2", "pin_B":"j3:4"},                 {"pin_A":"j3:5", "pin_B":"j3:6"},                 {"pin_A":"j4:0", "pin_B":"j4:1"},                 {"pin_A":"j4:2", "pin_B":"j4:4"},                 {"pin_A":"j4:5", "pin_B":"j4:6"}             ]         }, {             "module_type": "stepgen",             "instances": [                 {                     "pins" : {                         "stepgen_type": "step_dir",                         "step_pin": "j7:0",                         "dir_pin": "j7:1"                     },                     "soft_stop": true                 },                 {                     "pins" : {                         "stepgen_type": "step_dir",                         "step_pin": "j7:2",                         "dir_pin": "j7:4"                     },                     "soft_stop": true                 },                 {                     "pins" : {                         "stepgen_type": "step_dir",                         "step_pin": "j7:5",                         "dir_pin": "j7:6"                     },                     "soft_stop": true                 },                 {                     "pins" : {                         "stepgen_type": "step_dir",                         "step_pin": "j8:0",                         "dir_pin": "j8:1"                     },                     "soft_stop": true                 },                 {                     "pins" : {                         "stepgen_type": "step_dir",                         "step_pin": "j8:2",                         "dir_pin": "j8:4"                     },                     "soft_stop": true                 },                 {                     "pins" : {                         "stepgen_type": "step_dir",                         "step_pin": "j8:5",                         "dir_pin": "j8:6"                     },                     "soft_stop": true                 }             ]         }     ] }

Still have to find out why 120 bytes gives a n error on FPGA. The buffer depth is 255 bytes (including 16 bytes header), so it should have some leeway there...

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

More
2 years 8 months ago #292885 by uba100
Unfortunately, this attempt was unsuccessful. I even removed 4 PWM generators, but the error is unchanged.
Here is the current issue of Linuxcnc:

cnc@raspberrypi:~$ linuxcnc
LINUXCNC - 2.9.2
Machine configuration directory is '/home/cnc/linuxcnc/configs/test1'
Machine configuration file is 'test1.ini'
Starting LinuxCNC...
linuxcnc TPMOD=tpmod HOMEMOD=homemod EMCMOT=motmod
Note: Using POSIX realtime
Found file(REL): ./test1.hal

identityKinematicsSetup: coordinates:XYYZA
Joint 0 ==> Axis X
Joint 1 ==> Axis Y
Joint 2 ==> Axis Y
Joint 3 ==> Axis Z
Joint 4 ==> Axis A

litexcnc: Loading Litex CNC driver version 1.1.0
litexcnc: Loading and registering default modules:
litexcnc: Registered module gpio
litexcnc: Registered module pwm
litexcnc: Registered module encoder
litexcnc: Registered module step
litexcnc: Setting up board drivers:
litexcnc: Registered driver eth
LitexCNC-eth: connected to board on '10.0.0.10:1234'
litexcnc: Setting up modules...
litexcnc: Reading 36 bytes
litexcnc: - Watchdog
litexcnc: - Wallclock
litexcnc: - gpio ... done!
litexcnc: - pwm ... done!
litexcnc: - encoder ... done!
litexcnc: - step ... done!
litexcnc: Creating read and write buffers...
litexcnc: Base addresses: init: 00000000, reset: 00000044, config: 00000048, write: 0000004C, read: 000000A8
litexcnc: - Write buffer: 92 bytes
litexcnc: - Read buffer: 96 bytes
litexcnc: Exporting functions...
Found file(REL): ./custom.hal
litexcnc/5A-75B:V8.0: Watchdog timeout (3000000 ns) is dangerously short compared to litexcnc_write() period (2400000 ns)

Warning: Missing required specifier (has angular joint or axis):
[DISPLAY]MAX_ANGULAR_VELOCITY
or [TRAJ]MAX_ANGULAR_VELOCITY
See the 'INI Configuration' documents

note: MAXV max: 25.000 units/sec 1500.000 units/min
note: LJOG max: 25.000 units/sec 1500.000 units/min
note: LJOG default: 2.500 units/sec 150.000 units/min
note: AJOG max: 1.000 units/sec 60.000 units/min
note: AJOG default: 1.000 units/sec 60.000 units/min
Warning: Forward kinematics must handle duplicate coordinate letters:yy
note: jog_order='XYZA'
note: jog_invert=set()
task: main loop took 0.144871 seconds
joint 4 following error
emc/task/taskintf.cc 976: Error on joint 4, command number 137
joint 4 following error
emc/task/taskintf.cc 976: Error on joint 4, command number 179
task: main loop took 0.191013 seconds
task: main loop took 0.165731 seconds
The following user(s) said Thank You: TOLP2

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

More
2 years 8 months ago #292893 by tommylight

Warning: Missing required specifier (has angular joint or axis):
[DISPLAY]MAX_ANGULAR_VELOCITY
or [TRAJ]MAX_ANGULAR_VELOCITY
See the 'INI Configuration' documents

Warning: Forward kinematics must handle duplicate coordinate letters:yy
note: jog_order='XYZA'

joint 4 following error
emc/task/taskintf.cc 976: Error on joint 4, command number 137
This points to errors in configuration files, it seems there are entries for setting double Y joints, but also stuff for an angular A axis.
If this is a tandem Y machine, the kinematics and axis should be set as "XYYZ" and "XYZ" respectively, not as XYZA.
The following user(s) said Thank You: TOLP2

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

More
2 years 8 months ago #292913 by uba100
I am still not sure why I am getting this error message. I have entered XYYZA for both [KINS] and [TRAJ].


[EMC]
MACHINE = test1
DEBUG = 0
VERSION = 1.1

[DISPLAY]
DISPLAY = axis
EDITOR = geany
POSITION_OFFSET = RELATIVE
POSITION_FEEDBACK = ACTUAL
ARCDIVISION = 64
GRIDS = 10mm 20mm 50mm 100mm 1in 2in 5in 10in
MAX_FEED_OVERRIDE = 1.2
MIN_SPINDLE_OVERRIDE = 0.5
MAX_SPINDLE_OVERRIDE = 3.2
DEFAULT_LINEAR_VELOCITY = 2.50
MIN_LINEAR_VELOCITY = 0
MAX_LINEAR_VELOCITY = 25.00
CYCLE_TIME = 0.100
INTRO_GRAPHIC = linuxcnc.gif
INTRO_TIME = 5
PROGRAM_PREFIX = /home/cnc/linuxcnc/nc_files
INCREMENTS = 5mm 1mm .5mm .1mm .05mm .01mm .005mm
PYVCP = custompanel.xml

[KINS]
JOINTS = 5
KINEMATICS = trivkins coordinates=XYYZA kinstype=BOTH


[FILTER]
PROGRAM_EXTENSION = .png,.gif,.jpg Greyscale Depth Image
PROGRAM_EXTENSION = .py Python Script
PROGRAM_EXTENSION = .nc,.tap G-Code File
png = image-to-gcode
gif = image-to-gcode
jpg = image-to-gcode
py = python

[TASK]
TASK = milltask
CYCLE_TIME = 0.010

[RS274NGC]
PARAMETER_FILE = linuxcnc.var

[EMCMOT]
EMCMOT = motmod
COMM_TIMEOUT = 1.0
BASE_PERIOD = 800000
SERVO_PERIOD = 2000000

[HAL]
HALFILE = test1.hal
HALFILE = custom.hal
POSTGUI_HALFILE = postgui_call_list.hal

[TRAJ]
COORDINATES = XYYZA
LINEAR_UNITS = mm
ANGULAR_UNITS = degree
DEFAULT_LINEAR_VELOCITY = 2.50
MAX_LINEAR_VELOCITY = 25.00
MAX_ANGULAR_VELOCITY = 25

[EMCIO]
EMCIO = io
CYCLE_TIME = 0.100
TOOL_TABLE = tool.tbl





[AXIS_X]
MAX_VELOCITY = 20.0
MAX_ACCELERATION = 750.0
MIN_LIMIT = -483
MAX_LIMIT = 1

[JOINT_0]
TYPE = LINEAR
HOME = 0.0
MAX_VELOCITY = 20.0
MAX_ACCELERATION = 200.0
STEPGEN_MAXACCEL = 250.0
SCALE = 200.005
FERROR = 1
MIN_FERROR = .25
MIN_LIMIT = -483.0
MAX_LIMIT = 1.0
HOME_OFFSET = 0.0
HOME_SEARCH_VEL =30
HOME_LATCH_VEL = -5
HOME_FINAL_VEL = 20
HOME_SEQUENCE = 1



[AXIS_Y]
MAX_VELOCITY = 25.0
MAX_ACCELERATION = 750.0
MIN_LIMIT = -700
MAX_LIMIT = 2

[JOINT_1]
TYPE = LINEAR
HOME = 0.0
MIN_LIMIT = -700
MAX_LIMIT = 2
MAX_VELOCITY = 25.0
MAX_ACCELERATION = 750.0
STEPGEN_MAXACCEL = 937.5
SCALE = 80.0
FERROR = 1
MIN_FERROR = .25
HOME_OFFSET = 0.0
HOME_SEARCH_VEL = 30
HOME_LATCH_VEL = -5
HOME_FINAL_VEL = 20
HOME_SEQUENCE = 0

[JOINT_2]
TYPE = LINEAR
HOME = 0.0
MIN_LIMIT = -700
MAX_LIMIT = 2
MAX_VELOCITY = 25.0
MAX_ACCELERATION = 750.0
STEPGEN_MAXACCEL = 937.5
SCALE = 80.0
FERROR = 1
MIN_FERROR = .25
HOME_OFFSET = 0.0
HOME_SEARCH_VEL =30
HOME_LATCH_VEL = -5
HOME_FINAL_VEL = 20
HOME_SEQUENCE = 0



[AXIS_Z]
MAX_VELOCITY = 25.0
MAX_ACCELERATION = 750.0
MIN_LIMIT = -290.0
MAX_LIMIT = 1.0

[JOINT_3]
TYPE = LINEAR
HOME = 0.0
MIN_LIMIT = -290.0
MAX_LIMIT = 1.0
MAX_VELOCITY = 25.0
MAX_ACCELERATION = 750.0
STEPGEN_MAXACCEL = 937.5
SCALE = 80.0
FERROR = 1
MIN_FERROR = 0.25
HOME_OFFSET = 0.0
HOME_SEARCH_VEL =30
HOME_LATCH_VEL = -5
HOME_FINAL_VEL = 20
HOME_SEQUENCE = 2
#******************************************

[AXIS_A]
MAX_VELOCITY = 25.0
MAX_ACCELERATION = 750.0
MIN_LIMIT = -400
MAX_LIMIT = 400

[JOINT_4]
TYPE = ANGULAR
UNITS = ANGULAR_UNITS
HOME = 0.0
MIN_LIMIT = -400
MAX_LIMIT = 400
MAX_VELOCITY = 25.0
MAX_ACCELERATION = 750.0
STEPGEN_MAXACCEL = 937.5
SCALE = 80.0
FERROR = 1
MIN_FERROR = 0.25
HOME_OFFSET = 0.0
HOME_SEARCH_VEL =-30
HOME_LATCH_VEL = 30
HOME_FINAL_VEL = -20
HOME_SEQUENCE = 3
The following user(s) said Thank You: TOLP2

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

More
2 years 8 months ago #292914 by uba100
My current hal:


#loadrt trivkins
loadrt [KINS]KINEMATICS
loadrt litexcnc connections="eth:10.0.0.10"
loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS


loadrt estop_latch
loadrt stepgen step_type=0,0,0,0,0
loadrt pwmgen output_type=1

addf estop-latch.0 servo-thread

addf 5A-75B:V8.0.read servo-thread


# Funktionen für Schrittmotoren
addf motion-command-handler servo-thread
addf motion-controller servo-thread

addf 5A-75B:V8.0.write servo-thread

# Spindel
########################################################
# Verbinden der Spindel mit dem PWM-Generator
net spindle-speed-cmd spindle.0.speed-out => 5A-75B:V8.0.pwm.00.value
# net spindle-on spindle.0.on => 5A-75B:V8.0.pwm.00.enable
setp 5A-75B:V8.0.pwm.00.enable 1

# Frequenz von 50Hz einstellen f. Servosignal Regler (1ms bis 2ms)
setp 5A-75B:V8.0.pwm.00.pwm_freq 50
setp 5A-75B:V8.0.pwm.00.min_dc 0.05
setp 5A-75B:V8.0.pwm.00.max_dc 0.1
setp 5A-75B:V8.0.pwm.00.offset 0.05

# maximale Drehzahl
setp 5A-75B:V8.0.pwm.00.scale 140000

# Drehrichtungspins
net spindle-fwd spindle.0.forward => 5A-75B:V8.0.gpio.22.out
net spindle-rev spindle.0.reverse => 5A-75B:V8.0.gpio.23.out


# Eingänge
##############################################################
net home_schalter_all 5A-75B:V8.0.gpio.06.in => joint.0.home-sw-in joint.1.home-sw-in joint.2.home-sw-in joint.3.home-sw-in joint.4.home-sw-in
#net home_schalter_y1 5A-75B:V8.0.gpio.06.in => joint.1.home-sw-in
#net home_schalter_y2 5A-75B:V8.0.gpio.06.in => joint.2.home-sw-in
#net home_schalter_z 5A-75B:V8.0.gpio.06.in => joint.3.home-sw-in

# STEPGEN - X-AXIS
##############################################################
setp 5A-75B:V8.0.stepgen.00.position-scale [JOINT_0]SCALE
setp 5A-75B:V8.0.stepgen.00.steplen 5000
setp 5A-75B:V8.0.stepgen.00.stepspace 5000
setp 5A-75B:V8.0.stepgen.00.dir-hold-time 10000
setp 5A-75B:V8.0.stepgen.00.dir-setup-time 10000
setp 5A-75B:V8.0.stepgen.00.max-velocity [JOINT_0]MAX_VELOCITY
setp 5A-75B:V8.0.stepgen.00.max-acceleration [JOINT_0]STEPGEN_MAXACCEL
# setp 5A-75B:V8.0.stepgen.00.debug true
# - Connect velocity command
net xpos_cmd joint.0.motor-pos-cmd => 5A-75B:V8.0.stepgen.00.position-cmd
net xpos_fb joint.0.motor-pos-fb <= 5A-75B:V8.0.stepgen.00.position-feedback
# - enable the drive
net xenable joint.0.amp-enable-out => 5A-75B:V8.0.stepgen.00.enable


# STEPGEN - Y1-AXIS
##############################################################
setp 5A-75B:V8.0.stepgen.01.position-scale [JOINT_1]SCALE
setp 5A-75B:V8.0.stepgen.01.steplen 5000
setp 5A-75B:V8.0.stepgen.01.stepspace 5000
setp 5A-75B:V8.0.stepgen.01.dir-hold-time 10000
setp 5A-75B:V8.0.stepgen.01.dir-setup-time 10000
setp 5A-75B:V8.0.stepgen.01.max-velocity [JOINT_1]MAX_VELOCITY
setp 5A-75B:V8.0.stepgen.01.max-acceleration [JOINT_1]STEPGEN_MAXACCEL
# setp 5A-75B:V8.0.stepgen.01.debug true
# - Connect velocity command
net y1pos_cmd joint.1.motor-pos-cmd => 5A-75B:V8.0.stepgen.01.position-cmd
net y1pos_fb joint.1.motor-pos-fb <= 5A-75B:V8.0.stepgen.01.position-feedback
# - enable the drive
net y1enable joint.1.amp-enable-out => 5A-75B:V8.0.stepgen.01.enable

# STEPGEN - Y2-AXIS
##############################################################
setp 5A-75B:V8.0.stepgen.02.position-scale [JOINT_2]SCALE
setp 5A-75B:V8.0.stepgen.02.steplen 5000
setp 5A-75B:V8.0.stepgen.02.stepspace 5000
setp 5A-75B:V8.0.stepgen.02.dir-hold-time 10000
setp 5A-75B:V8.0.stepgen.02.dir-setup-time 10000
setp 5A-75B:V8.0.stepgen.02.max-velocity [JOINT_2]MAX_VELOCITY
setp 5A-75B:V8.0.stepgen.02.max-acceleration [JOINT_2]STEPGEN_MAXACCEL
# setp 5A-75B:V8.0.stepgen.02.debug true
# - Connect velocity command
net y2pos_cmd joint.2.motor-pos-cmd => 5A-75B:V8.0.stepgen.02.position-cmd
net y2pos_fb joint.2.motor-pos-fb <= 5A-75B:V8.0.stepgen.02.position-feedback
# - enable the drive
net y2enable joint.2.amp-enable-out => 5A-75B:V8.0.stepgen.02.enable



# STEPGEN - Z-AXIS
##############################################################
setp 5A-75B:V8.0.stepgen.03.position-scale [JOINT_3]SCALE
setp 5A-75B:V8.0.stepgen.03.steplen 5000
setp 5A-75B:V8.0.stepgen.03.stepspace 5000
setp 5A-75B:V8.0.stepgen.03.dir-hold-time 10000
setp 5A-75B:V8.0.stepgen.03.dir-setup-time 10000
setp 5A-75B:V8.0.stepgen.03.max-velocity [JOINT_3]MAX_VELOCITY
setp 5A-75B:V8.0.stepgen.03.max-acceleration [JOINT_3]STEPGEN_MAXACCEL
# setp 5A-75B:V8.0.stepgen.03.debug true
# - Connect velocity command
net zpos_cmd joint.3.motor-pos-cmd => 5A-75B:V8.0.stepgen.03.position-cmd
net zpos_fb joint.3.motor-pos-fb <= 5A-75B:V8.0.stepgen.03.position-feedback
# - enable the drive
net zenable joint.3.amp-enable-out => 5A-75B:V8.0.stepgen.03.enable


# STEPGEN - A-AXIS
##############################################################
setp 5A-75B:V8.0.stepgen.04.position-scale [JOINT_4]SCALE
setp 5A-75B:V8.0.stepgen.04.steplen 5000
setp 5A-75B:V8.0.stepgen.04.stepspace 5000
setp 5A-75B:V8.0.stepgen.04.dir-hold-time 10000
setp 5A-75B:V8.0.stepgen.04.dir-setup-time 10000
setp 5A-75B:V8.0.stepgen.04.max-velocity [JOINT_4]MAX_VELOCITY
setp 5A-75B:V8.0.stepgen.04.max-acceleration [JOINT_4]STEPGEN_MAXACCEL
# setp 5A-75B:V8.0.stepgen.04.debug true
# - Connect velocity command
net cpos_cmd joint.4.motor-pos-cmd => 5A-75B:V8.0.stepgen.04.position-cmd
net cpos_fb joint.4.motor-pos-fb <= 5A-75B:V8.0.stepgen.04.position-feedback
# - enable the drive
net cenable joint.4.amp-enable-out => 5A-75B:V8.0.stepgen.04.enable



loadusr -W hal_manualtoolchange
net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change
net tool-changed iocontrol.0.tool-changed <= hal_manualtoolchange.changed
net tool-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number
net tool-prepare-loopback iocontrol.0.tool-prepare => iocontrol.0.tool-prepared


# Watchdog-Einstellungen
setp 5A-75B:V8.0.watchdog.timeout_ns 3000000

net estop-loopout iocontrol.0.emc-enable-in <= estop-latch.0.ok-out
net estop-loopin iocontrol.0.user-enable-out => estop-latch.0.ok-in
net estop-reset iocontrol.0.user-request-enable => estop-latch.0.reset
net remote-estop estop-latch.0.fault-in <= 5A-75B:V8.0.watchdog.has_bitten
The following user(s) said Thank You: TOLP2

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

More
2 years 8 months ago #292918 by TOLP2
I've isolated the error. In essence, the write buffer is not large enough for the data which is being send. The buffer is 2 words (8 bytes) off.

There is currently a branch under development where PWM has changed, which alters the communication flow. It seems like the driver you have is an old version, and the firmware is a new version. Therefore it does not help to remove a few PWM. The only resolution is for your setup is to remove the complete PWM module.

How this could happen is a big question. The new image should not have been pushed to the documentation, as these are only updated on a release of the main branch. Also, the problem should not persist when the example is build locally, as you did, because then the driver should be in sync with the system.

A few more questions:
  • which version of LitexCNC are you running. Did you install it using pip install or did you pull the repo.
  • did you reinstall the driver with litexcnc install_driver if you have recently updated LitexCNC?

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

Moderators: PCW, jmelson
Time to create page: 0.277 seconds
Powered by Kunena Forum