[etherlab-users] AL status message 0x001B: "Sync manager watchdog" error with digital output module
jiangjiang kai
kaikaijiang at hotmail.com
Sat Nov 3 08:24:53 CET 2018
Dear all,
I have tried to bring up the Omron ethercat coupler with some digital inputs and outputs modules. With the help of the example code I can read out the value from digital input modules. But with the digital output module, I always get the error msg: "AL status message 0x001B: "Sync manager watchdog"."
I have read some messages from the other users, it looks like that related to the settings of SM2 sync manager watchdog, and I have tried to do "PDO writting" in each cycle time. But I still get this error. Maybe some one can help me with this.
Thanks in advance.
Below is the code which is based on the "user" sample code and some debug Info:
(1) PDO structure
[developer:~]$ sudo ethercat cstruct 18:17
[sudo] password for developer:
/* Master 0, Slave 0, "NX-ECC201"
* Vendor ID: 0x00000083
* Product code: 0x00000083
* Revision number: 0x00010002
*/
ec_pdo_entry_info_t slave_0_pdo_entries[] = {
{0x7000, 0x01, 1},
{0x7000, 0x02, 1},
{0x7000, 0x03, 1},
{0x7000, 0x04, 1},
{0x0000, 0x00, 12}, /* Gap */
{0x3003, 0x04, 128},
{0x3006, 0x04, 128},
{0x300a, 0x02, 64},
{0x2002, 0x01, 8},
{0x0000, 0x00, 8}, /* Gap */
};
ec_pdo_info_t slave_0_pdos[] = {
{0x1600, 4, slave_0_pdo_entries + 0},
{0x17f6, 1, slave_0_pdo_entries + 4},
{0x1bf8, 3, slave_0_pdo_entries + 5},
{0x1bff, 1, slave_0_pdo_entries + 8},
{0x1bf4, 1, slave_0_pdo_entries + 9},
};
ec_sync_info_t slave_0_syncs[] = {
{0, EC_DIR_OUTPUT, 0, NULL, EC_WD_DISABLE},
{1, EC_DIR_INPUT, 0, NULL, EC_WD_DISABLE},
{2, EC_DIR_OUTPUT, 2, slave_0_pdos + 0, EC_WD_ENABLE},
{3, EC_DIR_INPUT, 3, slave_0_pdos + 2, EC_WD_DISABLE},
{0xff}
};
********************************************************
[developer:~]$ sudo ethercat pdos 18:19
SM0: PhysAddr 0x2800, DefaultSize 256, ControlRegister 0x26, Enable 1
SM1: PhysAddr 0x2a00, DefaultSize 256, ControlRegister 0x22, Enable 1
SM2: PhysAddr 0x1000, DefaultSize 0, ControlRegister 0x64, Enable 1
RxPDO 0x1600 ""
PDO entry 0x7000:01, 1 bit, ""
PDO entry 0x7000:02, 1 bit, ""
PDO entry 0x7000:03, 1 bit, ""
PDO entry 0x7000:04, 1 bit, ""
RxPDO 0x17f6 ""
PDO entry 0x0000:00, 12 bit, "Gap"
SM3: PhysAddr 0x1c00, DefaultSize 0, ControlRegister 0x20, Enable 1
TxPDO 0x1bf8 ""
PDO entry 0x3003:04, 128 bit, ""
PDO entry 0x3006:04, 128 bit, ""
PDO entry 0x300a:02, 64 bit, ""
TxPDO 0x1bff ""
PDO entry 0x2002:01, 8 bit, ""
TxPDO 0x1bf4 ""
PDO entry 0x0000:00, 8 bit, "Gap"
/*****************************************************************************/
/*****************************************************************************/
(2) The code:
#include <errno.h>
#include <signal.h>
#include <stdio.h>
#include <string.h>
#include <sys/resource.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#include <time.h> /* clock_gettime() */
#include <sys/mman.h> /* mlockall() */
#include <sched.h> /* sched_setscheduler() */
#include "ecrt.h"
/** Task period in ns. */
#define PERIOD_NS (5000000) // 5ms
#define MAX_SAFE_STACK (8 * 1024) /* The maximum stack size which is
guranteed safe to access without
faulting */
/****************************************************************************/
/* Constants */
#define NSEC_PER_SEC (1000000000)
#define FREQUENCY (NSEC_PER_SEC / PERIOD_NS)
/****************************************************************************/
// EtherCAT
static ec_master_t *master = NULL;
static ec_master_state_t master_state = {};
static ec_domain_t *domain1 = NULL;
static ec_domain_state_t domain1_state = {};
static ec_slave_config_t *sc_digit_out = NULL;
static ec_slave_config_state_t sc_digit_out_state = {};
/****************************************************************************/
// process data
static uint8_t *domain1_pd = NULL;
#define BusCouplerPos 0, 0
#define DigOutSlavePos 0, 1
#define OMRON_ECC201 0x00000083, 0x00000083 //Omron ethercat coupler
#define OMRON_OD3256 0x00000001, 0x00133256 //Omron (4) digital output
// offsets for PDO entries
static unsigned int off_dig_out;
static unsigned int off_dig_out_bit0;
static unsigned int off_dig_out_bit1;
static unsigned int off_dig_out_bit2;
static unsigned int off_dig_out_bit3;
// ------- output of "ethercat pdos" -------------
///* Master 0, Slave 0, "NX-ECC201"
// * Vendor ID: 0x00000083
// * Product code: 0x00000083
// * Revision number: 0x00010002
// */
//ec_pdo_entry_info_t slave_0_pdo_entries[] = {
//this is from the digital output
// {0x7000, 0x01, 1},
// {0x7000, 0x02, 1},
// {0x7000, 0x03, 1},
// {0x7000, 0x04, 1},
// {0x0000, 0x00, 12}, /* Gap */
// {0x3003, 0x04, 128},
// {0x3006, 0x04, 128},
// {0x300a, 0x02, 64},
// {0x2002, 0x01, 8},
// {0x0000, 0x00, 8}, /* Gap */
//};
//ec_pdo_info_t slave_0_pdos[] = {
// {0x1600, 4, slave_0_pdo_entries + 0},
// {0x17f6, 1, slave_0_pdo_entries + 4},
// {0x1bf8, 3, slave_0_pdo_entries + 5},
// {0x1bff, 1, slave_0_pdo_entries + 8},
// {0x1bf4, 1, slave_0_pdo_entries + 9},
//};
//ec_sync_info_t slave_0_syncs[] = {
// {0, EC_DIR_OUTPUT, 0, NULL, EC_WD_DISABLE},
// {1, EC_DIR_INPUT, 0, NULL, EC_WD_DISABLE},
// {2, EC_DIR_OUTPUT, 2, slave_0_pdos + 0, EC_WD_ENABLE},
// {3, EC_DIR_INPUT, 3, slave_0_pdos + 2, EC_WD_DISABLE}, //There are 2 output here, but one looks like the "Gap"
// {0xff}
//};
const static ec_pdo_entry_reg_t domain1_regs[] = {
// 4 ditig output
{0, 1, OMRON_OD3256, 0x7000, 0x01, &off_dig_out, &off_dig_out_bit0},
{0, 1, OMRON_OD3256, 0x7000, 0x02, &off_dig_out, &off_dig_out_bit1},
{0, 1, OMRON_OD3256, 0x7000, 0x03, &off_dig_out, &off_dig_out_bit2},
{0, 1, OMRON_OD3256, 0x7000, 0x04, &off_dig_out, &off_dig_out_bit3},
{}
};
static unsigned int counter = 0;
static unsigned int blink = 0;
/*****************************************************************************/
// Digital out ------------------------
static ec_pdo_entry_info_t oc3256_channels[] = {
{0x7000, 0x01, 1}, // Value 1
{0x7000, 0x02, 1}, // Value 2
{0x7000, 0x03, 1}, // Value 3
{0x7000, 0x04, 1} // Value 4
};
static ec_pdo_info_t oc3256_pdos[] = {
{0x1600, 4, oc3256_channels + 0}
};
static ec_sync_info_t oc3256_syncs[] = {
{2, EC_DIR_OUTPUT, 1, oc3256_pdos, EC_WD_ENABLE} // I am using only one output here, as the other one looks like just a (12 bit) "Gap"
};
/*****************************************************************************/
void check_domain1_state(void)
{
ec_domain_state_t ds;
ecrt_domain_state(domain1, &ds);
if (ds.working_counter != domain1_state.working_counter) {
printf("Domain1: WC %u.\n", ds.working_counter);
}
if (ds.wc_state != domain1_state.wc_state) {
printf("Domain1: State %u.\n", ds.wc_state);
}
domain1_state = ds;
}
/*****************************************************************************/
void check_master_state(void)
{
ec_master_state_t ms;
ecrt_master_state(master, &ms);
if (ms.slaves_responding != master_state.slaves_responding) {
printf("%u slave(s).\n", ms.slaves_responding);
}
if (ms.al_states != master_state.al_states) {
printf("AL states: 0x%02X.\n", ms.al_states);
}
if (ms.link_up != master_state.link_up) {
printf("Link is %s.\n", ms.link_up ? "up" : "down");
}
master_state = ms;
}
/*****************************************************************************/
void check_slave_config_states(void)
{
ec_slave_config_state_t s;
ecrt_slave_config_state(sc_digit_out, &s);
if (s.al_state != sc_digit_out_state.al_state) {
printf("DigitalOutput: State 0x%02X.\n", s.al_state);
}
if (s.online != sc_digit_out_state.online) {
printf("DigitalOutput: %s.\n", s.online ? "online" : "offline");
}
if (s.operational != sc_digit_out_state.operational) {
printf("DigitalOutput: %soperational.\n", s.operational ? "" : "Not ");
}
sc_digit_out_state = s;
}
/*****************************************************************************/
void cyclic_task()
{
// receive process data
ecrt_master_receive(master);
ecrt_domain_process(domain1);
// check process data state
check_domain1_state();
if (counter) {
counter--;
} else { // do this at 1 Hz
counter = FREQUENCY;
// calculate new process data
blink = !blink;
// check for master state (optional)
check_master_state();
// check for slave configuration state(s) (optional)
check_slave_config_states();
}
// write process data
EC_WRITE_U8(domain1_pd + off_dig_out, 0x06); //write some value to digital output
// send process data
ecrt_domain_queue(domain1);
ecrt_master_send(master);
}
/****************************************************************************/
void stack_prefault(void)
{
unsigned char dummy[MAX_SAFE_STACK];
memset(dummy, 0, MAX_SAFE_STACK);
}
/****************************************************************************/
int main(int argc, char **argv)
{
ec_slave_config_t *sc;
struct timespec wakeup_time;
int ret = 0;
master = ecrt_request_master(0);
if (!master) {
return -1;
}
domain1 = ecrt_master_create_domain(master);
if (!domain1) {
return -1;
}
if (!(sc_digit_out = ecrt_master_slave_config(
master, DigOutSlavePos, OMRON_OD3256))) {
fprintf(stderr, "Failed to get slave configuration.\n");
return -1;
}
// ----- I am using 1 as the argument, as one entry is in the oc3256_syncs, not sure if this is correct -----
if (ecrt_slave_config_pdos(sc_digit_out, 1, oc3256_syncs)) {
fprintf(stderr, "Failed to configure PDOs.\n");
return -1;
}
// Create configuration for bus coupler
sc = ecrt_master_slave_config(master, BusCouplerPos, OMRON_ECC201);
if (!sc) {
return -1;
}
if (ecrt_domain_reg_pdo_entry_list(domain1, domain1_regs)) {
fprintf(stderr, "PDO entry registration failed!\n");
return -1;
}
printf("Activating master...\n");
if (ecrt_master_activate(master)) {
return -1;
}
if (!(domain1_pd = ecrt_domain_data(domain1))) {
return -1;
}
/* Set priority */
struct sched_param param = {};
param.sched_priority = sched_get_priority_max(SCHED_FIFO);
printf("Using priority %i.", param.sched_priority);
if (sched_setscheduler(0, SCHED_FIFO, ¶m) == -1) {
perror("sched_setscheduler failed");
}
/* Lock memory */
if (mlockall(MCL_CURRENT | MCL_FUTURE) == -1) {
fprintf(stderr, "Warning: Failed to lock memory: %s\n",
strerror(errno));
}
stack_prefault();
printf("Starting RT task with dt=%u ns.\n", PERIOD_NS);
clock_gettime(CLOCK_MONOTONIC, &wakeup_time);
wakeup_time.tv_sec += 1; /* start in future */
wakeup_time.tv_nsec = 0;
while (1) {
ret = clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME,
&wakeup_time, NULL);
if (ret) {
fprintf(stderr, "clock_nanosleep(): %s\n", strerror(ret));
break;
}
cyclic_task();
wakeup_time.tv_nsec += PERIOD_NS;
while (wakeup_time.tv_nsec >= NSEC_PER_SEC) {
wakeup_time.tv_nsec -= NSEC_PER_SEC;
wakeup_time.tv_sec++;
}
}
return ret;
}
/*****************************************************************************/
/*****************************************************************************/
(3) Output of the debug msg:
[Nov 2 17:55] EtherCAT: Requesting master 0...
[ +0,000004] EtherCAT DEBUG 0: IDLE -> OPERATION.
[ +0,000001] EtherCAT: Successfully requested master 0.
[ +0,000003] EtherCAT DEBUG 0: ecrt_master_create_domain(master = 0xffff88043e88e000)
[ +0,000001] EtherCAT DEBUG 0: Created domain 0.
[ +0,000003] EtherCAT DEBUG 0: ecrt_master_slave_config(master = 0xffff88043e88e000, alias = 0, position = 1, vendor_id = 0x00000001, product_code = 0x00133256)
[ +0,000002] EtherCAT DEBUG 0: Creating slave configuration for 0:1, 0x00000001/0x00133256.
[ +0,000051] EtherCAT DEBUG 0 0:1: Failed to find slave for configuration.
[ +0,000006] EtherCAT DEBUG 0 0:1: ecrt_slave_config_sync_manager(sc = 0xffff88043d40e000, sync_index = 3, dir = 1, watchdog_mode = 1)
[ +0,000004] EtherCAT DEBUG 0 0:1: ecrt_slave_config_pdo_assign_clear(sc = 0xffff88043d40e000, sync_index = 3)
[ +0,000004] EtherCAT DEBUG 0 0:1: ecrt_slave_config_pdo_assign_add(sc = 0xffff88043d40e000, sync_index = 3, pdo_index = 0x1600)
[ +0,000005] EtherCAT DEBUG 0 0:1: ecrt_slave_config_pdo_mapping_clear(sc = 0xffff88043d40e000, pdo_index = 0x1600)
[ +0,000004] EtherCAT DEBUG 0 0:1: ecrt_slave_config_pdo_mapping_add(sc = 0xffff88043d40e000, pdo_index = 0x1600, entry_index = 0x7000, entry_subindex = 0x01, entry_bit_length = 1)
[ +0,000005] EtherCAT DEBUG 0 0:1: ecrt_slave_config_pdo_mapping_add(sc = 0xffff88043d40e000, pdo_index = 0x1600, entry_index = 0x7000, entry_subindex = 0x02, entry_bit_length = 1)
[ +0,000012] EtherCAT DEBUG 0 0:1: ecrt_slave_config_pdo_mapping_add(sc = 0xffff88043d40e000, pdo_index = 0x1600, entry_index = 0x7000, entry_subindex = 0x03, entry_bit_length = 1)
[ +0,000007] EtherCAT DEBUG 0 0:1: ecrt_slave_config_pdo_mapping_add(sc = 0xffff88043d40e000, pdo_index = 0x1600, entry_index = 0x7000, entry_subindex = 0x04, entry_bit_length = 1)
[ +0,000005] EtherCAT DEBUG 0: ecrt_master_slave_config(master = 0xffff88043e88e000, alias = 0, position = 0, vendor_id = 0x00000083, product_code = 0x00000083)
[ +0,000003] EtherCAT DEBUG 0: Creating slave configuration for 0:0, 0x00000083/0x00000083.
[ +0,000007] EtherCAT DEBUG 0 0:0: Attached slave 0.
[ +0,000009] EtherCAT DEBUG 0: ecrt_master_slave_config(master = 0xffff88043e88e000, alias = 0, position = 1, vendor_id = 0x00000001, product_code = 0x00133256)
[ +0,000005] EtherCAT DEBUG 0 0:1: ecrt_slave_config_reg_pdo_entry(sc = 0xffff88043d40e000, index = 0x7000, subindex = 0x01, domain = 0xffff8803d0b6e980, bit_position = 0xffff88008a803d6c)
[ +0,000003] EtherCAT DEBUG 0: Domain 0: Added 1 bytes, total 1.
[ +0,000004] EtherCAT DEBUG 0: ecrt_master_slave_config(master = 0xffff88043e88e000, alias = 0, position = 1, vendor_id = 0x00000001, product_code = 0x00133256)
[ +0,000003] EtherCAT DEBUG 0 0:1: ecrt_slave_config_reg_pdo_entry(sc = 0xffff88043d40e000, index = 0x7000, subindex = 0x02, domain = 0xffff8803d0b6e980, bit_position = 0xffff88008a803d6c)
[ +0,000004] EtherCAT DEBUG 0: ecrt_master_slave_config(master = 0xffff88043e88e000, alias = 0, position = 1, vendor_id = 0x00000001, product_code = 0x00133256)
[ +0,000005] EtherCAT DEBUG 0 0:1: ecrt_slave_config_reg_pdo_entry(sc = 0xffff88043d40e000, index = 0x7000, subindex = 0x03, domain = 0xffff8803d0b6e980, bit_position = 0xffff88008a803d6c)
[ +0,000003] EtherCAT DEBUG 0: ecrt_master_slave_config(master = 0xffff88043e88e000, alias = 0, position = 1, vendor_id = 0x00000001, product_code = 0x00133256)
[ +0,000005] EtherCAT DEBUG 0 0:1: ecrt_slave_config_reg_pdo_entry(sc = 0xffff88043d40e000, index = 0x7000, subindex = 0x04, domain = 0xffff8803d0b6e980, bit_position = 0xffff88008a803d6c)
[ +0,000034] EtherCAT DEBUG 0: ecrt_domain_external_memory(domain = 0xffff8803d0b6e980, mem = 0xffffc90002da5000)
[ +0,000004] EtherCAT DEBUG 0: ecrt_master_callbacks(master = 0xffff88043e88e000, send_cb = 0xffffffffc078dbe0, receive_cb = 0xffffffffc078c240, cb_data = 0xffff88043e88e000)
[ +0,000003] EtherCAT DEBUG 0: ecrt_master_activate(master = 0xffff88043e88e000)
[ +0,000003] EtherCAT DEBUG 0: Adding datagram pair with expected WC 1.
[ +0,000002] EtherCAT 0: Domain0: Logical address 0x00000000, 1 byte, expected working counter 1.
[ +0,000004] EtherCAT 0: Datagram domain0-0-main: Logical offset 0x00000000, 1 byte, type LWR.
[ +0,000002] EtherCAT DEBUG 0: Stopping master thread.
[ +0,000006] EtherCAT DEBUG 0: Master IDLE thread exiting...
[ +0,000010] EtherCAT 0: Master thread exited.
[ +0,000002] EtherCAT DEBUG 0: FSM datagram is ffff88043e88e678.
[ +0,000002] EtherCAT 0: Starting EtherCAT-OP thread.
[ +0,000442] EtherCAT DEBUG 0: Operation thread running with fsm interval = 4000 us, max data size=45000
[ +0,000005] EtherCAT DEBUG 0: mmap()
[ +0,000004] EtherCAT DEBUG 0: Vma fault, offset = 0, page = ffffea000f406dc0
[ +0,959383] EtherCAT DEBUG 0: Configuration changed (aborting state check).
[ +0,000003] EtherCAT WARNING 0: No app_time received up to now, but master already active.
[ +0,000001] EtherCAT DEBUG 0: Requesting OP...
[ +0,007980] EtherCAT DEBUG 0-0: Changing state from PREOP to OP.
[ +0,000003] EtherCAT DEBUG 0-0: Configuring...
[ +0,002970] EtherCAT DEBUG 0-0: Now in INIT.
[ +0,000002] EtherCAT DEBUG 0-0: Clearing FMMU configurations...
[ +0,002008] EtherCAT DEBUG 0-0: Clearing sync manager configurations...
[ +0,002004] EtherCAT DEBUG 0-0: Clearing DC assignment...
[ +0,001076] EtherCAT DEBUG 0-0: Configuring mailbox sync managers...
[ +0,000006] EtherCAT DEBUG 0-0: SM0: Addr 0x2800, Size 256, Ctrl 0x26, En 1
[ +0,000003] EtherCAT DEBUG 0-0: SM1: Addr 0x2A00, Size 256, Ctrl 0x22, En 1
[ +0,001910] EtherCAT DEBUG 0-0: Assigning SII access to PDI.
[ +0,345003] EtherCAT DEBUG 0-0: Now in PREOP.
[ +0,000003] EtherCAT DEBUG 0-0: Assigning SII access back to EtherCAT.
[ +0,002005] EtherCAT DEBUG 0-0: SM2: Addr 0x1000, Size 2, Ctrl 0x64, En 1
[ +0,000003] EtherCAT DEBUG 0-0: SM3: Addr 0x1C00, Size 42, Ctrl 0x20, En 1
[ +0,021987] EtherCAT DEBUG 0-0: Now in SAFEOP.
[ +0,007001] EtherCAT DEBUG 0-0: Now in OP. Finished configuration.
[ +0,002024] EtherCAT 0: Slave states on main device: OP.
[ +0,107984] EtherCAT DEBUG 0-0: OP -> SAFEOP + ERROR.
[ +0,001971] EtherCAT ERROR 0-0: AL status message 0x001B: "Sync manager watchdog". //error
[ +0,003999] EtherCAT 0-0: Acknowledged state SAFEOP.
[ +0,000003] EtherCAT DEBUG 0-0: Changing state from SAFEOP to OP.
[ +0,000002] EtherCAT DEBUG 0-0: Configuring...
[ +0,246996] EtherCAT DEBUG 0-0: Now in INIT.
[ +0,000003] EtherCAT DEBUG 0-0: Clearing FMMU configurations...
[ +0,001996] EtherCAT DEBUG 0-0: Clearing sync manager configurations...
[ +0,002001] EtherCAT DEBUG 0-0: Clearing DC assignment...
[ +0,001998] EtherCAT DEBUG 0-0: Configuring mailbox sync managers...
[ +0,000003] EtherCAT DEBUG 0-0: SM0: Addr 0x2800, Size 256, Ctrl 0x26, En 1
[ +0,000003] EtherCAT DEBUG 0-0: SM1: Addr 0x2A00, Size 256, Ctrl 0x22, En 1
[ +0,002000] EtherCAT DEBUG 0-0: Assigning SII access to PDI.
[ +0,327996] EtherCAT DEBUG 0-0: Now in PREOP.
[ +0,000004] EtherCAT DEBUG 0-0: Assigning SII access back to EtherCAT.
[ +0,002003] EtherCAT DEBUG 0-0: SM2: Addr 0x1000, Size 2, Ctrl 0x64, En 1
[ +0,000002] EtherCAT DEBUG 0-0: SM3: Addr 0x1C00, Size 42, Ctrl 0x20, En 1
[ +0,020989] EtherCAT DEBUG 0-0: Now in SAFEOP.
[ +0,007003] EtherCAT DEBUG 0-0: Now in OP. Finished configuration.
[ +0,109038] EtherCAT 0: Slave states on main device: SAFEOP + ERROR.
[ +0,004009] EtherCAT DEBUG 0-0: OP -> SAFEOP + ERROR.
[ +0,001970] EtherCAT ERROR 0-0: AL status message 0x001B: "Sync manager watchdog". //error
[ +0,004001] EtherCAT 0-0: Acknowledged state SAFEOP.
Best, Kai
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.etherlab.org/pipermail/etherlab-users/attachments/20181103/10ab2e0f/attachment-0002.htm>
More information about the Etherlab-users
mailing list