7i76E hm2 driver

More
24 Apr 2023 19:40 - 24 Apr 2023 19:42 #269774 by 5G-antry
7i76E hm2 driver was created by 5G-antry
Hey Guys,

For a project at my university, I am currently developing a Gantry CNC with a wireless, “realtime capable” connection between LinuxCNC and MESA 7i76E.
FYI, I am currently troubleshooting with by a wired connection with network emulation (netem: wiki.linuxfoundation.org/networking/netem).

Everything is running smooth except the initialization (start up) of the MESA 7i76E. When initilized, adding latency to a certain degree is not a problem. In another thread I already got help and understand the issue (forum.linuxcnc.org/10-advanced-configura...tup-without-encoders).
However, due to my lack of “C” skills I need maybe a little further help.
The goal is to initialize the connection between LinuxCNC and MESA with a connection with a latency of 1.5ms. The current error (console_output) as well as the correct initialization phase (correct_console_output) is attached. The "hm2_eth.c" file should be the one, I have to adapt (github.com/LinuxCNC/linuxcnc/blob/d221e2...a-hostmot2/hm2_eth.c)
The error messages show that “rtapi_app_main” fails. This contains of “hm2_eth_probe”, “hm2_eth_items” and “hal init”.The error Message “board fails HM2 registration” indicates that “hm2_eth_probe” does not work due to “ret != 0”. From my understanding, the variable “ret” is used to store the return value of different functions (e.g. eth_socket_send() and eth_socket_recv_loop(), etc.).
First I thought the variables I have to adapt in the hm2_eth.c file are:

SEND_TIMEOUT_US 10
RECV_TIMEOUT_US 10
READ_PCK_DELAY_NS 10000.

However, by adapting those (tried different values) and recompile LinuxCNC, the initialization does not work with the same error message.So my question: Is the solution in adapting “hm2_eth.c” or should I also look into "deeper" parts that have nothing directly to do with the ethernet-based MESA (e.g. “hostmot2.c” or some further C-Code). Maybe someone can help a little where to look at.

I am sorry, I cannot embed the links. I always get "Kunena Internal Errors". Maybe this thread can also be moved to the driver board section if wrong at this place.

Thank you! If more information are needed, feel free to ask/contact me.
Attachments:
Last edit: 24 Apr 2023 19:42 by 5G-antry.

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

More
24 Apr 2023 21:46 #269787 by PCW
Replied by PCW on topic 7i76E hm2 driver
Did you try setting the hal read timeout pin
(hm2_7i76e.packet-read-timeout)

To say 10000000

(that would be 10 ms)

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

More
25 Apr 2023 09:38 #269829 by 5G-antry
Replied by 5G-antry on topic 7i76E hm2 driver
Hello,

already tried that.
I also thought that this would be enough. Unfortunately not.
I played around with the pins that can be adapted regarding this: linuxcnc.org/docs/html/man/man9/hm2_eth.9.html
I can attach a trial .hal and .ini. The values for Servo thread, watchdog.timeout, and packet-read-timeout are very high in that example.

I think there are no further adjustments that can be done except the driver adaption (hm2_eth).
 
Attachments:

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

More
25 Apr 2023 10:33 #269837 by tommylight
Replied by tommylight on topic 7i76E hm2 driver
What are you using for wireless coms?

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

More
25 Apr 2023 10:47 - 25 Apr 2023 12:18 #269839 by PCW
Replied by PCW on topic 7i76E hm2 driver
Is it possible your interface drops packets?

Also this line in the driver:

long read_timeout = board->hal ? board->hal->read_timeout : 1600000;

may set the timeout before the hal file has been parsed, not sure when it is run relative to
hm2_eth initialization.
Last edit: 25 Apr 2023 12:18 by PCW.

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

More
25 Apr 2023 11:16 #269843 by 5G-antry
Replied by 5G-antry on topic 7i76E hm2 driver

What are you using for wireless coms?
 

We are developing our own wireless communication based on a token ring system.
Currently we are just emulating the network behaviour using NetworkEmulator. To be precise: we give latency and jitter on the network interface that is directly connected to the MESA by wire. If we add a latency of >= 1.5ms  and no Jitter, the initialization of the MESA fails. If we add this latency after initialization, the machine tool works.

Is it possible your interface drops packets?
Also this line in the driver:
long read_timeout = board->hal ? board->hal->read_timeout : 1600000;
may set the timeout before the hal file has been parsed, not sure when it is run 

Thank you. I will look into that. Usually packets should not be dropped. But maybe I should do some wireshark analysis and look what "exactly" happens.
 

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

More
25 Apr 2023 12:19 - 25 Apr 2023 12:20 #269851 by PCW
Replied by PCW on topic 7i76E hm2 driver
long read_timeout = board->hal ? board->hal->read_timeout : 1600000;

Looks suspicious when you say an added 1.5 ms makes initialization fail.
Last edit: 25 Apr 2023 12:20 by PCW.

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

More
25 Apr 2023 12:34 #269853 by 5G-antry
Replied by 5G-antry on topic 7i76E hm2 driver
Yes, thats right. I also thought that those 1.5ms should not make a problem.
The weird thing is that the operation after initialization works stable (more or less)

I will look into it today or tomorrow and give feedback.

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

More
26 Apr 2023 15:18 #269983 by 5G-antry
Replied by 5G-antry on topic 7i76E hm2 driver
Just tried around some stuff and even if the duartion of the initialization is set very long (takes like 4 or 5 seconds to initialize without added delay on interface) it does not initialize.

What did I do:
After struggeling with hm2_eth and trying basically everything I could imagine, I changed the hardcoded delay of  "halcmd_commands.c" and "halrmt.c" to a high amount of time.
Still errors (see attachement)

Maybe it has something to do with "waitpid failed". Have to look into it

On the other side, maybe I will ignore some stuff of the code to initialize the MESA so that at leat it can start one time.
Could it also be regarding the firmware, how MESA handles stuff?

Have to look way deeper into it and will report :)
Attachments:

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

More
26 Apr 2023 15:31 #269986 by PCW
Replied by PCW on topic 7i76E hm2 driver
Did you change this number?
long read_timeout = board->hal ? board->hal->read_timeout : 1600000;
The following user(s) said Thank You: 5G-antry

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

Time to create page: 0.137 seconds
Powered by Kunena Forum