This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM335x EtherCAT mailbox size

Other Parts Discussed in Thread: SYSBIOS

Hi all!

I'm developing an ethernet over ethercat application, and I should expand the mailbox max data size to speedup the throughput.

I've foud this #define in ecat_def.h:

#define MAX_MBX_SIZE                              0x0100

I've changed that value to 0x1000 (4Kbytes instead of 256bytes), recompiled and downloaded to the cpu.

Unfortunately the master can't step further than PREOP state;

after a couple of second from INIT to PREOP state change, the ethercat master says: "Timeout: eoe init":

Is there any limitation on MAX_MBX_SIZE?

What am I missing?

  • Hi Eugenio,

    Please provide details about HW and SW platforms that you use.

  • Hi.

    I'm testing this feature in:

    • ICE demoboard rev. 1.0A
    • CCS  v5.4.0.00091 
    • SDK am335x_sysbios_ind_sdk_1.0.0.6
    • SYS/BIOS 6.35.4.50
    • XDC 3.25.0.48

    I've double checked Ethercat ESC documentation and:

    1. Mailbox address space is bounded to 0x1000 - 0x3000 range;
    2. ET1100 (and PRUSS implementation too, I wonder) has 8Kbytes RAM for mailbox in, out and process data.
    3. ESI EEPROM contains RX and TX mailbox size and address registers:

    The problem is that doing all the needed modifications to the eeprom data and mailbox configuration macros I can't get it working properly: master hangs in PREOP state and "timeout: eoe_init" error occurs.

  • Eugenio,

    as a first step you should upgrade to the latest IA-SDK 1.1.0.5. Many issues have been fixed since the release you are using.

    Make sure you apply the required environment (CCS, SYSBIOS, XDC) for this release. See the release notes please for details.

    Regards,

  • Eugenio,

    On the default application, SMs are located in 0x1000, 0x1400, 0x1800 and 0x2000, so mailboxes (the first two SM locations) are restricted to 0x400 or 1024 bytes. Relocating the input mail box from 0x1400 to 0x2000, we were able to use mail box sizes until 1484 -- for an on-wire frame size of 1512.

  • eugenio said:

    I'm developing an ethernet over ethercat application, and I should expand the mailbox max data size to speedup the throughput.

    I've foud this #define in ecat_def.h:

    #define MAX_MBX_SIZE                              0x0100

    I've changed that value to 0x1000 (4Kbytes instead of 256bytes), recompiled and downloaded to the cpu.

    Unfortunately the master can't step further than PREOP state;

    after a couple of second from INIT to PREOP state change, the ethercat master says: "Timeout: eoe init":

    Max ethernet frame size supported is 1518 bytes without VLAN including CRC. So you can't create a mailbox datagram exceeding this limit...

    For EoE limitations, please refer to SSC application note/SSC source code from Beckhoff

    eugenio said:

    Is there any limitation on MAX_MBX_SIZE?

    It is limited by total process data memory available (8KB for AM335x), data memory used for process data SM2, SM3,... ,SM7, then maximum ethercat frame size supported, Maximum frame size of masters like TwinCAT supports

  • Hi.

    Thank you for your reply. I've done some further testing and now I can confirm that you can grow mailbox size until a frame is entirely occupied by mailbox data.

    I've also discovered some kind of hyperbolic relation between mailbox size and transfer rate:

    • small mailbox size (less than 64 bytes) --> poor data rate, maybe caused by protocol overhead;
    • sensible mailbox size (somewhat between 64 and 256 bytes) --> every increase in size leads to increase in data rate;
    • large mailbox size (over 256 byte) --> no practical advantage in data rate.

    So a good general purpose value could be 128 or 256 bytes.

  • Eugenio,

    Did this story had a happy end?
    What was the solution that allow TwinCAT proceed beyond PREOP?
    I face the same error message now.

    Isaac
  • Yes, it's been a long time ago!

    The max mailbox size cannot exceed the length of an ethernet packet minus:

    • ancillary ethernet and ethercat stuff
    • cyclic data size

    Also, max mailbox size defined in ecat_def.h should match the value defined in ESC eeprom (tiesc_eeprom array in tiesc_eeprom.h).

    These are the values working for me:

    /* MIN_PD_WRITE_ADDRESS: Minimum address for the process output data (Sync Manager 2)
    inside the application memory of the EtherCAT Slave Controller which could be set by the master. The setting have to be within the ranges of the user memory of the ESC (this is not checked by the tool). */
    #define MIN_PD_WRITE_ADDRESS                      0x1000
    
    /* MAX_PD_WRITE_ADDRESS: Maximum address for the process output data (Sync Manager 2)
    inside the application memory of the EtherCAT Slave Controller which could be set by the master. The setting have to be within the ranges of the user memory of the ESC (this is not checked by the tool). */
    #define MAX_PD_WRITE_ADDRESS                      0x3000
    
    /* MIN_PD_READ_ADDRESS: Minimum address for the process input data (Sync Manager 3)
    inside the application memory of the EtherCAT Slave Controller which could be set by the master. The setting have to be within the ranges of the user memory of the ESC (this is not checked by the tool). */
    #define MIN_PD_READ_ADDRESS                       0x1000
    
    /* MAX_PD_READ_ADDRESS: Maximum address for the process input data (Sync Manager 3)
    inside the application memory of the EtherCAT Slave Controller which could be set by the master. The setting have to be within the ranges of the user memory of the ESC (this is not checked by the tool). */
    #define MAX_PD_READ_ADDRESS                       0x3000
    
    /* MIN_MBX_SIZE: Minimum mailbox size (Sync Manager 0 and 1) which could be set by the master. The SSC don't support fragmented SDO info object/entry service => at least entry info including 12byte name shall fit in the mailbox buffer */
    #define MIN_MBX_SIZE                              0x0022
    
    /* MAX_MBX_SIZE: Maximum mailbox size (Sync Manager 0 and 1) which could be set by the master. */
    #define MAX_MBX_SIZE                              0x0300	// was 0x0100
    
    /* MIN_MBX_WRITE_ADDRESS: Minimum address for the write (receive) mailbox (Sync Manager 0). The setting have to be within the ranges of the user memory of the ESC (this is not checked by the tool). */
    #define MIN_MBX_WRITE_ADDRESS                     0x1000
    
    /* MAX_MBX_WRITE_ADDRESS: Maximum address for the write (receive) mailbox (Sync Manager 0). The setting have to be within the ranges of the user memory of the ESC (this is not checked by the tool). */
    #define MAX_MBX_WRITE_ADDRESS                     0x3000
    
    /* MAX_PD_INPUT_SIZE: Maximum size of the process input data (Sync Manager 3) for cyclic exchange. */
    #define MAX_PD_INPUT_SIZE                         0x100
    
    /* MIN_MBX_READ_ADDRESS: Minimum address for the read (send) mailbox (Sync Manager 1). */
    #define MIN_MBX_READ_ADDRESS                      0x1000
    
    /* MAX_MBX_READ_ADDRESS: Maximum address for the read (send) mailbox (Sync Manager 1). */
    #define MAX_MBX_READ_ADDRESS                      0x3000
    
    /* MAX_PD_OUTPUT_SIZE: Maximum size of the process output data (Sync Manager 2) for cyclic exchange. */
    #define MAX_PD_OUTPUT_SIZE                        0x100
    

  • Thanks for the direction!
    Can you also share the corresponding portion of the ESI configuration file?