Data transfer LinuxCNC to / from custom board - Solved

More
07 Jul 2024 23:47 #304613 by cornholio
Just one thing to consider a USB connected device is not “realtime” and is at the mercy of all the delays, latency and disconnection and reconnection that comes with it.
Where as the 7i73 is realtime, rock solid and I’ve never seen it lose a connection.
Another great thing is due to the use of Cat5 cable for connection it can be mounted anywhere.
Unless you design your device to use native USB, which I can only recall one project that did ie: it enumerates as a HID device, you’ll basically be operating at serial port speeds rather than 2.5M bits a second. This may not be an issue depending on packet size.

Basically what it boils down to a 7i73 pendant is going to be more responsive than a USB based one.

Now there is always the possibility of implementing the smart serial protocol into your device.
The following user(s) said Thank You: slowpoke

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

More
08 Jul 2024 07:26 - 08 Jul 2024 14:19 #304638 by slowpoke
Good points. I did a reality check on responsiveness by setting jog increment to 0.001" and then banged in 10 moves as fast as I could and it caught all 10, so faster than me.

I'm not ruling out the 7i73, one option would be to buy one and then remove the chip and solder it to my board I don't need the other stuff on the board, or perhaps Mesa will sell me just the chip? This approach still looks a little messy because the data from the touchscreen also needs to make its way to the 7i73.

Earlier (IIRC) (EDIT you  actually it was spumco) provided a link to an ArduinoConnect project. This is another possible solution I watched the video and thought hmmm this might just work? So pulled a little Nano out of the smorgasbord of wires etc on my bench and perhaps 20 minutes later it was hooked up to my Linux machine and visible in HAL configuration however when I manipulated the one input and output it did not work. I will try and find some time today to see if I can get it working. From my really quick perusal of the code other than the 5 s heartbeat it's static unless something changes so hopefully low burden and hopefully responsive enough.

I made a quick list of things I want to get from Linux back to my board and it's really not much (from memory)
Mode: jog, MDI, gcode running = 2 bits
Status: Estop, machine power, spindle on = 3 bits
Limit switches: = 6 bits or 3 if I code them
Rates: jog, feed = 8 bits each.

I don't have a sense of how much Linux time will be required for the .py code used for the HAL interface to deal with a small amount of data like this? I will need to learn about Linux tools for evaluating timing and burden. Bored in retirement ya.... sure;-)
Last edit: 08 Jul 2024 14:19 by slowpoke.

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

More
08 Jul 2024 07:59 #304642 by cornholio
This might be interesting, no src code but hex files to program 32 bit MicroChip MCU.

github.com/talla83/tshw

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

More
08 Jul 2024 14:16 #304669 by slowpoke
Well thanks to spumco for providing this link...
spumco post=294853 userid=28776

github.com/AlexmagToast/LinuxCNC_ArduinoConnector

I now have a little nano board communicating with HAL both inputs and outputs. So I just need to port the communication code from the nano test board into my ARM project and rejig the messages a bit and with a touch of luck I should have bidirectional data flow from HAL to my board. Hopefully the .py script is easy on the Linux overhead.

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

More
08 Jul 2024 20:13 #304693 by andypugh

Andy,
1) I guess that you connect the 7i73 RS-422 interface to a serial port of the Linux PC,


No, it plugs into the smart-serial expansion port on the 7i95 that you mentioned.

and then enable some sort of 7i73 driver in LinuxCNC that magically establishes the communication link between the two?


"SmartSerial" is pretty smart. If you plug boards in, then they communicate their capabilities and pin names to the main Mesa card and it all just works automatically to create HAL pins that you can then use in your config.
The following user(s) said Thank You: tommylight

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

More
21 Jul 2024 10:35 #305769 by andypugh
I knew there was another HAL component that might be relevant, I don't know how I missed it:

linuxcnc.org/docs/stable/html/man/man1/sendkeys.1.html
The following user(s) said Thank You: slowpoke

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

More
24 Jul 2024 01:50 #305938 by blazini36

Well thanks to spumco for providing this link...
spumco post=294853 userid=28776

github.com/AlexmagToast/LinuxCNC_ArduinoConnector

I now have a little nano board communicating with HAL both inputs and outputs. So I just need to port the communication code from the nano test board into my ARM project and rejig the messages a bit and with a touch of luck I should have bidirectional data flow from HAL to my board. Hopefully the .py script is easy on the Linux overhead.
 

ArduinoConnector has major issues that the author does not seem to want to fix as they've been working on a V2 branch. The last commit was my friend fixing a bug I found before I dropped it. I wasted alot of time with ArduinoConnector, I made 2 custom PCBs around it just to realize it had so much lag it was unuseable (see my git issue).

Maybe version 2 will be better, but the main branch can't handle an MPG. You will wait literally 10 seconds for it to count the pulses and relay them back to LinuxCNC. All the lag comes from the Python side, the MCU side is fine. It's a great idea, with some great features. Unfortunately it's currently unusable unless you just want to push a couple of buttons.
The following user(s) said Thank You: slowpoke

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

More
01 Aug 2024 17:59 - 01 Aug 2024 18:18 #306646 by slowpoke

I knew there was another HAL component that might be relevant, I don't know how I missed it:

linuxcnc.org/docs/stable/html/man/man1/sendkeys.1.html
 

 

Andy,

I need some clarity on a few points for sendkeys.

At this point I have an Arduino board that can trigger events in halshow, So when I activate an Arduino connected push button, the jog-x-pos and the halui.axis.x.plus changes from yellow to red. I expect the actual X-axis to jog when I press that button, however other than the yellow to red indication nothing happens. (the system is NOT in Estop, and the machine is enabled on the manual control tab. If I mouse click on the "+" button, the x axis does jog.

Do I need to enable/invoke SENDKEYS, to actually get the yellow to red indication of jog-x-pos to do something?

Assuming that I do need to enable SENDKEYS, I need a little help with a few points in the SENDKEYS documentation.
 Instructions say "Create a new entry in .B/etc/udev/rules.d/99-input.rules"

I'm not sure where ".B" is?

I did find       /etc/udev/rules.d/70-persistent-cd.rules
So neglecting the missing ".B"  I assumed this is the file I'm supposed to update?
However when I add "sudo echo KERNEL=="uinput", GROUP="uinput", MODE:="0660" | sudo tee /etc/udev/rules.d/70-persistent-cd.rules" to that file I get the attached error message. So lots of possible mistakes here: wrong location, wrong file, adding the uinput group did not work even though it seemed to (see last attachment) the discrepancy between 99-input.rules ,77-persistant-cd.rules , 88-input.rules?

Please advise.
 

 
 
Attachments:
Last edit: 01 Aug 2024 18:18 by slowpoke.

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

More
01 Aug 2024 18:55 #306653 by Aciera
Note that 'halui.axis.jog-speed' needs to be set for plus minus jogging:
 
Attachments:

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

More
01 Aug 2024 22:18 #306679 by slowpoke

Note that 'halui.axis.jog-speed' needs to be set for plus minus jogging:  linuxcnc.org/docs/html/man/man1/halui.1.html

Thanks for that, however setting halui.axis.x.plus did not help.
When I press the Arduino button, the jog-x-pos and the halui.axis.x.plus indicators both change from yellow to red. For some reason they don't trigger an actual jog.
 
Attachments:

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

Time to create page: 0.192 seconds
Powered by Kunena Forum