Advanced Search

Search Results (Searched for: )

  • blazini36
  • blazini36
26 Sep 2025 03:18

LinuxCNC RT blindspots (I2C and UART/Serial)

Category: Driver Boards

There's been a couple of things I was thinking about for a while and the more I dig in the more I wonder about why they haven't become a thing with LinuxCNC. When I have other uses for something I tend to think "will this work with LinuxCNC too?" I suppose everyone gets used to doing things a certain way and only pick up new things if they are the hot new thing (like EtherCAT). There are probably a couple of interfaces that are "just there" that should technically be fully realtime capable. I think alot of it also stems from the fact that when people were using parallel ports on desktop motherboards, Mesa popped up with PCI and Ethernet cards and that's just the way it went. Nowadays I like to use mini-PCs like Odroid H3/H4, I still use some H2's as well. These have UART and I2C ports right on the "GPIO" header, interestingly the GPIO header doesn't actually have GPIO. I use these because they're cheap, small and have 2 ethernet ports. I would still use a Mesa Ethernet card for most bigger things but I run into alot of cases where they don't have anything convenient to use in the place I want to use it. The reason (besides being readily available) that I would think about UART and I2C is that they are simple and easier to deal with for something custom.

Unless I'm missing something, both UART and I2C should be fully realtime capable. Niether is the fastest interface out there but I don't think they really have to be. The appeal for I2C is there are already a bunch of kernel drivers for specific ICs, IO expanders like MCP23017. Currently these are only used in userspace components etc., but if the interrupt output is used I think it can meet RT expectations, especially if you can run the bus at 1Mhz+. I've gotten these IO expanders to work with the kernel driver on the H-series as I needed something to register as a gpiochip for use with other kernel drivers. The LinuxCNC RT bits just don't exist yet. The thing about it is there are clockgens, ADCs, etc,  that all have kernel drivers. There obviously needs to be a hal compenent for this stuff, I'm going to play with it soon but what it seems to me is that if the HAL environment existed, you could literally breadboard a controller based on just I2C chips that have suitable kernel drivers. There's a limit of chips that can be strung in there before transaction queues start to build up but besides that, I think this could be a thing. SPI could be used in much the same vein as many I2C chips have SPI variants and generally have an associated kernel driver.

UART/Serial is also probably realtime capable as a host interface (NOT USB serial). Again Ethernet is better but AFAIK I think Intel UARTs can be run at over 3 Mbaud, that's pretty quick but I'll have to test that as I've never actually seen or heard of it being done. I wouldn't expect this to be super popular since again there are better ways to do this but the main reason I'd want to use UART is for a control panel host. Right now I'm using Arduino Connector to a custom board running a Teensy 4.1. It works, it's fine but Arduino Connector is userspace/Python. Typical use is with the USB serial port, should be usable with a UART instead but probably not gaining anything being userspace. I'd like to replace Arduino Connector with a realtime UART setup to the Teensy board. At this point I'll probably just switch to an ESP32 S3 for other reasons but I don't want to deal with anything like Ethernet. This is something else that needs HAL implimentation but I will start with some simple tests just to see what I can do with it.

I'm curious if I'm missing anything from a bus/hardware perspective. I'm not concerned with why these aren't already popular choices, I think I've already mentioned that. More concerned with what I might be missing as far as implimenting them goes. I can't find a great reason why either of these wouldn't be perfectly fine to use as RT interfaces, albeit with some limitations.

 
  • thanks for the help
  • thanks for the help
26 Sep 2025 02:29
Replied by thanks for the help on topic Tool height setter M6 subroutine question

Tool height setter M6 subroutine question

Category: General LinuxCNC Questions

Thank you for the response, Based on your idea of the #5400 I tried this code, but no luck: here is the current status of my toolchange.ngc
O<toolchange> SUB

(MSG, Toolchange subroutine called)
(MSG, Tool number param #1 = #1)
#2 = #5400
#<tool_num> = #2
;#<setter_z> = -3.0
#<safe_z> = -.5 ; safe Z height above tool setter
#<probe_z> = -4.0 ; how far down to probe
#<setter_z> = -3.0 ; Z height of the setter in machine coords

G49 ; cancel length offset
G53 G90 G01 X1.0 Y0 F50. Z[#<safe_z>] ; move above setter

; Begin probing
G38.2 Z[#<probe_z>] F1.0
(If probe failed, LinuxCNC will stop here)

#<measured_z> = #5063 ; captured machine Z from probe

(MSG, 5063)

; Compute tool length

(MSG, Compute tool length)

#<tool_length> = [#<measured_z> - #<setter_z>]

; Store to tool table
(--- Optional: print value to operator ---)
(MSG, Tool length = #<tool_length>)

G10 L1 P#<tool_num> Z#<tool_length>

G43 H#<tool_num>

; Done
O<toolchange> ENDSUB
M2

I feel my problem lies in the fact that my tool number is not getting passed to the tool.tbl When I enter (debug #5400) in MDI get 0.0000 after entering in a T1 M6 command in MDI, I assume that I would see a 1 for T1? My tool height seem to be registering. When I enter (debug #5063) the z value from the tool setter shows up as the #5063. I am still getting the Pvalue out of range with G10 L1 error after the probe is tripped when the G38.2 part of my file runs.

I made this change to my hal.io:

loadusr -W hal_manualtoolchange
net tool-number iocontrol.0.tool-prep-number => hal_manualtoolchange.number
net tool-change iocontrol.0.tool-change => hal_manualtoolchange.change
net tool-changed iocontrol.0.tool-changed <= hal_manualtoolchange.changed
net tool-prepare iocontrol.0.tool-prepare => iocontrol.0.tool-prepared

Here are some parts of my ini file:

[RS274NGC]
REMAP = M6 modalgroup=6 ngc=toolchange
SUBROUTINE_PATH = /home/dave/linuxcnc/configs/by_interface.pico.univpwmv/subroutines/
#/home/dave/linuxcnc/configs/by_interface.pico.univpwmv/subroutines/
PARAMETER_FILE = linuxcnc.var
FEATURES = 12


TOOL_TABLE = tool.tbl

RETAIN_TOOL_NO = 1

TOOL_CHANGE = manual
  • PCW
  • PCW's Avatar
26 Sep 2025 00:55 - 26 Sep 2025 00:55

Going from Devian 10 to 12 has created problems

Category: General LinuxCNC Questions

I should note that the the pinirq script runs as expected on the LinuxCNC/Debian 12 image
  • RikoBR
  • RikoBR
25 Sep 2025 22:47
Replied by RikoBR on topic Help with tandem axis Y

Help with tandem axis Y

Category: Basic Configuration

Thank you Tommy and Djdelorie, i appreciate your help so far, i had a few minutes and disconnected probe and assign individual pins and did not work but i did not have much time and I will be away form the shop probably till Tuesday (which sucks because i want to convert this machine so bad) but i like the idea of only using 2 pins this way ill end up opening one output. and ill get back here to report how ever i did not find the option of assigning multiple stepgens to one pin so i assume it will have to be done in .hal and .ini??!! ill include those once i try (if i get a chance ill sneak in the shop on Sunday (fiancé permitting lol)

thank you again for the help
Displaying 13321 - 13324 out of 13324 results.
Time to create page: 0.634 seconds
Powered by Kunena Forum