ESP32/S2/S3 LinuxCNC Controller (6 axis hardware step gen), USB plug-and-play

More
01 Nov 2024 10:09 - 01 Nov 2024 10:27 #313596 by michaeln
Does the spiethconfig work for anybody?
I tested a lot, but i don't find the problem.
I insert printf commands in the code and get strange outputs. I change from picocom to putty, the same.

The command in short and long version:
spiethconfig -s 19 -i 23 -c 18 -e 0 -t 4
spiethconfig --miso 19 --mosi 23 --sck 18 --csenable 0 --interrupt 4
The output:
Invalid or missing Chip Select pin (0>128)
Command returned non-zero error code: 0x1 (ERROR)

I insert some printf-commands ( bold my changes):
            printf("argc: %d\r\n", argc);     

          
  if (result.count("s")) { miso_pin = result["s"].as<int>;(); }
            printf("MISO pin: %d \r\n", miso_pin);
            if (miso_pin < 0 || miso_pin > 128 ) { printf_P(PSTR("Invalid or missing MISO pin (0>128)\n")); return EXIT_FAILURE;}
            
            if (result.count("i")) { mosi_pin = result["i"].as<int>;(); }
            printf("MOSI pin: %d \r\n", mosi_pin);
            if (mosi_pin < 0 || mosi_pin > 128 ) { printf_P(PSTR("Invalid or missing MOSI pin (0>128)\n")); return EXIT_FAILURE;}

            if (result.count("c")) { sck_pin = result["c"].as<int>;(); }
            printf("SCK pin: %d \r\n", sck_pin);
            if (sck_pin < 0 || sck_pin > 128 ) { printf_P(PSTR("Invalid or missing SCK pin (0>128)\n")); return EXIT_FAILURE;}

            if (result.count("e")) { cs_pin = result["e"].as<int>;(); }
            printf("CS pin: %d \r\n", cs_pin);
            if (cs_pin < 0 || cs_pin > 128 ) { printf_P(PSTR("Invalid or missing Chip Select pin (0>128)\n")); return EXIT_FAILURE;}

            if (result.count("t")) { int_pin = result["t"].as<int>;(); }
            printf("INT pin: %d \r\n", int_pin);
            if (int_pin < 0 || int_pin > 128 ) { printf_P(PSTR("Invalid or missing Interrupt pin (0>128)\n")); return EXIT_FAILURE;}

and get the result:
argc: 7
MISO pin: 19
MOSI pin: 23
SCK pin: 18
CS pin: 255
Invalid or missing Chip Select pin (0>128)
Command returned non-zero error code: 0x1 (ERROR)

After that i change the sequence of the variables, the problems stay at the forth position. i saw that the out from argc stay at maximum 7 (in my opinion it should be 11).

Does it work for anybody?
If yes, what does is made wrong?

Thanks and best regards
michaeln
Last edit: 01 Nov 2024 10:27 by michaeln.

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

More
29 Nov 2024 02:41 #315506 by tommylight
Had the same issue, so it was easier to resolder the pins, but still did not work.
Had no time to test anymore, it is sitting on my desk here for quite some time, but i think i might give it a go these days.
Did you get any further?

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

More
29 Nov 2024 13:28 - 29 Nov 2024 14:12 #315541 by Mecanix
[deleted] confusion...
Last edit: 29 Nov 2024 14:12 by Mecanix.

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

More
29 Nov 2024 14:05 #315542 by Mecanix

Had the same issue, so it was easier to resolder the pins, but still did not work.
Had no time to test anymore, it is sitting on my desk here for quite some time, but i think i might give it a go these days.
 

Doubt this will be reliable, Tommy. Sure, prolly be spinning a motor on the benchtop and comm for 10~20min but most likely be failing more often than not. E.g. zero timing critical pthread/mutex//locks/semaphores/gives/takes nothing at all. Could get away without it in a parallel compute domain but in this case, it's all serialized runtime (locks/integrity mandatory).

Wouldn't be surprised this is the reason Wez abandoned the extra efforts that it needed. 
The following user(s) said Thank You: tommylight

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

More
29 Nov 2024 15:11 #315554 by tommylight
No worries, using this for experimenting only, for anything and everything i use Mesa, just had some ESP32 around from messing with drones.
I did test with hal2udp though for over a day and did not notice any issues, but that is much simpler than this. And it uses a base period for software stepping.
Whenever i get a chance i will be testing this on a production plasma machine, just to see if the antena RX/TX survive the HF/HV pilot arc from plasma. :) I hope i do not forget to make videos, i always forget to make videos...
Wez did a magnificent job for sure, i ordered some ESP32 S3 yesterday just because of this, he deserves a lot of respect for cramming all that stuff into a micro controller. And so do the makers of Marlin.
I wonder if Wez is OK...
The following user(s) said Thank You: Mecanix

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

More
29 Nov 2024 18:41 #315568 by Mecanix

I wonder if Wez is OK...

Totally cool project yeah, I remember looking into it during its infancy but wasn't geared up to import and compile any of it :( I think Wez attempted a proof of concept here, which he materialized already, however I sense he lacked the courage or perhaps the time to complete it. I looked at it again a few hours ago and it seems to be only missing the timing critical & comm integrity on the blocking/non-blocking/locking threads and other runtimes. Haha maybe you can finish it up (hardest part though, need a sharp oscope and a vivid logic analyser, beware!!).

I'm sure he's fine. Obviously busy with worlds' more important stuff, we all are!

 

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

More
29 Nov 2024 18:57 - 29 Nov 2024 18:59 #315570 by Mecanix
Tommy. You honestly need to lookup RMT based controls if that 32bits is your hardware (suggest the P4 if they are available to you). If you're after half-decent motion control performance and reliability, that's the only way to do it really (imho). Yeah man, from scratch!!

github.com/espressif/esp-idf/tree/master...ls/rmt/stepper_motor

That, and grab a good doze of knowledge of mutual exclusion runtime(mutex, semaphores, give, take, locks, ect), and the end result should match up to as close as it gets to a parallel compute (aka fpga).
Last edit: 29 Nov 2024 18:59 by Mecanix.
The following user(s) said Thank You: tommylight

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

More
29 Nov 2024 19:09 #315575 by tommylight
P4 was not found on amazon.de so S3 it was.
Had a play with this earlier today, Wez's version fails to set networking for some reason on ESP32wroom module, the other version someone linked here does work but suffers from random reboot loops, a lot.
I am after something else here, use an ESP32 as it has 12 bit ADC to measure the arc voltage and turn the torch on, mounted on the plasma source, and another module connected to PC to translate those voltage values to pulses with variable frequency.
Should be doable and have good enough latency for about 50-150 updates per second. It they survive the EMI :)

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

More
29 Nov 2024 19:19 - 29 Nov 2024 19:39 #315579 by Mecanix
S3 cores ran on the 240meg and compiled -o2 is pleeeenty sufficient (my fav silicon of them all in fact). The P4 is very much overkill here, but hey, who doesn't like overkill anything lol ps.150hz is nothing for a S3. That makes both the S3 and P4 overkill in that sense ;)

On the MCU Motion Control rant; and If I'd be any of you MCU experts, I'd get a RMT based driver working on 1 (one) motor to begin with, and before doing/coding anything else, have that comm and feedback 110% reliably with the Lcnc comm driver **mutex'ed**.

Once that's sold and a certainty, move to the next step (channel array!)
Last edit: 29 Nov 2024 19:39 by Mecanix.
The following user(s) said Thank You: tommylight

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

More
29 Nov 2024 21:33 #315587 by tommylight
Is that your chanel on youtube with the ESP MPG?
I'll be bothering you about that soon as i have a 3D printed MPG with a screen that Mesa7i73 does not use.
RMT will have to wait, limited time, but lately i am stuck at home/shops so maybe...

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

Time to create page: 0.100 seconds
Powered by Kunena Forum