Remora - Rpi Software Stepping Using External Microcontroller via SPI

More
9 months 3 weeks ago #341173 by amanker
I was using remora on BTT Octopus pro board. Few days back I had to remove the board for some reason. Now it's not working. Nothing has changed. I tried erasing and reflashing remora by stm32 programmer. Tried changing spi cable from board to rpi4. I can see remora firmware is working on board. I added blink module to verify remora, it's working. I can see via UART console that remora ha loaded correctly and comes to idle state.
But on LinuxCNC side machine don't comes out of estop. No configuration changed. Tried new trixie image but can't compile remora due to incomplete pointer error. Don't know what's going wrong? 

Please Log in to join the conversation.

More
9 months 3 weeks ago #341193 by 3404gerber

I was using remora on BTT Octopus pro board. Few days back I had to remove the board for some reason. Now it's not working. Nothing has changed. I tried erasing and reflashing remora by stm32 programmer. Tried changing spi cable from board to rpi4. I can see remora firmware is working on board. I added blink module to verify remora, it's working. I can see via UART console that remora ha loaded correctly and comes to idle state.
But on LinuxCNC side machine don't comes out of estop. No configuration changed. Tried new trixie image but can't compile remora due to incomplete pointer error. Don't know what's going wrong?  
 
Hi,

I'm not sure I can help for the estop state in lcnc. I would start by checking the payloads in both BTT firmware and hal component.

For the compilation error, I ran into the same error when I was trying to compile my TMC5160 component and solved the problem by changing the code a bit. As I'm not a coder, I have no big idea what I'm doing, but sounds like a casting problem to me. You can try following changes in the rp1lib.c of the linuxcnc component:

Replace the lines:

dws = &inst->spi[spi_num];
spi = &inst->spi_dev[spi_num];

with

dws = (struct dw_spi*)&inst->spi[spi_num];
spi = (struct spi_device*)&inst->spi_dev[spi_num];

and:

dws = &inst->spi[spi_num];
cfg = &inst->spi_cfg[spi_num];
dev = &inst->spi_dev[spi_num];

with:

dws = (struct dw_spi*)&inst->spi[spi_num];
cfg = (struct dw_spi_cfg*)&inst->spi_cfg[spi_num];
dev = (struct spi_device*)&inst->spi_dev[spi_num];

After those changes I was again able to compile my component and could use it. BUT I didn't try it on a RPi5 actually using the rp1 lib, just on a RPi4.
Hope it helps.

Please Log in to join the conversation.

More
9 months 3 weeks ago #341208 by amanker
Thanks for reply. That changes resolved the issue of not compiling on trixie, there was also some error on line 505 column 69 of remora-spi.c. I edited that, I don't if that's correct, but that line will only be used in case of using rpi5, don't bothered and compiled the remora component. But still same issue on trixie and bookworm.

Hope some will help.

Please Log in to join the conversation.

More
9 months 3 weeks ago #341218 by 3404gerber

Thanks for reply. That changes resolved the issue of not compiling on trixie, there was also some error on line 505 column 69 of remora-spi.c. I edited that, I don't if that's correct, but that line will only be used in case of using rpi5, don't bothered and compiled the remora component. But still same issue on trixie and bookworm.

Hope some will help.
 
Sorry if I ask obvious things that you already checked, but what message do you have if you start LinuxCNC from a terminal, and then try to get out of emergency stop state? I don't have an SPI version, but on the Ethernet version I get an error message like "Bad SPI payload = 0" if I don't have communication with my board.

Please Log in to join the conversation.

More
9 months 3 weeks ago #341228 by amanker
I didn't tested by launching from terminal. But I tried with skr3 board which was tested working and octopus pro with newer(tmc5160) and regular remora both have same problem.

Please Log in to join the conversation.

More
9 months 2 weeks ago #341233 by amanker
Code:
eating a std module Remora PRU - Programmable Realtime Unit   Mbed-OS6   Remora-spi Driver  ## Entering SETUP state 1. Reading json configuration file OK Opening "/fs/config.txt"... OK Json config file lenght = 3836 Closing "/fs/config.txt"...  2. Setting up DMA and threads Initialising SPI1 slave Initialising DMA for SPI 3. Parsing json configuration file Config deserialisation - Deserialization succeeded 4. Config threads Creating thread 40000 Creating thread 1000 Creating thread 57600 5. Loading modules Servo thread object Reset pin Make Reset Pin at pin PC_15 Creating a std module Creating Pin @   port = GPIOC   pin = 15 Base thread object X - Joint 0 step generator Creating a std module Creating Pin @   port = GPIOF   pin = 14 Creating Pin @   port = GPIOF  pin = 13 Creating Pin @   port = GPIOF   pin = 12 Base thread object Y - Joint 1 step generator Creating a std module Creating Pin @   port = GPIOF   pin = 15 Creating Pin @   port = GPIOG   pin = 0 Creating Pin @   port = GPIOG   pin = 1 Base thread object Z - Joint 2 step generator Creating a std module Creating Pin @   port = GPIOG   pin = 5 Creating Pin @   port = GPIOF   pin = 11 Creating Pin @   port = GPIOG   pin = 3 Base thread object E0 - Joint 3 step generator Creating a std module Creating Pin @   port = GPIOA   pin = 0 Creating Pin @   port = GPIOG   pin = 4 Creating Pin @   port = GPIOC   pin = 1 Base thread object E1 - Joint 4 step generator Creating a std module Creating Pin @   port = GPIOG   pin = 2 Creating Pin @   port = GPIOF   pin = 9 Creating Pin @   port = GPIOF   pin = 10 Servo thread object X min Make Digital Input at pin PG_6 Creating a std module   Setting pin as No Pull Creating Pin @   port = GPIOG   pin = 6 Servo thread object X max Make Digital Input at pin PG_9 Creating a std module   Setting pin as No Pull Creating Pin @   port = GPIOG   pin = 9 Servo thread object Y min Make Digital Input at pin PG_10 Creating a std module   Setting pin as No Pull Creating Pin @   port = GPIOG   pin = 10 Servo thread object Y max Make Digital Input at pin PG_11 Creating a std module   Setting pin as No Pull Creating Pin @   port = GPIOG   pin = 11 Servo thread object Z min Make Digital Input at pin PG_12 Creating a std module   Setting pin as No Pull Creating Pin @   port = GPIOG   pin = 12 Servo thread object Z max Make Digital Input at pin PG_13 Creating a std module   Setting pin as No Pull Creating Pin @   port = GPIOG   pin = 13 Servo thread object Probe Make Digital Input at pin PC_5 Creating a std module   Setting pin as No Pull Creating Pin @   port = GPIOC   pin = 5 Servo thread object Estop pin Make eStop at pin PE_11 Creating a std module Creating Pin @   port = GPIOE   pin = 11 Servo thread object Make Blink at pin PA_8 Creating a std module Creating Pin @   port = GPIOA   pin = 8 Servo thread object Spindle PWM 0 Make PWM at pin PB_0 Creating a std module Creating Hardware PWM at pin PB_0 Creating Pin @   port = GPIOB   pin = 0 ## Entering START state Starting the BASE thread Registering interrupt for interrupt number = 24     power on Timer 9 Starting the SERVO thread Registering interrupt for interrupt number = 25     power on Timer 10 ## Entering IDLE state Here is output on UART from remora firmware Edit: Launched linuxcnc on terminal, getting "bad spi payload" (Bad SPI payload = 32393a38)

Please Log in to join the conversation.

More
9 months 2 weeks ago #341260 by 3404gerber

Code:
... Edit: Launched linuxcnc on terminal, getting "bad spi payload" (Bad SPI payload = 32393a38)

The value of the payload is strange; it's almost half value of what you are suppose to get:

#define PRU_DATA            0x64617461     // "data" SPI payload
#define PRU_READ              0x72656164  // "read" SPI payload
#define PRU_WRITE             0x77726974  // "writ" SPI payload
#define PRU_ESTOP           0x65737470  // "estp" SPI payload

I'd try with a lower SPI frequency.

Please Log in to join the conversation.

More
9 months 2 weeks ago #341275 by amanker
I tried cutting the spi cable short. Now it's just 7cm or smaller. Tried to lower spi frequency to 50000. But nothing helped.

Please Log in to join the conversation.

More
9 months 2 weeks ago #341287 by 3404gerber
7cm should be ok. I started to have issue with TMC driver @4MHz after more or less 50cm.

Can you confirm that you always get the same SPI payload? (say, press the reset button 10 times and compare the results)

Could you share you hal file and the link to the firmware/lcnc component you use?

Please Log in to join the conversation.

More
9 months 2 weeks ago #341291 by amanker
I am using this branch

github.com/scottalford75/Remora/tree/main
This is repository I am using since last 2 years. Used on stm32f429 and stm32f446 both version of octopus pro boards

And also tested this one.
github.com/ben-jacobson/Remora-STM32F4xx-PIO
On octopus pro stm32f446 board

Also tested this repo
github.com/scottalford75/Remora-STM32H7xx-PIO
On BTT skr3 board

All were working. But now every repo gives same problem

Yes payload remains same.
"Bad SPI payload = 32393a38"
Occasionally it's 32393a30

Please Log in to join the conversation.

Time to create page: 0.222 seconds
Powered by Kunena Forum