Other Parts Discussed in Thread: CONTROLSUITE
Tool/software:
Hello. I'm unable to correctly execute the FoE on the TMS320F28379D. I am using SSC v5.11 to generate the code. I've compared the generated code in v5.11 to that on v5.12 for the F28388 and the issue appears to be there as well.
In the generated code we have this structure being used in ecatfoe.h:
/** \brief Complete FoE datagram*/
typedef struct MBX_STRUCT_PACKED_START
{
TMBXHEADER MbxHeader; /**< \brief Mailbox header*/
TFOEHEADER FoeHeader; /**< \brief FoE header*/
UINT16 Data[((MAX_MBX_DATA_SIZE)-(FOE_HEADER_SIZE)) >> 1]; /**< \brief FoE Data buffer*/
}MBX_STRUCT_PACKED_END
TFOEMBX;
/**
* \brief Mailbox header
*/
typedef struct MBX_STRUCT_PACKED_START
{
UINT16 Length; /**< \brief Length*/
UINT16 Address; /**< \brief Address*/
UINT16 Flags[1]; /**< \brief Flags*/
#define MBX_OFFS_TYPE 0 /**< \brief Protocol type offset*/
#define MBX_MASK_TYPE 0x0F00 /**< \brief Protocol type mask*/
#define MBX_SHIFT_TYPE 8 /**< \brief Protocol type shift*/
#define MBX_OFFS_COUNTER 0 /**< \brief Protocol counter offset*/
#define MBX_MASK_COUNTER 0xF000 /**< \brief Protocol counter mask*/
#define MBX_SHIFT_COUNTER 12 /**< \brief Protocol counter shift*/
} MBX_STRUCT_PACKED_END TMBXHEADER;
/** \brief FoE header*/
typedef struct MBX_STRUCT_PACKED_START
{
UINT16 OpCode; /**< \brief OpCode
*
* 1 : RRQ<br>
* 2 : WRQ<br>
* 3 : DATA<br>
* 4 : ACK<br>
* 5 : ERR<br>
* 6 : BUSY*/
union MBX_STRUCT_PACKED_START
{
UINT32 Password; /**< \brief Password (used in Read request and Write request). 0 if unknown*/
UINT32 PacketNo; /**< \brief Packet number (used in DATA and ACK datagram)*/
UINT32 ErrorCode; /**< \brief Error code (used in ERR datagram)*/
struct MBX_STRUCT_PACKED_START
{
UINT16 Done; /**< \brief Done indication (used in BUSY datagram)*/
UINT16 Entire; /**< \brief Entire indication (used in BUSY datagram)*/
}MBX_STRUCT_PACKED_END
Busy; /**< \brief Busy variable*/
}MBX_STRUCT_PACKED_END
Cmd; /**< \brief Command field*/
}MBX_STRUCT_PACKED_END
TFOEHEADER;This TMBXHEADER size is 6 bytes (48 bits). This header is padding itself to be 32bit aligned. That pushes off the first member of TFOEHEADER (the opCode) to be at the wrong address.. thereby making all members offset incorrectly.
This is what I am seeing in debugging:

That 0x0002 is the correct FoeHeader.opCode as shown in the memory browser. However the struct shows it as 0x1836.
Is there something I am missing? I assume this was delivered as working?