- Posts: 803
- Thank you received: 0
LinuxCNC-RIO - RealtimeIO for LinuxCNC based on FPGA (ICE40 / ECP5)
2 months 2 weeks ago #348643
by meister
Replied by meister on topic LinuxCNC-RIO - RealtimeIO for LinuxCNC based on FPGA (ICE40 / ECP5)
new driver plugin: TMC5160 via SPI:
www.youtube.com/shorts/DlIHY1Iy-ZQ
I don’t really like AI, but I do give it a go every now and then.
But this time I have to admit that gpt-5.6-sol-xhigh
did a pretty good job of it; it understood how a Rio plugin is structured and also generated the Verilog code quite neatly.
So this is the first plugin I’ve created with the help of AI.
I’d had the drivers for a while, but I was always too lazy
The tricky bit here was realising that, although the drivers use SPI (for configuration), they can’t be controlled via SPI.
To do that, you have to re-solder a tiny resistor on the back – not much fun.
So if you’re going to do this, get a board with the right jumpers for SD mode and SPI mode.
www.youtube.com/shorts/DlIHY1Iy-ZQ
I don’t really like AI, but I do give it a go every now and then.
But this time I have to admit that gpt-5.6-sol-xhigh
did a pretty good job of it; it understood how a Rio plugin is structured and also generated the Verilog code quite neatly.
So this is the first plugin I’ve created with the help of AI.
I’d had the drivers for a while, but I was always too lazy
The tricky bit here was realising that, although the drivers use SPI (for configuration), they can’t be controlled via SPI.
To do that, you have to re-solder a tiny resistor on the back – not much fun.
So if you’re going to do this, get a board with the right jumpers for SD mode and SPI mode.
Please Log in to join the conversation.
2 months 2 weeks ago #348666
by meister
Replied by meister on topic LinuxCNC-RIO - RealtimeIO for LinuxCNC based on FPGA (ICE40 / ECP5)
@viewsat
Wow, OK, I can picture it – that’s intense
Even at low speed – wtf
Wow, OK, I can picture it – that’s intense
Even at low speed – wtf
Please Log in to join the conversation.
2 months 2 weeks ago #348667
by meister
Replied by meister on topic LinuxCNC-RIO - RealtimeIO for LinuxCNC based on FPGA (ICE40 / ECP5)
Sometimes it can be an advantage to be a bit lazy 
Otherwise, I wouldn’t have been able to reproduce it.
At first, I had the driver connected directly to the TangNano9k (3.3V),
then I had a quick Google to see if anyone else was having problems with the DM542. Yes, they were, because of the 3.3V. Now I’ve connected it to the Tangoboard with 5V signals and everything’s working perfectly, with the default settings
www.youtube.com/shorts/3IeqAu58WdI
Otherwise, I wouldn’t have been able to reproduce it.
At first, I had the driver connected directly to the TangNano9k (3.3V),
then I had a quick Google to see if anyone else was having problems with the DM542. Yes, they were, because of the 3.3V. Now I’ve connected it to the Tangoboard with 5V signals and everything’s working perfectly, with the default settings
www.youtube.com/shorts/3IeqAu58WdI
Please Log in to join the conversation.
2 months 2 weeks ago #348673
by viewsat
Replied by viewsat on topic LinuxCNC-RIO - RealtimeIO for LinuxCNC based on FPGA (ICE40 / ECP5)
Is your DM542 input pin connected like this?
Attachment not found
Please Log in to join the conversation.
2 months 2 weeks ago #348679
by viewsat
Replied by viewsat on topic LinuxCNC-RIO - RealtimeIO for LinuxCNC based on FPGA (ICE40 / ECP5)
My DM542 input pins are connected like this. I've used this DM542 driver on approximately 1000 units. I've used it on Linuxcnc LPT, Mesa 7i92, and Grbl 1.1 controllers without encountering any positioning error issues.
Attachment not found
Please Log in to join the conversation.
2 months 2 weeks ago #348680
by viewsat
Replied by viewsat on topic LinuxCNC-RIO - RealtimeIO for LinuxCNC based on FPGA (ICE40 / ECP5)
From what I see in your video, the connection is like this: PUL+ and DIR+ are not connected.
Attachment not found
Please Log in to join the conversation.
2 months 2 weeks ago #348681
by viewsat
Replied by viewsat on topic LinuxCNC-RIO - RealtimeIO for LinuxCNC based on FPGA (ICE40 / ECP5)
If I replace the DIR PC817 optocoupler with a high-speed 6N137, it can correctly return to the zero position.
However, using grbl and mesa 7i92 does not require modifying the DIR pc817.
I may need to use a logic analyzer to observe the timing diagrams of the Tang Nano 9k output pulses and DIR
I'm from Taipei, Taiwan, and my English isn't very good.
However, using grbl and mesa 7i92 does not require modifying the DIR pc817.
I may need to use a logic analyzer to observe the timing diagrams of the Tang Nano 9k output pulses and DIR
I'm from Taipei, Taiwan, and my English isn't very good.
Attachment not found
Please Log in to join the conversation.
2 months 2 weeks ago #348683
by tuxcnc
By modifying the driver, you risk damaging it and reducing its reliability.
Although the PC817 has a very low bandwidth, the correct solution is to increase the dirhold.
Replied by tuxcnc on topic LinuxCNC-RIO - RealtimeIO for LinuxCNC based on FPGA (ICE40 / ECP5)
This is wrong way.If I replace the DIR PC817 optocoupler with a high-speed 6N137, it can correctly return to the zero position.
By modifying the driver, you risk damaging it and reducing its reliability.
Although the PC817 has a very low bandwidth, the correct solution is to increase the dirhold.
Please Log in to join the conversation.
2 months 2 weeks ago #348685
by meister
Replied by meister on topic LinuxCNC-RIO - RealtimeIO for LinuxCNC based on FPGA (ICE40 / ECP5)
All my positive terminals are connected to the purple cable via a thin wire.
Dirhold isn’t the problem; it really is the voltage that’s coming through – there was a clear difference between 3.3V and 5V.
My connections are like in your image, but with EN connected.
You could use a multimeter to check what voltage is coming through your DIR pin.
Dirhold isn’t the problem; it really is the voltage that’s coming through – there was a clear difference between 3.3V and 5V.
My connections are like in your image, but with EN connected.
You could use a multimeter to check what voltage is coming through your DIR pin.
Please Log in to join the conversation.
2 months 2 weeks ago #348686
by viewsat
Replied by viewsat on topic LinuxCNC-RIO - RealtimeIO for LinuxCNC based on FPGA (ICE40 / ECP5)
DIR/PULSE issue resolved, thank you!! (2026-08-19)
Hi tuxcnc
I tried increasing the dirhold (PULSE=10, DIR=25) but it still didn't return to the origin correctly. When using a stepper motor, I pay attention to the Sequence Chart of Control Signals. If I use a Leadshine DM542 uses HCPL-063L/15MB high-speed optocouplers for both the DIR and Pulse inputs, so there are no problems using it.
Because increasing the dirHOLD time should have solved the problem, but it didn't. If Riocore hadn't fixed the DIR issue with the cheap DM542 driver mentioned earlier, I could only replace the pc817 with a 6N137. However, I still really hope that Meister will pay attention to this problem.
Hi tuxcnc
I tried increasing the dirhold (PULSE=10, DIR=25) but it still didn't return to the origin correctly. When using a stepper motor, I pay attention to the Sequence Chart of Control Signals. If I use a Leadshine DM542 uses HCPL-063L/15MB high-speed optocouplers for both the DIR and Pulse inputs, so there are no problems using it.
Because increasing the dirHOLD time should have solved the problem, but it didn't. If Riocore hadn't fixed the DIR issue with the cheap DM542 driver mentioned earlier, I could only replace the pc817 with a 6N137. However, I still really hope that Meister will pay attention to this problem.
Attachment not found
Attachment not found
Attachment not found
Attachment not found
Please Log in to join the conversation.
Time to create page: 0.339 seconds
