Remora - Rpi Software Stepping Using External Microcontroller via SPI

More
30 Aug 2025 23:04 #334159 by scotta

Hi again and thanks for all the help up until now!

I wan't to give more context and explain myself better, we have been using this cnc router since 2023, originally setup with a raspberry pi 3b and octopus pro combo, it has worked wonders and is amazing the only real issue is that the raspberry pi 3b was slow. Recently we made the change to a raspberry pi 5, we took the original .ini and .hal files which we then update to be compatible with the new remora version, we kept the same config.txt file. We installed the linuxcnc-raspberrypi5 image and installed the remora components as instructed in the documentation.

The issues we've seen: when we first loaded linuxcnc and ran the .ini file by double clicking on it and choosing linuxcnc as the app to run the ini file we then saw the raspberry pi 5 using rp1 driver alert, we initially thought this was error but figured this was just an alert and so continued. We then started testing leaving e stop we could but just for a moment, no more than 3s, we could even get to enable but non of the drivers actually enable. We then tested if this was the E-stop's fault but we assumed it wasn't since if we disconnected the estop we could exit estop at all, wehn it was properly setup we could but can't enable the steppers fisically. This isn't a stepper issue or driver issue since they get enabled with the raspberry pi 3.

Thanks in advance and thank you for all of the help until now! Oh and sorry for any grammar or spelling mistakes, english isn't our first tounge.

Ok, so I pulled out my octopus board and RPi5 to see what could be the issue. I found my working config and noted:

#SERVO_PERIOD = 1000000
SERVO_PERIOD = 5000000

Making this change to your config, I got it up and running. With the faster servo period the board was throwing so many communication errors.

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

More
30 Aug 2025 23:13 #334160 by scotta
Sorry, forgot to mention updated hal line as well to set the SPI speed to 2Mhz, the default 20Mhz is probably the issue.

loadrt remora-spi SPI_num=0 CS_num=0 SPI_freq=2000000

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

More
03 Sep 2025 03:10 #334309 by Gusgus
Hi Scotta! Thank you for all the help and being so patient with us.
We have wired all of the enabels to one single enable since that enables the whole machine for simplicity's sake.

We have tested what you suggested and we now get enable and move the axis, the issue now, is that we can't move them for long. Not even a second, in the best cases just a second. We attempted to decrease the accelerations even further and increase the f error to 2 and 5 which also didn't really help, we also tested decreasing the SPI frequency to 1MHz and changed the STEPGEN_MAXACCEL to 1000; whilst keeping the 25% acceleration buffer from the max acceleration to the stepgen.

remora-xyz.ini:
# Basic LinuxCNC config for testing of Remora firmware

[EMC]
MACHINE = Remora-XYZ
DEBUG = 0
VERSION = 1.1

[DISPLAY]
DISPLAY = axis
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 = 28.7
MIN_LINEAR_VELOCITY = 0
MAX_LINEAR_VELOCITY = 28.7
DEFAULT_ANGULAR_VELOCITY = 28.7
MIN_ANGULAR_VELOCITY = 0
MAX_ANGULAR_VELOCITY = 28.7
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 = 0
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 = 4.17
MAX_LINEAR_VELOCITY = 28.7
NO_FORCE_HOMING = 1 

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

#*** AXIS_X *******************************
[AXIS_X]
MAX_VELOCITY = 28.7
MAX_ACCELERATION = 287.0
MIN_LIMIT = -0.001
MAX_LIMIT = 1080.0

[JOINT_0]
TYPE = LINEAR
HOME = 0.0
MIN_LIMIT = -0.001
MAX_LIMIT = 1080.0
MAX_VELOCITY = 28.7
MAX_ACCELERATION = 287.0
STEPGEN_MAXACCEL = 1000.0
SCALE = 100.0
FERROR = 5.0
MIN_FERROR = 5.0
HOME_OFFSET = 0.000000
HOME_SEARCH_VEL = -45.000000
HOME_LATCH_VEL = -2.500000
HOME_SEQUENCE = 1
#******************************************


#*** AXIS_Y *******************************
[AXIS_Y]
MAX_VELOCITY = 28.7
MAX_ACCELERATION = 287.0
MIN_LIMIT = -0.001
MAX_LIMIT = 950.0

[JOINT_1]
TYPE = LINEAR
HOME = 0.0
MIN_LIMIT = -0.001
MAX_LIMIT = 950.0
MAX_VELOCITY = 28.7
MAX_ACCELERATION = 287.0
STEPGEN_MAXACCEL = 1000.0
SCALE = 100.0
FERROR = 5.0
MIN_FERROR = 5.0
HOME_OFFSET = 0.000000
HOME_SEARCH_VEL = -45.000000
HOME_LATCH_VEL = 2.500000
HOME_SEQUENCE = 2
#******************************************


#*** AXIS_Z *******************************
[AXIS_Z]
MAX_VELOCITY = 20.0
MAX_ACCELERATION = 150.0
MIN_LIMIT = -125.0
MAX_LIMIT = 0.001

[JOINT_2]
TYPE = LINEAR
HOME = 0.0
MIN_LIMIT = -125.0
MAX_LIMIT = 0.001
MAX_VELOCITY = 20
MAX_ACCELERATION = 150.0
STEPGEN_MAXACCEL = 187.5
SCALE = 800.0
FERROR = 5.0
MIN_FERROR = 5.0
HOME_OFFSET = 0.000000
HOME_SEARCH_VEL = 15.000000
HOME_LATCH_VEL = 0.625000
HOME_SEQUENCE = 0
#******************************************


remora-xyz.hal:
# 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]J$

        loadrt remora-spi SPI_clk_div=32 SPI_num=0 CS_num=0 SPI_freq=1000000
        #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

        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

        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

        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

# inputs
        #endstops
        net X-min remora.input.01 => joint.0.home-sw-in
        net Y-min remora.input.00 => joint.1.home-sw-in
        net Z-min remora.input.02 => joint.2.home-sw-in




This is our current setup

the config.txt remains unchanged

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

More
03 Sep 2025 20:38 #334371 by scotta
Great to hear you are making progress.

No need for the SPI_clk_div=32 in the loadrt command line, that is for the RPi4/3.

What fault / error is generated when the machine stops? I've still got the Octopus and RPi setup on the bench, will look to try your config again over the weekend.

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

More
03 Sep 2025 21:35 #334375 by Gusgus
Hi Scotta!

This is the error we get:

"command (EMC_JOG_CONT) cannot be executed until the machine is out of E-stop and turned on"

but when we disconnect the E-stop it recognizes that it is connected, we also sometimes get the Joint X following error.

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

More
04 Sep 2025 12:18 #334399 by amanker
I was using Octopus Pro Board for LinuxCNC. That one is giving some problems. So I bought new board BTT SKR3 so that I can use TMC5160. Can anyone help me setting up its config.txt and LinuxCNC configuration. And connection diagram. I have wired it as per SKR2 board. Pinouts of both boards seems similar. I cant get Machine out of estop. I think there is no communication between rpi and skr3.
Remora.ini
# Basic LinuxCNC config for testing of Remora firmware

[EMC]
MACHINE = Remora-XYZ
DEBUG = 0
VERSION = 1.1

[DISPLAY]
DISPLAY = axis
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 = 50.00
MIN_LINEAR_VELOCITY = 0
MAX_LINEAR_VELOCITY = 200.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 = 0
SERVO_PERIOD = 1000000

[HAL]
HALFILE = remora.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 = 500
MAX_ACCELERATION = 1000.0
MIN_LIMIT = -500
MAX_LIMIT = 500.0

[JOINT_0]
TYPE = LINEAR
HOME = 0.0
MIN_LIMIT = -500.0
MAX_LIMIT = 500.0
MAX_VELOCITY = 500.0
MAX_ACCELERATION = 1000.0
STEPGEN_MAXACCEL = 2000.0
SCALE = 200.0
FERROR = 2
MIN_FERROR = 2.0
HOME_OFFSET = 0.0
HOME_SEARCH_VEL = 0
HOME_LATCH_VEL = 0
HOME_SEQUENCE = 0

[AXIS_Y]
MAX_VELOCITY = 250.0
MAX_ACCELERATION = 750.0
MIN_LIMIT = -300.0
MAX_LIMIT = 300.0

[JOINT_1]
TYPE = LINEAR
HOME = 0.0
MIN_LIMIT = -300.0
MAX_LIMIT = 300.0
MAX_VELOCITY = 250.0
MAX_ACCELERATION = 750.0
STEPGEN_MAXACCEL = 2000.0
SCALE = 80.0
FERROR = 9.0
MIN_FERROR = 5.0
HOME_OFFSET = 0.0
HOME_SEARCH_VEL = 0
HOME_LATCH_VEL = 0
HOME_SEQUENCE = 0

[AXIS_Z]
OFFSET_AV_RATIO = 0.2
MAX_VELOCITY = 5.0
MAX_ACCELERATION = 200.0
MIN_LIMIT = -280
MAX_LIMIT = 280

[JOINT_2]
TYPE = LINEAR
HOME = 0.0
MIN_LIMIT = -280
MAX_LIMIT = 280
MAX_VELOCITY = 5.0
MAX_ACCELERATION = 200.0
STEPGEN_MAXACCEL = 3000.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

remora.hal
# 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
    #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

    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


# Joint 1 setup

    setp remora.joint.1.scale         [JOINT_1]SCALE
    setp remora.joint.1.maxaccel     [JOINT_1]STEPGEN_MAXACCEL

    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

    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


config.txt
{
    "Board": "BIGTREETECH SKR v3",
    "Modules":[
    {
    "Thread": "Servo",
    "Type": "Reset Pin",
        "Comment":            "Reset pin",
        "Pin":                "PC_4"
    },
    {
    "Thread": "On load",
    "Type": "Motor Power",
        "Comment": "Enable motor power SKR2",
        "Pin":                     "PC_13"
    },
    {
    "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

    }
    ]
}

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

More
04 Sep 2025 20:43 #334441 by scotta
Which firmware are you using? The SKR3 is only supported in the latest Remora-core development repo.

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

More
05 Sep 2025 04:25 #334466 by amanker
Yes. I have cloned latest remora-h7xx-pio repository from remora-cnc. And compiled that. And used config files attached in previous post.

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

More
05 Sep 2025 05:19 #334469 by scotta
Wiring is the same as the SKR2. RPi4 or 5?

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

More
05 Sep 2025 07:24 - 05 Sep 2025 10:00 #334476 by amanker
Using rpi5. I have included my config files also.

Update: This I compiled bootloader version and Installed that. And added Blink in config.txt to test if firmware is working. Yes firmware is working and led is blinking. But Still no connection to RPI5, machine can't come out of estop.
Last edit: 05 Sep 2025 10:00 by amanker.

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

Time to create page: 0.444 seconds
Powered by Kunena Forum