Custom M codes don't work on Rasberry Pi 5 + Messa 7i95

More
07 Aug 2025 09:39 - 07 Aug 2025 10:38 #332994 by Pashtet
Hello everyone! This is my first post on the forum. I have a problem with setting up custom M codes on Raspberry + 7i95. I need additional outputs to control the equipment. Just turn on and off some outputs on the 7i95.
In principle, nothing complicated, but when executing custom M code, linuxcnc does not display error messages and the pin states on the 7i95 outputs do not change.
There are no changes in halshow either.

I use this image www.linuxcnc.org/iso/rpi-5-debian-bookwo...25-01-27-0140.img.xz

Here is one of the commands (M101)
#!/bin/bash
halcmd setp hm2_7i95.0.ssr.00.out-01 True
exit 0

Even if you intentionally make a mistake in the M command file, linuxcnc still does not give any error messages.
Has anyone encountered this problem on Rasberry Pi?
Last edit: 07 Aug 2025 10:38 by Pashtet.

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

More
07 Aug 2025 10:21 #332996 by rodw
Does your script have execute permissions?

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

More
07 Aug 2025 10:37 #332998 by Pashtet
Yes, of course. Without permission, Linuxcnc gives an error message.

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

More
07 Aug 2025 13:46 #333001 by Todd Zuercher
Does the command you are trying to use in the M-code, work in a terminal from the command line?

Do you get any error messages in the terminal when you try to run the M-code if you start Linuxcnc from the command line?

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

More
07 Aug 2025 14:04 - 07 Aug 2025 14:05 #333002 by PCW
Does the script work if run from the command line?

 That is, does:

./M101

work?
 
Last edit: 07 Aug 2025 14:05 by PCW.

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

More
07 Aug 2025 15:06 #333003 by Pashtet
Tried it two ways, still doesn't work. In the first case it gives an error.

pi@raspberrypi5:~/linuxcnc/nc_files $ ./M101
bash: ./M101: cannot execute: required file not found
pi@raspberrypi5:~/linuxcnc/nc_files $ bash M101
<commandline>:0: pin 'hm2_7i95.0.ssr.00.out-01' is connected to a signal
: numeric argument required

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

More
07 Aug 2025 16:05 #333006 by PCW
pin 'hm2_7i95.0.ssr.00.out-01' is connected to a signal

Is the error, you cannot change the state of a pin that's already drive by a signal in hal
You would need to delete (or comment out) the net command that connects
hm2_7i95.0.ssr.00.out-01 to a signal in your hal file for the MXXX script to work.
 

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

More
07 Aug 2025 17:49 - 07 Aug 2025 17:50 #333012 by Pashtet
 Sorry, I really didn't comment out these lines in Hal when I tested it from the command line. Here are the error messages.

pi@raspberrypi5:~/linuxcnc/nc_files $ bash M101
' invalid for bitvalue 'True
<commandline>:0: setp failed
: numeric argument required
pi@raspberrypi5:~/linuxcnc/nc_files $ 
 
Last edit: 07 Aug 2025 17:50 by Pashtet.

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

  • JacobRush
  • Away
  • Junior Member
  • Junior Member
More
07 Aug 2025 18:58 #333015 by JacobRush
You probably want to start your script with:
#!/usr/bin/env bash

I think this error is saying that /bin/bash is not in that location the /usr/bin/env will use the bash thats in your path. 

 

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

More
07 Aug 2025 22:56 - 08 Aug 2025 08:32 #333020 by unknown
It's finding bash fine, the command requires either a 0 or 1 as input, going by the error message, not a "True" or "False"


It's kind of hard to debug without seeing the script.

My comment regarding true or false is incorrect, thanks PCW.

Should the command be run from a bash command line or within a halcmd session ?

I've gone all rusty as of late...must be the dust from the build garage storage
Last edit: 08 Aug 2025 08:32 by unknown.

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

Time to create page: 0.084 seconds
Powered by Kunena Forum