SOEM icon indicating copy to clipboard operation
SOEM copied to clipboard

SDO read fails on retries

Open open04 opened this issue 8 months ago • 3 comments

I created separate function for reading / writing SDOs in which I added retries. Here's a snippet of my code:

    while(0 < n_retries)
    {
      if(ec_SDOread(slv_num, idx_num, subidx_num, FALSE, &size, &value, EC_TIMEOUTRXM) > 0)
      {
        printf(" Success");
        break;
      }
      n_retries_--;
      printf(" Retry");
    }

Most of the time, ec_SDOread is success (no need for retries), but there are times where it fails (It retries to SDOread but always fails, I tested to make n_retries value to 200 and it still fails. Also, increasing the timeout doesnt help either).

Here is the log on Wireshark: (start is 7620th frame) usdo_ret200_.zip

Now, my solution is to have delay every retries:

    while(0 < n_retries)
    {
      if(ec_SDOread(slv_num, idx_num, subidx_num, FALSE, &size, &value, EC_TIMEOUTRXM) > 0)
      {
        printf(" Success");
        break;
      }
      n_retries_--;
      osal_usleep(10000);
      printf("Retry");
    }

which works well, and I dont know why. Does SDO also needs synchronization?

open04 avatar Jun 18 '24 08:06 open04