[etherlab-users] "Invalid mailbox configuration", how to configure?

Stefan Löfgren stlo at dontdownload.com
Mon Mar 17 09:46:30 CET 2008


Thank you Florian,

yes, I was looking at that FAQ and it helped me a bit.
But only to varify that this slave does not seem follow that.
So, I made a "quick fix" to this problem in "slave.c" (see below).
I added a possibility for max 10 SMs the first time and then added new to the
list. Note that there is no protection against adding more than 10.
Easy, not the perfect sollution, but it's working so far.

I also had to fill out the offset and size of the mailbox manually 
since it was all zeros in eeprom.

Now, the problem with PDO setup starts,
more about that's in the next thread...

...to be continued...   ;)

And btw, thanks for a very nice EtherCAT library! Great job!
I hope I can contribute to it later on when I have more knowledge about it...

/Stefan


My modified code (master/slave.c taken from ver 1.3.2):

int ec_slave_fetch_sii_syncs(
        ec_slave_t *slave, /**< EtherCAT slave */
        const uint8_t *data, /**< category data */
        size_t data_size /**< number of bytes */
        )
{
    unsigned int i;
    ec_sync_t *sync;
    size_t memsize;

    unsigned int j; // STLO

    // one sync manager struct is 4 words long
    if (data_size % 8) {
        EC_ERR("Invalid SII sync manager size %u in slave %u.\n",
                data_size, slave->ring_position);
        return -1;
    }

//    slave->sii_sync_count = data_size / 8; // STLO
    j = data_size / 8;  // STLO

    if (!slave->sii_syncs) // STLO
    {
      memsize = sizeof(ec_sync_t) * 10; // slave->sii_sync_count; STLO
      if (!(slave->sii_syncs = kmalloc(memsize, GFP_KERNEL))) {
          EC_ERR("Failed to allocate %u bytes for sync managers.\n",
                  memsize);
          slave->sii_sync_count = 0;
          return -1;
      }
    }

    for (i = 0; i < j; i++, data += 8) { // STLO
        sync = &slave->sii_syncs[slave->sii_sync_count+i]; // STLO

        ec_sync_init(sync, slave, slave->sii_sync_count+i); // STLO
        sync->physical_start_address = EC_READ_U16(data);
        sync->length = EC_READ_U16(data + 2);
        sync->control_register = EC_READ_U8 (data + 4);
        sync->enable = EC_READ_U8 (data + 6);
    }
    slave->sii_sync_count += j; // STLO

    return 0;
}








---------- Original Message -----------
From: Florian Pose <fp at igh-essen.com>
To: etherlab-users at lists.etherlab.org
Sent: Mon, 17 Mar 2008 09:12:28 +0100
Subject: Re: [etherlab-users] "Invalid mailbox configuration", how to	configure?

> Hi Stefan,
> 
> On Thu, Mar 13, 2008 at 09:50:32PM +0100, Stefan Löfgren wrote:
> > Looking at "ec_slave_fetch_sii_syncs" in "slave.c"...
> > This function needs all the SMs in a long row?
> > This slave's eeprom will produce 4 calls to this function and
> > allocate the syncs 4 times and ending up with only one sync left!?!?
> 
> this is the first time that I hear from a slave that lists the same
> category (0x0029, SyncManager) 4 times to describe 4 sync managers,
> instead of putting all 4 Sm's in one category. But this is perfectly
> valid, I think.
> 
> The reason for your problem is, that the master expects only one
> Sync manager category and sets the number of sync managers according 
> to the last category it sees. Instead, the master should allow multiple
> sync manager categories and add the specified sync managers, every time
> it reads a category. I'll fix this for the next release.
> 
> Maybe the following FAQ entry is useful to you in the meantime:
> 
> http://etherlab.org/en/ethercat/faq.php#incomplete-sii
> 
> or
> 
> http://etherlab.org/de/ethercat/faq.php#incomplete-sii
> 
> -- 
> Best regards,
> Florian Pose
> 
> http://etherlab.org
> _______________________________________________
> etherlab-users mailing list
> etherlab-users at lists.etherlab.org
> http://lists.etherlab.org/mailman/listinfo/etherlab-users
------- End of Original Message -------




More information about the Etherlab-users mailing list