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.

TMS320F28388D: CM handling 8Bit-signed values

Part Number: TMS320F28388D


Hello,

I starting with an ethercat communication and want to receiving an 8 Bit signed value in the CM and than transfer the data in CPU1 as an signed value.

The problem is that CPU1 works with min. 16.Bit value. So my idea was to receive an 8Bit value in the CM an cast to 16 before transfer this value via IPC, but it does not work because I receive the negative value from master device (e.g.twincat) as 0xFF. Which is interpreted as 0xFF in the CM. Can someone expect what is wrong?

Hope you can help me. Thank you in advance.

  • Markus, 

    We are looking into and will get back to you soon.

    Thanks.

  • Hi,

    Apologies for the delay.

    Could you share the code snippet where you share the data from the CM core and how it is received in C28x?

    Regards,

    Veena

  • Hi Veena,

    sorry for my delay.

    This is my struct in the CM and also in CPU1:

    typedef struct
    {
        uint16_t          exchangeDataFlag;
        uint16_t          exchangeDataNum;
        ECAT_StatusNode_t statusNode[SYS_NODE_NUM];
    }ECAT_IPC_GetDataBuffer;

    extern ECAT_IPC_PutDataBuffer ipcCMToCPUDataBuffer;

    The status node struct contains a   int16_t modes_of_operation;

    In CM I put the data in this variable: ipcCMToCPUDataBuffer.ctrlNode[0].modes_of_operation = (INT16)LocalAxes.Objects.objModesOfOperation;

    And the LocalAxes.Object is located in the CM and is INT8 objModesOfOperation;

    Problem is now that: INT8 objModesOfOperation = 254. But transfer 254 to the CPU1 which is 16Bit base is no sign variable anymore. Therfore I try to cast to INT16 before transfer. But this does not work too, because the 254 is receved as 254 not as negative value.

    If you need some more details please do not hesitate to ask. Thank you for your help!

    Kind Regards,

    Markus

  • Hi MArkus,

    Could you make the variable uint16?

    Another problem with having shared int8 variable is that C28 can only read in multiples of 16 bits. So, it could be reading the next8 bits as well resulting in wrong value if there is a non-zero value at that location.

    Regards,

    Veena