- Posts: 959
- Thank you received: 0
Remora - Rpi Software Stepping Using External Microcontroller via SPI
1 year 1 month ago #334792
by scotta
Replied by scotta on topic Remora - Rpi Software Stepping Using External Microcontroller via SPI
Why have you hacked the motor feedback and enable?
net xpos-cmd <= joint.0.motor-pos-cmd => remora.SP.0 joint.0.motor-pos-fb
# net j0pos-fb <= remora.joint.0.pos-fb => joint.0.motor-pos-fb
# net j0enable <= joint.0.amp-enable-out => remora.joint.0.enable
Your hal file has no endstops configured...?
net xpos-cmd <= joint.0.motor-pos-cmd => remora.SP.0 joint.0.motor-pos-fb
# net j0pos-fb <= remora.joint.0.pos-fb => joint.0.motor-pos-fb
# net j0enable <= joint.0.amp-enable-out => remora.joint.0.enable
Your hal file has no endstops configured...?
Please Log in to join the conversation.
1 year 1 month ago #334811
by amanker
Replied by amanker on topic Remora - Rpi Software Stepping Using External Microcontroller via SPI
I am extreamly sorry for confusion. I wrongly uploaded files.
config.txt
hal file.
ini file
config.txt
Code:
{
"Board": "BIGTREETECH SKR v3",
"Modules":[
{
"Thread": "Servo",
"Type": "Reset Pin",
"Comment": "Reset pin",
"Pin": "PC_4"
},
{
"Thread": "Servo",
"Type": "Blink",
"Pin": "PA_13",
"Frequency": 2
},
{
"Thread": "Base",
"Type": "Stepgen",
"Comment": "X - Joint 0 step generator",
"Joint Number": 0,
"Step Pin": "PD_4",
"Direction Pin": "PD_3",
"Enable Pin": "PD_6"
},
{
"Thread": "Base",
"Type": "Stepgen",
"Comment": "Y - Joint 1 step generator",
"Joint Number": 1,
"Step Pin": "PA_15",
"Direction Pin": "PA_8",
"Enable Pin": "PD_1"
},
{
"Thread": "Base",
"Type": "Stepgen",
"Comment": "Z - Joint 2 step generator",
"Joint Number": 2,
"Step Pin": "PE_2",
"Direction Pin": "PE_3",
"Enable Pin": "PE_0"
},
{
"Thread": "Servo",
"Type": "Digital Pin",
"Comment": "X min",
"Pin": "PC_1",
"Mode": "Input",
"Data Bit": 0
},
{
"Thread": "Servo",
"Type": "Digital Pin",
"Comment": "X max",
"Pin": "PC_2",
"Mode": "Input",
"Data Bit": 1
},
{
"Thread": "Servo",
"Type": "Digital Pin",
"Comment": "Y min",
"Pin": "PC_3",
"Mode": "Input",
"Data Bit": 2
},
{
"Thread": "Servo",
"Type": "Digital Pin",
"Comment": "Y max",
"Pin": "PA_0",
"Mode": "Input",
"Data Bit": 3
},
{
"Thread": "Servo",
"Type": "Digital Pin",
"Comment": "Z min",
"Pin": "PC_0",
"Mode": "Input",
"Data Bit": 4
},
{
"Thread": "Servo",
"Type": "Digital Pin",
"Comment": "Z max",
"Pin": "PC_15",
"Mode": "Input",
"Data Bit": 5
}
]
}
hal file.
Code:
# load the realtime components
loadrt [KINS]KINEMATICS
loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS
loadrt remora-spi SPI_num=0 CS_num=0 SPI_freq=2000000
#loadrt remora_lpc chip_type=LPC SPI_clk_div=64
# estop loopback, SPI comms enable and feedback
net user-enable-out <= iocontrol.0.user-enable-out => remora.SPI-enable
net user-request-enable <= iocontrol.0.user-request-enable => remora.SPI-reset
net remora-status <= remora.SPI-status => iocontrol.0.emc-enable-in
# add the remora and motion functions to threads
addf remora.read servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
addf remora.update-freq servo-thread
addf remora.write servo-thread
# Joint 0 setup
setp remora.joint.0.scale [JOINT_0]SCALE
setp remora.joint.0.maxaccel [JOINT_0]STEPGEN_MAXACCEL
setp remora.joint.0.pgain [JOINT_0]P_GAIN
setp remora.joint.0.ff1gain [JOINT_0]FF1_GAIN
setp remora.joint.0.deadband [JOINT_0]DEADBAND
net xpos-cmd <= joint.0.motor-pos-cmd => remora.joint.0.pos-cmd
net j0pos-fb <= remora.joint.0.pos-fb => joint.0.motor-pos-fb
net j0enable <= joint.0.amp-enable-out => remora.joint.0.enable
# Joint 1 setup
setp remora.joint.1.scale [JOINT_1]SCALE
setp remora.joint.1.maxaccel [JOINT_1]STEPGEN_MAXACCEL
setp remora.joint.1.pgain [JOINT_1]P_GAIN
setp remora.joint.1.ff1gain [JOINT_1]FF1_GAIN
setp remora.joint.1.deadband [JOINT_1]DEADBAND
net j1pos-cmd <= joint.1.motor-pos-cmd => remora.joint.1.pos-cmd
net j1pos-fb <= remora.joint.1.pos-fb => joint.1.motor-pos-fb
net j1enable <= joint.1.amp-enable-out => remora.joint.1.enable
# Joint 2 setup
setp remora.joint.2.scale [JOINT_2]SCALE
setp remora.joint.2.maxaccel [JOINT_2]STEPGEN_MAXACCEL
setp remora.joint.2.pgain [JOINT_2]P_GAIN
setp remora.joint.2.ff1gain [JOINT_2]FF1_GAIN
setp remora.joint.2.deadband [JOINT_2]DEADBAND
net j2pos-cmd <= joint.2.motor-pos-cmd => remora.joint.2.pos-cmd
net j2pos-fb <= remora.joint.2.pos-fb => joint.2.motor-pos-fb
net j2enable <= joint.2.amp-enable-out => remora.joint.2.enable
# end-stops
net X-home remora.input.00 => joint.0.home-sw-in
net Y-home remora.input.01 => joint.1.home-sw-in
ini file
Code:
# Basic LinuxCNC config for testing of Remora firmware
[EMC]
MACHINE = Remora-XY
DEBUG = 5
VERSION = 1.1
[DISPLAY]
DISPLAY = axis
USER_COMMAND_FILE = usercommand_regularmac_800.py
EDITOR = gedit
POSITION_OFFSET = RELATIVE
POSITION_FEEDBACK = ACTUAL
ARCDIVISION = 64
GRIDS = 10mm 20mm 50mm 100mm
MAX_FEED_OVERRIDE = 1.2
#MIN_SPINDLE_OVERRIDE = 0.5
#MAX_SPINDLE_OVERRIDE = 1.2
DEFAULT_LINEAR_VELOCITY = 5.00
MIN_LINEAR_VELOCITY = 0
MAX_LINEAR_VELOCITY = 10.00
DEFAULT_ANGULAR_VELOCITY = 36.00
MIN_ANGULAR_VELOCITY = 0
MAX_ANGULAR_VELOCITY = 45.00
INTRO_GRAPHIC = linuxcnc.gif
INTRO_TIME = 5
PROGRAM_PREFIX = ~/linuxcnc/nc_files
INCREMENTS = 50mm 10mm 5mm 1mm .5mm .1mm .05mm .01mm
[KINS]
JOINTS = 3
#KINEMATICS =trivkins coordinates=XYZ kinstype=BOTH
KINEMATICS =trivkins coordinates=XYZ
[FILTER]
PROGRAM_EXTENSION = .py Python Script
py = python
[TASK]
TASK = milltask
CYCLE_TIME = 0.010
[RS274NGC]
PARAMETER_FILE = linuxcnc.var
[EMCMOT]
EMCMOT = motmod
COMM_TIMEOUT = 1.0
COMM_WAIT = 0.010
BASE_PERIOD = 1000000
SERVO_PERIOD = 5000000
[HAL]
HALFILE = remora-xyz.hal
POSTGUI_HALFILE = postgui_call_list.hal
[TRAJ]
COORDINATES = X Y Z
LINEAR_UNITS = mm
ANGULAR_UNITS = degree
CYCLE_TIME = 0.010
DEFAULT_LINEAR_VELOCITY = 50.00
MAX_LINEAR_VELOCITY = 200.00
NO_FORCE_HOMING = 1
[EMCIO]
EMCIO = io
CYCLE_TIME = 0.100
TOOL_TABLE = tool.tbl
[AXIS_X]
MAX_VELOCITY = 150
MAX_ACCELERATION = 750
MIN_LIMIT = 0.0
MAX_LIMIT = 25.0
[JOINT_0]
TYPE = LINEAR
HOME = 27.5
MIN_LIMIT = 0.0
MAX_LIMIT = 28.0
MAX_VELOCITY = 250.0
MAX_ACCELERATION = 20.0
STEPGEN_MAXACCEL = 2000.0
SCALE = 800
FERROR = 2
MIN_FERROR = 2.0
HOME_OFFSET = 27.5
HOME_SEARCH_VEL = 2.0
HOME_LATCH_VEL = 2.0
HOME_SEQUENCE = 0
P_GAIN= 300
FF1_GAIN= 0.1
DEADBAND= 0.001
[AXIS_Y]
MAX_VELOCITY = 150
MAX_ACCELERATION = 750
MIN_LIMIT = 0.0
MAX_LIMIT = 26.0
[JOINT_1]
TYPE = LINEAR
HOME = 25.5
MIN_LIMIT = 0.0
MAX_LIMIT = 26.0
MAX_VELOCITY = 250.0
MAX_ACCELERATION = 20.0
STEPGEN_MAXACCEL = 2000.0
SCALE = 800.0
FERROR = 9.0
MIN_FERROR = 5.0
HOME_OFFSET = 25.5
HOME_SEARCH_VEL = 2.0
HOME_LATCH_VEL = 2.0
HOME_SEQUENCE = 1
P_GAIN= 300
FF1_GAIN= 0.1
DEADBAND= 0.001
[AXIS_Z]
OFFSET_AV_RATIO = 0.2
MAX_VELOCITY = 5.0
MAX_ACCELERATION = 20.0
MIN_LIMIT = 0
MAX_LIMIT = 28
[JOINT_2]
TYPE = LINEAR
HOME = 0.0
MIN_LIMIT = 0
MAX_LIMIT = 28
MAX_VELOCITY = 5.0
MAX_ACCELERATION = 20.0
STEPGEN_MAXACCEL = 300.0
SCALE = 400.0
FERROR = 5
MIN_FERROR = 1.0
HOME_OFFSET = 0.0
HOME_SEARCH_VEL = 0
HOME_LATCH_VEL = 0
HOME_SEQUENCE = 0
P_GAIN= 300
FF1_GAIN= 0.1
DEADBAND= 0.001
Please Log in to join the conversation.
1 year 1 month ago #334826
by amanker
Replied by amanker on topic Remora - Rpi Software Stepping Using External Microcontroller via SPI
Update: limit switch working. As pointed out by scotta, it was defined as home switch not limit switch.
But still no sign of energy in steppers. Always joint following error.
Serial terminal don't show anything
But still no sign of energy in steppers. Always joint following error.
Serial terminal don't show anything
Please Log in to join the conversation.
1 year 1 month ago #334844
by scotta
Replied by scotta on topic Remora - Rpi Software Stepping Using External Microcontroller via SPI
Is that the config file you have loaded? There are no TMC5160 driver configuration in your config. For each stepper you need to load a stepgen, as you have done, as well as configure the TMC driver. I'll share a config over the weekend.
Please Log in to join the conversation.
1 year 1 month ago #334845
by Gusgus
Replied by Gusgus on topic Remora - Rpi Software Stepping Using External Microcontroller via SPI
Hi!
So the cnc is now moving and it was the SPI cable shielding!!! Thank you Scotta and tommylight!!!
But now we have another, issue, we are using 2 stepper motors for the Y-axis each of the stepper motors is connected to one stepper driver and we have the config setup in a way so that joint 1 pulses both, but that doesn't seem to be happening, only on Y motor moves, and the x axis moves as well, the z axis actually just doesn't move at all.
So the cnc is now moving and it was the SPI cable shielding!!! Thank you Scotta and tommylight!!!
But now we have another, issue, we are using 2 stepper motors for the Y-axis each of the stepper motors is connected to one stepper driver and we have the config setup in a way so that joint 1 pulses both, but that doesn't seem to be happening, only on Y motor moves, and the x axis moves as well, the z axis actually just doesn't move at all.
Please Log in to join the conversation.
1 year 1 month ago #334857
by scotta
Replied by scotta on topic Remora - Rpi Software Stepping Using External Microcontroller via SPI
Hi, LinuxCNC is very capable of handling this configuration with 4 joints and a X Y Y Z configuration. Check out the config below for my 3D printer that has dual Z axes.
github.com/scottalford75/Remora/tree/mai...figSamples/hypercube
The two joints won't jog together until they have been homed. I've found that out the hard way...
github.com/scottalford75/Remora/tree/mai...figSamples/hypercube
The two joints won't jog together until they have been homed. I've found that out the hard way...
Please Log in to join the conversation.
1 year 1 month ago #334859
by amanker
Replied by amanker on topic Remora - Rpi Software Stepping Using External Microcontroller via SPI
As I mentioned. First I am trying to test it with a4988/drv8825 drivers. That's why I didn't loaded tmc5160 modules. Testing it in step/dir mode only
Please Log in to join the conversation.
1 year 1 month ago #334898
by scotta
Replied by scotta on topic Remora - Rpi Software Stepping Using External Microcontroller via SPI
I've tried to run your config. Firstly corrected
BASE_PERIOD = 1000000
SERVO_PERIOD = 5000000
to
BASE_PERIOD = 0
SERVO_PERIOD = 1000000
You config also seems to be setup for imperial yet using mm?
I can jog with that above correction without following errors.
For your DRV8825 have you added the micro stepping jumpers? The DRV8825 wont enable without this, which I tried on my SKR3EZ. I unfortunately killed my normal SKR3 so cannot test with that board.
BASE_PERIOD = 1000000
SERVO_PERIOD = 5000000
to
BASE_PERIOD = 0
SERVO_PERIOD = 1000000
You config also seems to be setup for imperial yet using mm?
I can jog with that above correction without following errors.
For your DRV8825 have you added the micro stepping jumpers? The DRV8825 wont enable without this, which I tried on my SKR3EZ. I unfortunately killed my normal SKR3 so cannot test with that board.
Please Log in to join the conversation.
1 year 1 month ago #334916
by amanker
Replied by amanker on topic Remora - Rpi Software Stepping Using External Microcontroller via SPI
I changed according to your suggestion. But same issue "joint follwing error"
I am not seeing any mismatch of imperial vs metric units. I think I have defined only mm.
Yes I have set jumpers correctly. I tried flashing grblhal.. everything was working. So its not related to hardware or jumpers
I am not seeing any mismatch of imperial vs metric units. I think I have defined only mm.
Yes I have set jumpers correctly. I tried flashing grblhal.. everything was working. So its not related to hardware or jumpers
Please Log in to join the conversation.
Time to create page: 0.289 seconds
