Data transfer LinuxCNC to / from custom board - Solved
Thanks to a lot of help from members here I now have my knee mill fully operational. Next task is to make some sort of mostly push-button user interface that I will mount to the belt cover. I prefer pushing buttons than mouse clicking for repetitive tasks. Conceptual sketch is below.
I will use an ARM uC that has a USB support and I could configure it as a HMI device (basically emulate keyboard presses), for example pressing the Green Power button will send a "F2" to LinuxCNC via a USB port. I think there are keystrokes for most if not all of the buttons shown below?
The display is also a touchscreen and I'm hoping to leverage that to emulate additional buttons/keystrokes based on how the machine is being used for example having buttons for common commands like G0, G1 etc.
It would also be good if I could display things like alarms on this display for example if a limit switch gets activated it could pop up an error on this display. I imagine there is likely more than one way to accomplish that. What would be the best way to get say a limit switch error message from LinuxCNC back to this board?
BTW I'm using the axis interface and a MESA 7i95t if that matters.
Thanks in advance
Edit, added a couple more images.
Attachments:
Please Log in or Create an account to join the conversation.
Can I suggest that you consider a Mesa 7i73 ? That can interface the control panel directly into the realtime layer of LinuxCNC.
store.mesanet.com/index.php?route=produc...oduct&product_id=116
It's probably not as much fun as your custom board, but it will work out of the box.
There is a strange HAL component that I wrote that might help if you choose to go your own way. It's strange because it does two completely different things in one component.
linuxcnc.org/docs/stable/html/man/man9/matrix_kb.9.html
The side that might help you is converting scancodes into HAL pins.
Please Log in or Create an account to join the conversation.
Thanks for the input, I have a few questions. Keep in mind I'm not a software guy, I can write embedded C type stuff but have no clue about the Linux kernel or anything related to that. I did with some help interface a few pins to the 7i95t by tweaking a HAL file.
I hope you don't mind but I will ask specific questions so I can fill in the knowledge blanks I have at the moment, here goes:
Regarding the 7i73:
1) I guess that you connect the 7i73 RS-422 interface to a serial port of the Linux PC, and then enable some sort of 7i73 driver in LinuxCNC that magically establishes the communication link between the two?
2) With the link established data transfer then happens quickly and automatically, if for example a pin changes status on the 7i73 a register in the kernel is updated?
3) How does one map the various 7i73 inputs to the desired action in the kernel?
4) I guess the values in the kernel registers can also be mapped to drive the outputs of the 7i73?
5) I'm guessing the mapping (3-4) is done in a HAL file?
Regarding the matrix_kb9 approach:
6) If I don't use a 7i93, it's not obvious how I would get the integers into the kernel hardware wise?
Thanks,
Jeff
Please Log in or Create an account to join the conversation.
I see in your first post you mention 7i95T
Having a read of the 7i73 Mesa manual will help in understanding how it all goes together.
hm2_7i92.0.7i73.1.3.input-10-not
Input number 3 not (input 3 inverted)
connected to the 3rd channel on sserial port 1 (each port can have up to 8 channels)
connected via a 7i92 card
The 7i73 will have a bunch of other inputs, outputs, encoder pins exported, plus a few others depending on how you config the board on startup.
Data transfers happen in the hm2 read & write functions of your card in the servo thread, which is setup in your hal file.
The docs give a better explanation.
linuxcnc.org/docs/2.9/html/man/man9/sserial.9.html#7I73
This is what I think wold need doing.
To connect directly to a serial port of your computer it would have to be hardware port (not USB), you would be limited to 115200 baud unless you have an exotic hi speed card (smart serial operates at 2.5M), someone would have to write a realtime driver for the port that handles the comms to the 7i73, not the easiest of jobs, would require reading and understanding the protocol used and implementing it as well.
Please Log in or Create an account to join the conversation.
3rd channel should read “channel number 3”
It’s actually “input number 10” not 3.
Sorry it’s late Down Under.
Please Log in or Create an account to join the conversation.
We're off to a good start.
One other thing I realize everyone uses their machine in a slightly different way so what's important to one might not be to another that being said if you think " he's obviously missing the ??? Button everyone needs that" let me know I'm at the blue sky phase so welcome to change.
Thanks again.
Please Log in or Create an account to join the conversation.
- tommylight
- Away
- Moderator
- Posts: 19196
- Thank you received: 6434
Mesa 7i73, RS422 use differential signaling, pretty sure there is no serial that can do that, but still could be done using some line drivers, that implies using intermediary boards, lots of wiring mess, ...
Normal serial ports do 115K as Cornholio mentined, ESP32 can do much more through USB to serial using it's built in whatever it uses.
Did anyone check if Mesa 7i73 can be made to communicate at lower speeds?
Aaaand arduino jumps in...
Do you have a 7i93 mentioned above?
Forgot what 7i93 does, so i'll go hide under a rock.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
No, the 7I73 connects to one of the 7I95s two RS-422 interfaces.1) I guess that you connect the 7i73 RS-422 interface to a serial port of the Linux PC, and then enable some sort of 7i73 driver in LinuxCNC that magically establishes the communication link between the two?
Please Log in or Create an account to join the conversation.
Andy,Keystrokes are a pretty bad way to interface to LinuxCNC.
Can I suggest that you consider a Mesa 7i73 ? That can interface the control panel directly into the realtime layer of LinuxCNC.
store.mesanet.com/index.php?route=produc...oduct&product_id=116
It's probably not as much fun as your custom board, but it will work out of the box.
There is a strange HAL component that I wrote that might help if you choose to go your own way. It's strange because it does two completely different things in one component.
linuxcnc.org/docs/stable/html/man/man9/matrix_kb.9.html
The side that might help you is converting scancodes into HAL pins.
I'm exploring the various ways to get data to and from Linux to my board. I already have hard wires connections for EStop, and machine power.
Focusing for the moment on data from my board to Linux I made a table of the 50 or so button presses that I would need to send, and from playing with a Axis and a regular keyboard using showkey it seems there is a hot key or key sequence that covers all 50 buttons that I anticipate using. There are a few anomalies that requires sending two key strokes or in the case of the jog increment keeping track of how many I's or shift- I's were sent so that has the potential to get out of sync, but other than that it seems really straightforward to just have my little on board uC scan my buttons and send the key or key sequences based on the keycode in the table below.
I found the table "most Common Keyboard Shortcuts" in the Axis documentation.
Do you know if there are additional commands documented elsewhere?
When you say it's a pretty bad idea to do this perhaps there is something I have overlooked?.
The Mesa 7i73 is interesting, but probably not a good fit for this project for a couple of reasons:
1) Physically if mounted as a daughter board would make the overall board depth thicker than I want.
2) I want to use the little touchscreen as I have used it before and it allows easy GUI enhancement in the future for things I can't anticipate now.
Assuming this will work for data to Linux, I now need to put my thinking cap on to figure out how to best get the Linux status data I would like to use back to my board so I can optimize the GUI. Jog Increment value would be a good start, I need to make a list.
Attachments:
Please Log in or Create an account to join the conversation.