LinuxCNC-RIO - RealtimeIO for LinuxCNC based on FPGA (ICE40 / ECP5)

More
11 Aug 2026 09:48 #348643 by meister
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.
The following user(s) said Thank You: viewsat, jpn9900

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

More
12 Aug 2026 14:10 #348666 by meister
@viewsat

Wow, OK, I can picture it – that’s intense
Even at low speed – wtf

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

More
12 Aug 2026 14:38 #348667 by meister
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

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

More
12 Aug 2026 23:30 #348673 by viewsat
Is your DM542 input pin connected like this?
 
Attachments:

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

More
13 Aug 2026 00:21 - 13 Aug 2026 02:19 #348679 by viewsat
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.
 
Attachments:
Last edit: 13 Aug 2026 02:19 by viewsat.

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

More
13 Aug 2026 00:27 #348680 by viewsat
From what I see in your video, the connection is like this: PUL+ and DIR+ are not connected.
 
Attachments:

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

More
13 Aug 2026 01:02 - 13 Aug 2026 03:13 #348681 by viewsat
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.

 
Attachments:
Last edit: 13 Aug 2026 03:13 by viewsat.

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

More
13 Aug 2026 03:32 #348683 by tuxcnc

If I replace the DIR PC817 optocoupler with a high-speed 6N137, it can correctly return to the zero position. 

This is wrong way.
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 or Create an account to join the conversation.

More
13 Aug 2026 04:29 #348685 by meister
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.

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

More
13 Aug 2026 06:23 - 19 Aug 2026 07:45 #348686 by viewsat
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.
 
 
 
   
Attachments:
Last edit: 19 Aug 2026 07:45 by viewsat.

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

Time to create page: 1.471 seconds
Powered by Kunena Forum