Advanced Search

Search Results (Searched for: )

  • andypugh
  • andypugh's Avatar
25 Jul 2024 09:34
Replied by andypugh on topic Yaskawa incremental encoder and Mesa 7i48

Yaskawa incremental encoder and Mesa 7i48

Category: Driver Boards

I wonder if a HAL component could be written to interpret this startup data?
It would rather depend on the rate that it comes in at. It is probably too fast to sample in a servo thread, so can't be directly read from the mesa driver pins.
  • Aciera
  • Aciera's Avatar
25 Jul 2024 09:25
Replied by Aciera on topic Yaskawa incremental encoder and Mesa 7i48

Yaskawa incremental encoder and Mesa 7i48

Category: Driver Boards

There is some information regarding C-Channel in this document:
www.dropbox.com/scl/fi/f43c4x9juh0dsgcp9...y3ktvoa1buw&e=1&dl=0

Relevant sections:

 
 
 

 
  • yathish
  • yathish
25 Jul 2024 08:55 - 25 Jul 2024 08:58

Extrernal step gerenation using ESP32+w5500

Category: Advanced Configuration

Hello Linuxcnc community, I was trying external step generation using ESP32+W5500, I was refering github.com/jzolee/HAL2UDP/blob/main/src/main.cpp. In HAL2UDp/scr/main.cpp , which is nothing but ESP32 side code, the syntax has to be changed because some functions have been combined refer this for changed syntax docs.espressif.com/projects/arduino-esp3...atest/api/timer.html.
This is the updated main.cpp : #include <Arduino.h>
//#include <driver/ledc.h>/
#include <Ethernet.h>
#include <EthernetUdp.h>
#include <esp_task_wdt.h>
/*==================================================================*/
byte mac = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192, 168, 96, 54);
unsigned int port = 58427;
/*==================================================================*/
#define SPI_CS_PIN 5 // hardcoded in Ethernet_mod/src/utility/w5100.h !!!!!!!!!!!!!!
/*==================================================================*/
#define STEP_0_PIN 12
#define STEP_0_H REG_WRITE(GPIO_OUT_W1TS_REG, BIT12)
#define STEP_0_L REG_WRITE(GPIO_OUT_W1TC_REG, BIT12)
#define DIR_0_PIN 13
#define DIR_0_H REG_WRITE(GPIO_OUT_W1TS_REG, BIT13)
#define DIR_0_L REG_WRITE(GPIO_OUT_W1TC_REG, BIT13)
#define STEP_1_PIN 16
#define STEP_1_H REG_WRITE(GPIO_OUT_W1TS_REG, BIT16)
#define STEP_1_L REG_WRITE(GPIO_OUT_W1TC_REG, BIT16)
#define DIR_1_PIN 17
#define DIR_1_H REG_WRITE(GPIO_OUT_W1TS_REG, BIT17)
#define DIR_1_L REG_WRITE(GPIO_OUT_W1TC_REG, BIT17)
#define STEP_2_PIN 21
#define STEP_2_H REG_WRITE(GPIO_OUT_W1TS_REG, BIT21)
#define STEP_2_L REG_WRITE(GPIO_OUT_W1TC_REG, BIT21)
#define DIR_2_PIN 22
#define DIR_2_H REG_WRITE(GPIO_OUT_W1TS_REG, BIT22)
#define DIR_2_L REG_WRITE(GPIO_OUT_W1TC_REG, BIT22)
/*==================================================================*/
#define OUT_00_PIN 2
#define OUT_00_H REG_WRITE(GPIO_OUT_W1TS_REG, BIT2)
#define OUT_00_L REG_WRITE(GPIO_OUT_W1TC_REG, BIT2)
#define OUT_01_PIN 4
#define OUT_01_H REG_WRITE(GPIO_OUT_W1TS_REG, BIT4)
#define OUT_01_L REG_WRITE(GPIO_OUT_W1TC_REG, BIT4)
#define OUT_02_PIN 25
#define OUT_02_H REG_WRITE(GPIO_OUT_W1TS_REG, BIT25)
#define OUT_02_L REG_WRITE(GPIO_OUT_W1TC_REG, BIT25)
#define OUT_03_PIN 1
#define OUT_03_H REG_WRITE(GPIO_OUT_W1TS_REG, BIT1)
#define OUT_03_L REG_WRITE(GPIO_OUT_W1TC_REG, BIT1)
#define OUT_04_PIN 14
#define OUT_04_H REG_WRITE(GPIO_OUT_W1TS_REG, BIT14)
#define OUT_04_L REG_WRITE(GPIO_OUT_W1TC_REG, BIT14)
#define OUT_05_PIN 15
#define OUT_05_H REG_WRITE(GPIO_OUT_W1TS_REG, BIT15)
#define OUT_05_L REG_WRITE(GPIO_OUT_W1TC_REG, BIT15)
/*==================================================================*/
#define IN_00_PIN 26
#define IN_00 REG_READ(GPIO_IN_REG) & BIT26 //26
#define IN_01_PIN 27
#define IN_01 REG_READ(GPIO_IN_REG) & BIT27 //27
#define IN_02_PIN 32
#define IN_02 REG_READ(GPIO_IN1_REG) & BIT0 //32 -32
#define IN_03_PIN 33
#define IN_03 REG_READ(GPIO_IN1_REG) & BIT1 //33 -32
#define IN_04_PIN 34
#define IN_04 REG_READ(GPIO_IN1_REG) & BIT2 //34 -32
#define IN_05_PIN 35
#define IN_05 REG_READ(GPIO_IN1_REG) & BIT3 //35 -32
#define IN_06_PIN 36
#define IN_06 REG_READ(GPIO_IN1_REG) & BIT4 //36 -32
#define IN_07_PIN 39
#define IN_07 REG_READ(GPIO_IN1_REG) & BIT7 //39 -32
/*==================================================================*/
#define CTRL_DIRSETUP 0b00000001
#define CTRL_ACCEL    0b00000010
#define CTRL_PWMFREQ  0b00000100
#define CTRL_READY    0b01000000
#define CTRL_ENABLE   0b10000000
#define IO_00 0b00000001
#define IO_01 0b00000010
#define IO_02 0b00000100
#define IO_03 0b00001000
#define IO_04 0b00010000
#define IO_05 0b00100000
#define IO_06 0b01000000
#define IO_07 0b10000000
/*==================================================================*/
EthernetUDP Udp; // An EthernetUDP instance to let us send and receive packets over UDP
struct cmdPacket {
    uint8_t control;
    uint8_t io;
    uint16_t pwm[6];
    int32_t pos[3];
    float vel[3];
} cmd = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f };
struct fbPacket {
    uint8_t control;
    uint8_t io;
    int32_t pos[3];
    float vel[3];
} fb = { 0, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f };
/*==================================================================*/
volatile unsigned long ul_dirSetup[3] = { 1000, 1000, 1000 }; // x 25 nanosec
volatile float f_accel_x2[3] = { 1000.0, 1000.0, 1000.0 }; // acceleration*2 step/sec2
/*==================================================================*/
volatile unsigned long ul_cmd_T[3];
unsigned long ul_accelStep[3] = { 0, 0, 0 };
volatile unsigned long ul_T[3] = { 0, 0, 0 };
volatile unsigned long ul_TH[3] = { 0, 0, 0 };
volatile unsigned long ul_TL[3] = { 0, 0, 0 };
volatile bool b_math[3] = { false, false, false };
volatile bool b_dirSignal[3] = { LOW, LOW, LOW };
volatile bool b_dirChange[3] = { false, false, false };
const uint8_t pwm_pin[6] = { OUT_00_PIN, OUT_01_PIN, OUT_02_PIN, OUT_03_PIN, OUT_04_PIN, OUT_05_PIN };
bool pwm_enable[6] = { false, false, false, false, false, false };
/*==================================================================*/
hw_timer_t* stepGen_0 = NULL;
hw_timer_t* stepGen_1 = NULL;
hw_timer_t* stepGen_2 = NULL;
/*==================================================================*/
float IRAM_ATTR fastInvSqrt(const float x)
{
    const float xhalf = x * 0.5f;
    union {
        float x;
        uint32_t i;
    } u = { .x = x };
    u.i = 0x5f3759df - (u.i >> 1);
    return u.x * (1.5f - xhalf * u.x * u.x);
}
/*==================================================================*/
/*float IRAM_ATTR Q_InvSqrt(float x)
{
    float xhalf = x * 0.5f;
    int i = (int)&x; // evil floating point bit level hacking
    i = 0x5f3759df - (i >> 1); // what the fuck?
    x = (float)&i; // convert new bits into float
    x = x * (1.5f - xhalf * x * x); // 1st iteration of Newton's method
    //x = x * (1.5f - xhalf * x * x); // 2nd iteration, this can be removed
    return x;
}*/
/*==================================================================*/
void IRAM_ATTR onTime_0()
{
    static bool b_stepState = LOW;
    static bool b_dirState = LOW;
    if (b_stepState == LOW) { // end of period
        if (ul_T[0]) { // there is a period time so a pulse must be started
            if (!b_dirChange[0]) { //direction is good, start a new pulse (step L-H transition)
                STEP_0_H;
                timerWrite(stepGen_0, ul_TH[0]);
                b_stepState = HIGH;
                b_dirState ? fb.pos[0]++ : fb.pos[0]--;
                b_math[0] = true; // calculation of a new period time
            } else { // need to change direction
                if (b_dirSignal[0]) {
                    DIR_0_H;
                    b_dirState = HIGH;
                } else {
                    DIR_0_L;
                    b_dirState = LOW;
                }
                timerWrite(stepGen_0, ul_dirSetup[0]);
                b_dirChange[0] = false;
            }
        } else { // no need to step pulse
            timerWrite(stepGen_0, 4000ul); // 0,1 millis scan
            b_math[0] = true; // calculation of a new period time
        }
    } else { // the middle of the period time (step H-L transition)
        STEP_0_L;
        timerWrite(stepGen_0, ul_TL[0]);
        b_stepState = LOW;
    }
}
/*==================================================================*/
void IRAM_ATTR onTime_1()
{
    static bool b_stepState = LOW;
    static bool b_dirState = LOW;
    if (b_stepState == LOW) { // end of period
        if (ul_T[1]) { // there is a period time so a pulse must be started
            if (!b_dirChange[1]) { //direction is good, start a new pulse (step L-H transition)
                STEP_1_H;
                timerWrite(stepGen_1, ul_TH[1]);
                b_stepState = HIGH;
                b_dirState ? fb.pos[1]++ : fb.pos[1]--;
                b_math[1] = true; // calculation of a new period time
            } else { // need to change direction
                if (b_dirSignal[1]) {
                    DIR_1_H;
                    b_dirState = HIGH;
                } else {
                    DIR_1_L;
                    b_dirState = LOW;
                }
                timerWrite(stepGen_1, ul_dirSetup[1]);
                b_dirChange[1] = false;
            }
        } else { // no need to step pulse
            timerWrite(stepGen_1, 4000ul); // 0,1 millis scan
            b_math[1] = true; // calculation of a new period time
        }
    } else { // the middle of the period time (step H-L transition)
        STEP_1_L;
        timerWrite(stepGen_1, ul_TL[1]);
        b_stepState = LOW;
    }
}
/*==================================================================*/
void IRAM_ATTR onTime_2()
{
    static bool b_stepState = LOW;
    static bool b_dirState = LOW;
    if (b_stepState == LOW) { // end of period
        if (ul_T[2]) { // there is a period time so a pulse must be started
            if (!b_dirChange[2]) { //direction is good, start a new pulse (step L-H transition)
                STEP_2_H;
                timerWrite(stepGen_2, ul_TH[2]);
                b_stepState = HIGH;
                b_dirState ? fb.pos[2]++ : fb.pos[2]--;
                b_math[2] = true; // calculation of a new period time
            } else { // need to change direction
                if (b_dirSignal[2]) {
                    DIR_2_H;
                    b_dirState = HIGH;
                } else {
                    DIR_2_L;
                    b_dirState = LOW;
                }
                timerWrite(stepGen_2, ul_dirSetup[2]);
                b_dirChange[2] = false;
            }
        } else { // no need to step pulse
            timerWrite(stepGen_2, 4000ul); // 0,1 millis scan
            b_math[2] = true; // calculation of a new period time
        }
    } else { // the middle of the period time (step H-L transition)
        STEP_2_L;
        timerWrite(stepGen_2, ul_TL[2]);
        b_stepState = LOW;
    }
}
/*==================================================================*/
void IRAM_ATTR newT(const int i) // period time calculation
{
    //ul_T = 40000000.0f / sqrtf((float)(ul_accelStep * ul_accel_x2));
    ul_T = 40000000.0f * fastInvSqrt((float)ul_accelStep * f_accel_x2); // fast method (>3x)
    ul_TH = ul_T >> 1;
    ul_TL = ul_T - ul_TH;
}
/*==================================================================*/
void IRAM_ATTR deceleration(const int i)
{
    if (ul_accelStep) {
        ul_accelStep--;
        if (ul_accelStep)
            newT(i);
        else
            ul_T = 0;
    }
}
/*==================================================================*/
void IRAM_ATTR acceleration(const int i)
{
    if (cmd.control & CTRL_ENABLE) {
        ul_accelStep++;
        newT(i);
    } else
        deceleration(i);
}
/*==================================================================*/
void IRAM_ATTR outputHandler() {
    static int last_pwm[6] = { 0, 0, 0, 0, 0, 0 };
    bool enable = cmd.control & CTRL_ENABLE;
    if (pwm_enable[0]) {
        if (enable) {
            if (last_pwm[0] != cmd.pwm[0]) {
                last_pwm[0] = cmd.pwm[0];
                ledcWrite(0, last_pwm[0]);
            }
        } else {
            ledcWrite(0, 0);
            last_pwm[0] = 0;
        }
    } else {
        if (enable) {
            if (cmd.io & IO_00) {
                OUT_00_H;
            } else {
                OUT_00_L;
            }
        } else {
            OUT_00_L;
        }
    }
    if (pwm_enable[1]) {
        if (enable) {
            if (last_pwm[1] != cmd.pwm[1]) {
                last_pwm[1] = cmd.pwm[1];
                ledcWrite(2, last_pwm[1]);
            }
        } else {
            ledcWrite(2, 0);
            last_pwm[1] = 0;
        }
    } else {
        if (enable) {
            if (cmd.io & IO_01) {
                OUT_01_H;
            } else {
                OUT_01_L;
            }
        } else {
            OUT_01_L;
        }
    }
    if (pwm_enable[2]) {
        if (enable) {
            if (last_pwm[2] != cmd.pwm[2]) {
                last_pwm[2] = cmd.pwm[2];
                ledcWrite(4, last_pwm[2]);
            }
        } else {
            ledcWrite(4, 0);
            last_pwm[2] = 0;
        }
    } else {
        if (enable) {
            if (cmd.io & IO_02) {
                OUT_02_H;
            } else {
                OUT_02_L;
            }
        } else {
            OUT_02_L;
        }
    }
    if (pwm_enable[3]) {
        if (enable) {
            if (last_pwm[3] != cmd.pwm[3]) {
                last_pwm[3] = cmd.pwm[3];
                ledcWrite(6, last_pwm[3]);
            }
        } else {
            ledcWrite(6, 0);
            last_pwm[3] = 0;
        }
    } else {
        if (enable) {
            if (cmd.io & IO_03) {
                OUT_03_H;
            } else {
                OUT_03_L;
            }
        } else {
            OUT_03_L;
        }
    }
    if (pwm_enable[4]) {
        if (enable) {
            if (last_pwm[4] != cmd.pwm[4]) {
                last_pwm[4] = cmd.pwm[4];
                ledcWrite(8, last_pwm[4]);
            }
        } else {
            ledcWrite(8, 0);
            last_pwm[4] = 0;
        }
    } else {
        if (enable) {
            if (cmd.io & IO_04) {
                OUT_04_H;
            } else {
                OUT_04_L;
            }
        } else {
            OUT_04_L;
        }
    }
    if (pwm_enable[5]) {
        if (enable) {
            if (last_pwm[5] != cmd.pwm[5]) {
                last_pwm[5] = cmd.pwm[5];
                ledcWrite(10, last_pwm[5]);
            }
        } else {
            ledcWrite(10, 0);
            last_pwm[5] = 0;
        }
    } else {
        if (enable) {
            if (cmd.io & IO_05) {
                OUT_05_H;
            } else {
                OUT_05_L;
            }
        } else {
            OUT_05_L;
        }
    }
}
/*==================================================================*/
void IRAM_ATTR inputHandler()
{
    (IN_00) ? fb.io = IO_00 : fb.io = 0;
    if (IN_01)
        fb.io |= IO_01;
    if (IN_02)
        fb.io |= IO_02;
    if (IN_03)
        fb.io |= IO_03;
    if (IN_04)
        fb.io |= IO_04;
    if (IN_05)
        fb.io |= IO_05;
    if (IN_06)
        fb.io |= IO_06;
    if (IN_07)
        fb.io |= IO_07;
}
/*==================================================================*/
void IRAM_ATTR commandHandler()
{
    if (cmd.control & CTRL_READY) {
        Serial.println("Handling CTRL_READY");
        for (int i = 0; i < 3; i++) {
            if (cmd.vel > 0.0f)
                ul_cmd_T = (unsigned long)(40000000.0f / cmd.vel);
            else if (cmd.vel < 0.0f)
                ul_cmd_T = (unsigned long)(40000000.0f / -cmd.vel);
            else
                ul_cmd_T = 40000000ul;
        }
    }
    if (!(fb.control & CTRL_READY)) {
        Serial.println("fb.control not ready");
        if ((fb.control & CTRL_DIRSETUP)
            && (fb.control & CTRL_ACCEL)
            && (fb.control & CTRL_PWMFREQ)) {
            fb.control |= CTRL_READY;
            Serial.println("CTRL_READY set");
        } else if (cmd.control & CTRL_DIRSETUP) {
            fb.control |= CTRL_DIRSETUP;
            for (int i = 0; i < 3; i++)
                ul_dirSetup = cmd.pos / 25; //   25ns / timer tic
            Serial.println("CTRL_DIRSETUP set");
        } else if (cmd.control & CTRL_ACCEL) {
            fb.control |= CTRL_ACCEL;
            for (int i = 0; i < 3; i++)
                f_accel_x2 = (float)cmd.pos * 2.0;
            Serial.println("CTRL_ACCEL set");
        } else if (cmd.control & CTRL_PWMFREQ) {
            fb.control |= CTRL_PWMFREQ;
            for (int i = 0; i < 6; i++) {
                if (cmd.pwm) {
                    ledcAttach(pwm_pin, i * 2, true);
                    ledcAttach(pwm_pin, cmd.pwm, 10);
                    ledcWrite(i * 2, 0);
                    pwm_enable = true;
                    Serial.print("PWM enabled for pin ");
                    Serial.println(pwm_pin);
                } else {
                    if (i == 0) {
                        pinMode(OUT_00_PIN, OUTPUT);
                        digitalWrite(OUT_00_PIN, 0);
                    } else if (i == 1) {
                        pinMode(OUT_01_PIN, OUTPUT);
                        digitalWrite(OUT_01_PIN, 0);
                    } else if (i == 2) {
                        pinMode(OUT_02_PIN, OUTPUT);
                        digitalWrite(OUT_02_PIN, 0);
                    } else if (i == 3) {
                        pinMode(OUT_03_PIN, OUTPUT);
                        digitalWrite(OUT_03_PIN, 0);
                    } else if (i == 4) {
                        pinMode(OUT_04_PIN, OUTPUT);
                        digitalWrite(OUT_04_PIN, 0);
                    } else if (i == 5) {
                        pinMode(OUT_05_PIN, OUTPUT);
                        digitalWrite(OUT_05_PIN, 0);
                    }
                }
            }
        }
    }
}
/*==================================================================*/
void IRAM_ATTR loop_Core0(void* parameter)
{
    delay(500);
    Udp.parsePacket(); /* to empty buffer */
    for (;;) {
        Serial.println("Inside loop_Core0");
        static unsigned long ul_watchdog;
        if (Udp.parsePacket() == sizeof(cmd) + 1) {
            char packetBuffer[60]; // buffer for receiving and sending data
            Udp.read(packetBuffer, sizeof(cmd) + 1);
            uint8_t chk = 71;
            for (int i = 0; i < sizeof(cmd); i++)
                chk ^= packetBuffer;
            if (packetBuffer[sizeof(cmd)] == chk) {
                memcpy(&cmd, &packetBuffer, sizeof(cmd));
                commandHandler();
                ul_watchdog = millis();
            }
            inputHandler();
            for (int i = 0; i < 3; i++) {
                unsigned long ul_t = ul_T;
                if (ul_t)
                    b_dirSignal ? fb.vel = 40000000.0f / (float)ul_t : fb.vel = -40000000.0f / (float)ul_t;
                else
                    fb.vel = 0.0f;
            }
            memcpy(&packetBuffer, &fb, sizeof(fb));
            Udp.beginPacket(Udp.remoteIP(), Udp.remotePort());
            Udp.write(packetBuffer, sizeof(fb));
            Udp.endPacket();
            outputHandler();
        }
        if (millis() - ul_watchdog > 10ul) {
            fb.control = 0;
            cmd.control = 0;
            outputHandler();
            ul_watchdog = millis();
        }
        esp_task_wdt_reset();
    }
}
/*==================================================================*/
void setup_Core0(void* parameter)
{  
    disableCore0WDT(); // Disable Core0 Watchdog Timer
    //disableCore1WDT(); // Disable Core1 Watchdog Timer
   
    pinMode(IN_00_PIN, INPUT_PULLUP);
    pinMode(IN_01_PIN, INPUT_PULLUP);
    pinMode(IN_02_PIN, INPUT_PULLUP);
    pinMode(IN_03_PIN, INPUT_PULLUP);
    pinMode(IN_04_PIN, INPUT);
    pinMode(IN_05_PIN, INPUT);
    pinMode(IN_06_PIN, INPUT);
    pinMode(IN_07_PIN, INPUT);
    delay(500);
    Ethernet.init(SPI_CS_PIN); /* You can use Ethernet.init(pin) to configure the CS pin */
    Ethernet.begin(mac, ip); /* start the Ethernet */
    delay(500);
    Udp.begin(port); /* start UDP */
    delay(100);
    xTaskCreatePinnedToCore(
        loop_Core0, // Task function.
        "loopTask_Core0", // name of task.
        1024, // Stack size of task, // Stack size of task
        NULL, // parameter of the task
        0, // priority of the task (changed to 1)
        NULL, // Task handle to keep track of created task
        0); // pin task to core 0
    //disableCore0WDT();
    vTaskDelete(NULL);
}
/*==================================================================*/
void setup()
{
    Serial.begin(9600);
    //disableCore0WDT(); // Disable Core0 Watchdog Timer
    //disableCore1WDT(); // Disable Core1 Watchdog Timer
   
    pinMode(STEP_0_PIN, OUTPUT);
    digitalWrite(STEP_0_PIN, 0);
    pinMode(DIR_0_PIN, OUTPUT);
    digitalWrite(DIR_0_PIN, 0);
    pinMode(STEP_1_PIN, OUTPUT);
    digitalWrite(STEP_1_PIN, 0);
    pinMode(DIR_1_PIN, OUTPUT);
    digitalWrite(DIR_1_PIN, 0);
    pinMode(STEP_2_PIN, OUTPUT);
    digitalWrite(STEP_2_PIN, 0);
    pinMode(DIR_2_PIN, OUTPUT);
    digitalWrite(DIR_2_PIN, 0);
    // Configure the timers
 // Set timer frequency to 1 MHz (1,000,000 Hz)
    stepGen_0 = timerBegin(1000000); // Timer 0
    stepGen_1 = timerBegin(1000000); // Timer 1
    stepGen_2 = timerBegin(1000000); // Timer 2
    // Attach the interrupt service routine (ISR) `onTime_0` to Timer 0.
    timerAttachInterrupt(stepGen_0, &onTime_0);
    // Attach the ISR `onTime_1` to Timer 1.
    timerAttachInterrupt(stepGen_1, &onTime_1);
    // Attach the ISR `onTime_2` to Timer 2.
    timerAttachInterrupt(stepGen_2, &onTime_2);
    // Set the alarm value for Timer 0 to 40,000,000 microseconds (40 seconds).
    timerAlarm(stepGen_0, 40000000, true, 0);
    // Set the alarm value for Timer 1 to 40,000,000 microseconds (40 seconds).
    timerAlarm(stepGen_1, 40000000, true, 0);
    // Set the alarm value for Timer 2 to 40,000,000 microseconds (40 seconds).
    timerAlarm(stepGen_2, 40000000, true, 0);
    // Start Timer 0.
   // timerStart(stepGen_0);
    // Start Timer 1.
  //  timerStart(stepGen_1);
    // Start Timer 2.
  //  timerStart(stepGen_2);
    xTaskCreatePinnedToCore(
        setup_Core0, // Task function.
        "setup_Core0Task", // name of task.
        1024, // Stack size of task
        NULL, // parameter of the task
        0, // priority of the task
        NULL, // Task handle to keep track of created task
        0); // pin task to core 0
    //vTaskDelete(NULL);
}
/*==================================================================*/
void IRAM_ATTR loop()
{
    for (int i = 0; i < 3; i++) {
        if (b_math) {
            Serial.print("Math processing for axis: ");
            Serial.println(i);
            b_math = false;
            if (!ul_accelStep) { // the axis is stationary
                long l_pos_error = cmd.pos - fb.pos;
                Serial.print("Position error for axis ");
                Serial.print(i);
                Serial.print(": ");
                Serial.println(l_pos_error);
                if (l_pos_error) { // if there is a position error
                    if ((l_pos_error > 0 && b_dirSignal == HIGH) || (l_pos_error < 0 && b_dirSignal == LOW)) // the direction is good
                        acceleration(i);
                    else { // need to change direction
                        (l_pos_error > 0) ? b_dirSignal = HIGH : b_dirSignal = LOW;
                        b_dirChange = true;
                        Serial.print("Changing direction for axis ");
                        Serial.println(i);
                    }
                }
            } else { // the axis moves
                Serial.print("Axis ");
                Serial.print(i);
                Serial.println(" is moving");
                if ((cmd.vel > 0.0f && b_dirSignal == HIGH) || (cmd.vel < 0.0f && b_dirSignal == LOW)) { // the direction is good
                    if (ul_T > ul_cmd_T) // the speed is low
                        acceleration(i);
                    else if (ul_T < ul_cmd_T) // the speed is high
                        deceleration(i);
                } else // the direction is wrong or the target speed is zero
                    deceleration(i);
            }
        }
    }
}

But still im getting error as 
ELF file SHA256: 78d5431e5da1b11c

 Rebooting...
�E (123) task_wdt: esp_task_wdt_reset(763): task not found
E (124) task_wdt: esp_task_wdt_reset(763): task not found
E (125) task_wdt: esp_task_wdt_reset(763): task not found
E (173) task_wdt: esp_task_wdt_reset(763): task not found
E (235) task_wdt: esp_task_wdt_reset(763): task not found
E (296) task_wdt: esp_task_wdt_reset(763): task not found
E (358) task_wdt: esp_task_wdt_reset(763): task not found
E (419) task_wdt: esp_task_wdt_reset(763): task not found
E (481) task_wdt: esp_task_wdt_reset(763): task not found
E (542) task_wdt: esp_task_wdt_reset(763): task not found
E (604) task_wdt: esp_task_wdt_reset(763): task not found
Guru Meditation Error: Core 0 panic'ed (Unhandled debug exception).
Debug exception reason: Stack canary watchpoint triggered (setup_Core0Task)
Core 0 register dump:
PC : 0x4008b56c PS : 0x00060a36 A0 : 0x40084766 A1 : 0x3ffb8c90
A2 : 0x00000000 A3 : 0x3ffc1f7c A4 : 0xffffffff A5 : 0x3ffc221c
A6 : 0x00000227 A7 : 0x00000000 A8 : 0x80083ad8 A9 : 0x3ffb8d30
A10 : 0x3ff000dc A11 : 0x00000001 A12 : 0x00060620 A13 : 0x3f407040
A14 : 0x80000000 A15 : 0x00060021 SAR : 0x00000007 EXCCAUSE: 0x00000001
EXCVADDR: 0x00000000 LBEG : 0x400868c0 LEND : 0x400868d6 LCOUNT : 0x00000000

 
 Backtrace: 0x4008b569:0x3ffb8c90 0x40084763:0x3ffb8d70 0x400d4275:0x3ffb8d90 0x400d2e5b:0x3ffb8db0 0x400d1e97:0x3ffb8de0 0x400d1f3c:0x3ffb8e10 0x400d1f9d:0x3ffb8ec0 0x400d1ff0:0x3ffb8f60 0x400d18fd:0x3ffb8fe0 0x4008b1fd:0x3ffb9030

 
  • yathish
  • yathish
25 Jul 2024 08:49
Replied by yathish on topic ESP32 HAL2UDP setup for linux CNC noob.

ESP32 HAL2UDP setup for linux CNC noob.

Category: Computers and Hardware

Even im stuck with this problem can anyone help
  • karoria
  • karoria
25 Jul 2024 07:40
Replied by karoria on topic New interface for small display!

New interface for small display!

Category: Qtvcp

I was looking for similar setup since long. I am waiting for this project to go live for users. Thanks for your efforts.
  • viesturs.lacis
  • viesturs.lacis
25 Jul 2024 07:08
Replied by viesturs.lacis on topic Yaskawa incremental encoder and Mesa 7i48

Yaskawa incremental encoder and Mesa 7i48

Category: Driver Boards

I spent quite a few hours yesterday watching A, B and C lines (as well as rawcounts value) in HalScope and I found a nice pattern there. I have created excel spreadsheet where I tried to draw those graphs with cell boarders and also wrote the rawcounts values at which those transitions take place (basically only transitions are shown, everything in middle is ommited).
docs.google.com/spreadsheets/d/1M04yZmUE...2&rtpof=true&sd=true

I have plotted full revolution of motor shaft, there are 24 transitions (25th is the same as 1st). The pattern repeats 4 times (that is 8 pole motor - 4 electrical revolutions), so pattern is divided in 6 parts of similar length.I should note that difference of rawcounts between 1st and 25th transition is slightly more than expected for 8192 CPR encoder, but I was having realtime errors as I tried to use TightVNC to connect to the LinuxCNC PC from my laptop so that I could see the screen (most importantly - numbers there) while standing near the motor and turning it. But it was so slow on updating screen that I ended running back and forth to the PC anyway.

One more thing - there were several occasions where I noticed strange spikes in C graphs. At first I thought that those are glitches etc, but at one time when I saw it again I tried to catch that place again in HalScope. So I got 3 repetitions and all 3 attempts show a spike there so that makes me think that something similar to index pulse is integrated in C channel (I have attached all three log files for this spike, it is between rawcounts 33658 and 33659, I changed the extension from csv to txt, because adding csv files is not allowed).I did save log files for almost all other transitions as well if that helps (forgot to save 2 or 3 due to lack of concentration as it was around midnight).

Is there any chance to get anything meaningful out of this? I would like to think that this pattern can be used similarly to Hall sensor feedback.

And this thread alone shows that I am not the only one who would had liked to use Yaskawa motors (I have one more machine that will need replacement of at least 2 drives and one previous retrofit that also is not working anymore because of drive faults and would need to be reanimated).
  • jimmyrig
  • jimmyrig
25 Jul 2024 02:10
Replied by jimmyrig on topic Mesa 7i96s + DM556T -> Motors not moving

Mesa 7i96s + DM556T -> Motors not moving

Category: Driver Boards

Stepper online drivers have a 24v and a 5v logic switch at the top. It needs to be 5v for the mesa
  • PCW
  • PCW's Avatar
25 Jul 2024 01:51

Mesa 7i96s + DM556T -> Motors not moving

Category: Driver Boards

DIR0+ would be TB1 pin 5 for example
  • PCW
  • PCW's Avatar
25 Jul 2024 01:26
Replied by PCW on topic RCpwmgen

RCpwmgen

Category: Driver Boards

That should be sufficient

(if your RC-servo has a 1.5 ms center value and 1 ms is -90 degrees and 2 ms is +90 degrees)

 
  • tommylight
  • tommylight's Avatar
25 Jul 2024 01:14
Replied by tommylight on topic Reconfigurar mi LinuxCNC

Reconfigurar mi LinuxCNC

Category: General LinuxCNC Questions

For 32 bit PC, use this image, it has everything to control a machine
www.linuxcnc.org/iso/linuxcnc-2.7.14-wheezy.iso
Or for even older PC
www.linuxcnc.org/iso/ubuntu-10.04-linuxcnc3-i386.iso
Or for really old PC
www.linuxcnc.org/iso/ubuntu-8.04-desktop-emc2-aj13-i386.iso
-
For new PC
www.linuxcnc.org/iso/linuxcnc_2.9.3-amd64.hybrid.iso
-
If you want everything from the software you mentioned, and more, use Ubuntu Studio
ubuntustudio.org/download/
After installing it, in a terminal:
sudo apt update
sudo apt upgrade
sudo apt install linucnc-uspace
This might need also installing a real time kernel, not sure.
  • tommylight
  • tommylight's Avatar
25 Jul 2024 01:04
Replied by tommylight on topic Reconfigurar mi LinuxCNC

Reconfigurar mi LinuxCNC

Category: General LinuxCNC Questions

From google translate:

Hello and apologies for my lack of English. I would say that I have only updated LinuCnc, installed other software, such as kdenlive, which I know may not be the right distro for editing videos, but I wanted to try it more, in fact I make music, I would like to try Ardor, Lmms, among others, with their kernel, obviously, but suddenly, I see that my task manager does not get larger, nor do I see the maximize option, it remains small. If I click, I cannot go down with the mouse, to choose an option, I must do it with the arrows, and press enter, there is no other way and I consider that I must reestablish my LinuxCNC, I do not have any machine connected to my LnuxCnc, which It is installed on a touch netbook, which I love, with its i3, 4 gigabytes of ram and SSD, it has a disabled VGA output, but opening it you can see the internal connections of its internal circuit, I am going to measure its voltages and HDMI.

The GSK 980TDb lathe has a cable with a connection similar to a VGA, but with 2 lines, with only 3 very thin cables that make it up. I mean, in the form of a vga, but more cool, I'll see if I can attach a photo of it, I would like to be able to assemble a thread for that cable and then be able to connect the cnc to my machine, I would love to, I hope you know the lathe and Find some guide, or work done, that you can share with me. I never did it.

_ Another thing I think about is using the latest or stable Freecad, to make the gcode, it is very complete and complex, I like it a lot, what do you think? I know about Inskape, what other options?

_ When I asked for the 32-bit LinuxCNC, which they kindly shared with me, I installed it on 8 very old cpus, IDE disk and 512 megabytes of ddr ram, they turned out beautiful, which I already shared with you, but I can't find the 32-bit Freecad, Do you have it there to share it? If my view of using Freecad is valid, of course.

_ Excuse my extension, I am a newbie to LinuxCNC, obviously you will notice, but I really like this beautiful option, the essential thing is to recover it and not have to install everything again.
When I write to you I see my Firefox, maximized to 3/4 of my entire screen, if I press maximize, it is already full, there is no option, nor minimize, if it closes with its X.

Thank you very much in advance, a great admirer of yours greets you, the LinuxCNC Team, what's more, I have some netbooks from the School, which I am going to install an activated W11, for those who are asleep, and dual boot to install LinuxCNC, 64 bits For me, and those who come down understanding that in Education, if we want real freedom for our students, we must use free software, like LinuxCNC. Very kind!...
Finally, my cell phone does not recognize me, which I connected via USB, as always to my 64-bit LinuxCnc. Pity. I sent my query and if it is possible for you to answer me, I thank you in advance, I will download my photos to another distro, so I can have them on my netbook. Thank you very much again.
  • tommylight
  • tommylight's Avatar
25 Jul 2024 01:01

Please help me with my ground wiring for my sherline lathe - running into issues

Category: Turning

Thank you for your patience, have not seen this in time.
Both drawings are wrong, but not your fault as the whole internet refers to 0V as gnd, and that is wrong for the last 30 or more years. Skipping that...
In short, ground from mains to ground bar, from ground bar to power supply, another one from bar to motor frame or motor ground wire, encoder shield to ground bar. No more.
If you have betetr quality drives, use only two wires for step and two for dir, wire step+ to step/pulse+ and step- to step/pulse-, same for dir pins.
  • MaHa
  • MaHa
25 Jul 2024 00:56
Replied by MaHa on topic Subrouting Path - no effect

Subrouting Path - no effect

Category: AXIS

I can tell only from my experience, i set SUBROUTINE_PATH and USER_M_PATH in [RS274NGC] section.
  • tommylight
  • tommylight's Avatar
25 Jul 2024 00:47
Replied by tommylight on topic MesaCT Please add Plasma I/O

MesaCT Please add Plasma I/O

Category: Advanced Configuration

Maybe should have posted in one of the JT's MesaCT topics, seems he has not seen this.
  • tommylight
  • tommylight's Avatar
25 Jul 2024 00:44
Replied by tommylight on topic Subrouting Path - no effect

Subrouting Path - no effect

Category: AXIS

Fixed the tittle, it was "patch", threw me off.
-
Not sure, but i think subroutines should be set executable in permissions.
Displaying 22051 - 22065 out of 26353 results.
Time to create page: 3.531 seconds
Powered by Kunena Forum