Nondeterministic "error loading file"

Moderators: TomKerekes, dynomotion

gui_marchioro
Posts: 59
Joined: Sun Aug 21, 2022 11:22 pm

Re: Nondeterministic "error loading file"

Post by gui_marchioro » Fri Dec 30, 2022 7:12 pm

Hello Tom,
did you reboot KFLOP and restart KMotionCNC before running the test?
I assume you are using the files I modified?
Yes.
What does the garbage look like? Hexadecimal numbers?
In the print below you can see what is printed in the console right after the error occur. I have marked in red what is from the first M6, which is problematic, and in green the the part referring to the second M6 executed.
error_characters_printed.png
That's very interesting. That would just skip the compile step and shouldn't change anything with regard to the download or execution. Maybe change the timing?
You are right, when using the .ou file the execution is faster.
I don't think this code does anything. It just gets the current tool which is then never used.
I was missing to add and if statement in order to update a persist variable that relates to the current tool in use. Thanks for the feedback.
This is really a strange one.
Yes, it is :?

Sincerely,
Guilherme

User avatar
TomKerekes
Posts: 2747
Joined: Mon Dec 04, 2017 1:49 am

Re: Nondeterministic "error loading file"

Post by TomKerekes » Sat Dec 31, 2022 12:22 am

Hi Guilherme,

That looks like real garbage not some leftover data that KMotion would send. KMotion should never send those ASCII character codes > 127.

Since it doesn't happen for me I suppose there must be some hardware difference. Possibly some issue with the PC or possibly with KFLOP.

Could you try a different PC temporarily?

Do you have another KFLOP to try?

If you Compile/Download/Execute the M6 C Program from KMotion.exe many times does it ever fail?
Regards,

Tom Kerekes
Dynomotion, Inc.

gui_marchioro
Posts: 59
Joined: Sun Aug 21, 2022 11:22 pm

Re: Nondeterministic "error loading file"

Post by gui_marchioro » Sun Jan 22, 2023 5:55 pm

Hello Tom,
Could you try a different PC temporarily?
I tried and the problem still occurs :(
Do you have another KFLOP to try?
Unfortunatelly I don't have.
If you Compile/Download/Execute the M6 C Program from KMotion.exe many times does it ever fail?
I will try to do this and post the results here.

Sincerely,
Guilherme

Wayne
Posts: 4
Joined: Mon Nov 25, 2024 2:49 pm

Re: Nondeterministic "error loading file"

Post by Wayne » Tue Mar 18, 2025 3:19 pm

Hello everyone,

I use custom M code to collect data during my CNC machining, and I find it a very powerful feature in the Kogna motion controller. Custom M codes allow anything that may be programmed in C to be invoked, making them crucial for complex machining tasks. However, after testing with two computers using my Kogna updated to version 5.3.7, I encounter issues such as “Error Locating TCC67.exe Compiler,” “Error Compiling and Loading KMotion Program,” and “can’t open file.” This error disrupted KMotionCNC and I cannot finish a single job with custom M codes. After researching this forum, I realize that I am not alone and found related threads like “TCC compiler issues” by SamMarrocco (2020) and this thread (2022). Unfortunately, the error could not be reproduced by Tom, our moderator.

Inspired by gui_marchioro’s procedure, I tested the following and found this error highly reproducible with heavy use of custom M codes. The steps are:
1) Use “InitStepDir3Axis.c” provided by Dynomotion as the initialization file
Image
2) Set up M100 using “print.c” provided by Dynomotion.
Image
3) Ran a gcode ("M100 test.nc") with 500 lines of M100.
https://www.dropbox.com/scl/fi/uqlqf3my ... 2hs0n&dl=1

Instead of a nondeterministic error, I consistently encounter the error after 27 seconds of running the gcode ("M100 test.nc"), the errors appear in the following order:
Image
Image
Image

Furthermore, I tested the following parameters and found NO impact on avoiding the error:
a. Different initialization files.
b. Different threads assigned to run M100 (tried 2, 3, 7).
c. Different VAR values (tried 0, 1, 999).
d. The content of the M100 file; even an empty file like the following triggers the error:

Code: Select all

#include "KMotionDef.h"
main()
{  
}
The only parameter that matters, as mentioned by gui_marchioro’s previously, is using the output file of “print.c” instead of “print.c.” Instead of being nondeterministic, every single time the “"M100 test.nc"” can be completed just once by using the output file, but pressing the run button again the errors appear in the following order:
Image
Image
Image
Image

My requests:
Hi Tom, if the error is still not reproducible on your end, could you kindly provide a workaround for those of us who use lots of custom M codes?

Additionally, I would greatly appreciate it if other Kogna users could try the above test to see if the file loading error is reproducible on your systems. If you are not comfortable using the "M100 test.nc" file I uploaded, it simply contains 500 lines of M100 followed by M9 and M30.

Many thanks to everyone!!!

User avatar
TomKerekes
Posts: 2747
Joined: Mon Dec 04, 2017 1:49 am

Re: Nondeterministic "error loading file"

Post by TomKerekes » Tue Mar 18, 2025 10:04 pm

Hi Wayne,

Thanks for the excellent and complete example.

Yes I'm able to reliably reproduce. It always occurs after 254 M100s which is very suspicious.

Please give us some time to figure it out.

Thanks
Regards,

Tom Kerekes
Dynomotion, Inc.

User avatar
TomKerekes
Posts: 2747
Joined: Mon Dec 04, 2017 1:49 am

Re: Nondeterministic "error loading file"

Post by TomKerekes » Thu Mar 20, 2025 1:03 am

Hi Wayne,

We found a bug determining the Kogna Firmware Version where the Firmware file (\DSP_KOGNA\DSPKOGNA.out) was opened but not closed. This happens whenever a file for Kogna is Compiled or Downloaded to Kogna. This does not occur for KFLOP systems. It seems after an application leaves 512 files open Windows refuses the App from opening any other files. The bug is in the KMotionDLL.dll library.

Here is a patch for Version 5.3.7. Copy to the \KMotion\Release folder.
KMotionDLL.dll

Here is the modified source file if needed.
KMotionDLL.cpp

Please let us know of any issues.

Thanks again for your help isolating this.
Regards,

Tom Kerekes
Dynomotion, Inc.

Post Reply