Boss lady
Boss lady
DIIDevHeads IoT Integration Server
Created by Boss lady on 7/8/2024 in #code-review
Resolving "No EtherCAT Slaves Found" Error on BeagleBone AI with Embedded Linux
hey guys, am developing a real-time industrial control system using a BeagleBone AI with Embedded Linux. The system should read data from an EtherCAT torque sensor. I have verified the EtherCAT slave connection and settings, checked the network interface and cable connections, made sure the EtherCAT library is correctly installed and configured. But am getting the error No EtherCAT slaves found. this is my code
#include <stdio.h>
#include <ethercat.h>

int main() {
if (ec_init("eth0") <= 0) {
fprintf(stderr, "Failed to initialize EtherCAT\n");
return 1;
}

if (ec_config_init(FALSE) <= 0) {
fprintf(stderr, "No EtherCAT slaves found\n");
ec_close();
return 1;
}

ec_config_map(&IOmap);
ec_configdc();

while (1) {
ec_send_processdata();
ec_receive_processdata(EC_TIMEOUTRET);

int torque = ec_slave[1].inputs[0];
printf("Torque: %d\n", torque);
usleep(500000);
}

ec_close();
return 0;
}
#include <stdio.h>
#include <ethercat.h>

int main() {
if (ec_init("eth0") <= 0) {
fprintf(stderr, "Failed to initialize EtherCAT\n");
return 1;
}

if (ec_config_init(FALSE) <= 0) {
fprintf(stderr, "No EtherCAT slaves found\n");
ec_close();
return 1;
}

ec_config_map(&IOmap);
ec_configdc();

while (1) {
ec_send_processdata();
ec_receive_processdata(EC_TIMEOUTRET);

int torque = ec_slave[1].inputs[0];
printf("Torque: %d\n", torque);
usleep(500000);
}

ec_close();
return 0;
}
@Middleware & OS
14 replies