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.

TMS320F28384S: Passing NULL reference from C28 to CM

Part Number: TMS320F28384S

Hello,

in my application I need to pass the address and length of several data structs to CM, along with some other info, using IPC_sendCommand() API.

In one case, however, I need to pass NULL:

IPC_sendCommand(
    IPC_CPU1_L_CM_R,
    ESBUS_IPC_FLAG_TX_OUTPUTS,
    IPC_ADDR_CORRECTION_ENABLE,
    info.ch,
    (uint32_t) NULL,
    0);

In this case I have noticed that on CM side, NULL (=0) is converted in 0xA000E000.

This doesn't cause me any problem, but I would like to know if this behavior is ok.

Thank you,

Carlo

  • Carlo,

    You are trying to typecast NULL to unsigned integer. You cannot do that. NULL is usually assigned to pointers. Why can't you directly send the actual unsigned integer value.

    Regards,

    Manoj

  • Hello Manoj,

    thank you for response. I am sorry to answer only now, but I was out of office for some days.

    I'm not sure that I have understood your answer.

    As shown on TI examples, data struct addresses are passed as pointes type casted to uint32_t, as shown in the following code snippet taken from ipc_ex1_basic_c28x1 example.

    #pragma DATA_SECTION(readData, "MSGRAM_CPU_TO_CM")
    uint32_t readData[10];


    IPC_sendCommand(IPC_CPU1_L_CM_R, IPC_FLAG0, IPC_ADDR_CORRECTION_ENABLE,
    IPC_CMD_READ_MEM, (uint32_t)readData, 10);

    In this way, to get my code compact and clean I used this pattern also with NULL, in the case I don't have any data struct to pass from C28 to CM.

    As already said, NULL (that is defined as 0 in string.h) is transformed in 0xA000E000 on CM side, and I wonder why.

    Thank you,

    Carlo.

  • Carlo,

    IPC_sendCommand(IPC_CPU1_L_CM_R, IPC_FLAG0, IPC_ADDR_CORRECTION_ENABLE,
    IPC_CMD_READ_MEM, (uint32_t)readData, 10);

    Did you try single stepping through the code and check from C28x side what is getting written from C28x side? I'm currently sick and would take couple of days to recover. I can try this when I get back in office on friday.

    Regards,

    Manoj

  • Hello Manoj,
    I hope you are feeling better.

    I tried to step into IPC_sendCommand() but I had some sort symbols disaligment problems, and I wasn't able to get a lot.
    The only think I have seen, is that if IPC_ADDR_CORRECTION_ENABLED flag is set, the following adjustment is performed:

    IPC_Instance[ipcType].IPC_SendCmd_Reg->IPC_SENDADDR = addr - IPC_Instance[ipcType].IPC_MsgRam_LtoR; 

    Thank you,
    Carlo

  • Does the problem go away when you enable address correction? Address correction needs to be enabled for M4 - C28x (or) C28x - M4 because C28x 's word size if 16 bits and M4 word size is 8 bit.

    Regards,

    Manoj

  • Hello Manoj,
    I am already using IPC_ADDR_CORRECTION_ENABLE flag.

    On C28 side, I call:

    IPC_sendCommand(
        IPC_CPU1_L_CM_R,
        MY_IPC_FLAG,
        IPC_ADDR_CORRECTION_ENABLE,
        myInfo,
        (uint32_t) NULL,
        0);

    On CM side I call:

    if (IPC_readCommand(
        IPC_CM_L_CPU1_R,
        MY_IPC_FLAG,
        IPC_ADDR_CORRECTION_ENABLE,
        &myInfo,
        &addr,
        &unused))

    and 'addr' is equal to 0xA000E000.

    Regards,
    Carlo

  • Okay. I need to check this myself and get back with you. Please give me 3 - 4 business days to get back with you.

    Regards,

    Manoj