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.

CCS/AM5718: IPC communications issue

Part Number: AM5718
Other Parts Discussed in Thread: SYSBIOS

Tool/software: Code Composer Studio

I'm tring to use IPC to do the communication between A15 and Dsp in AM5718. there is a problem I can't figure out.
A15 send a message using MessageQ_put(), Dsp receive it using MessageQ_get().
After MessageQ_get(), I use Cache_inv() intent to get the real data in DDR.
But, the data in structure MessageQ_Msg is whole Zero after Cache_inv().
I have tried not to use Cache_inv(),there were some data not zero, but I'm not sure the data was correct.
I have tried emulation step into the program, there were data when MessageQ_get(), and after Cache_inv() the data goes whole Zero.
I don't know why the data is in cache, but not in DDR.
Here is DSP code:

 char Str[512];
 Int status;
 Ipc_MsgGrg * Msg;
 status = MessageQ_get(Module.slaveQue, (MessageQ_Msg *)&Msg, timeout);
 if(status != MessageQ_S_SUCCESS)
 {
  return (status);
 }
 
 HexToStr(Str, buf, Msg->len);
 log_i("<A15,0x%8x,%s", Msg, Str);//log:   37417,COMM, 432,<A15,0x95be4018,BE         there is data BE
 Cache_inv(Msg, sizeof(Ipc_MsgGrg), Cache_Type_ALLD, TRUE); //???
 HexToStr(Str, buf, Msg->len);
 log_i("<A15,0x%8x,%s", Msg, Str);//log:   37417,COMM, 438,<A15,0x95be4018,           no data,no len
 
The same code use for A15<->IPU1,A15<->IPU2,IPU1<->DSP,A15<-DSP communication is all ok.
Just A15->DSP communication not ok.
  • Hello,

    To validate that it's cache issue, could you try disabling cache for the SharedRegion and see if the issue disappears? 

    Also what version of Processor SDK are you using? And are you running Linux or RTOS on the A15?

    Regards,
    Sahin

  • Hello,

    I am closing this thread for now. If you have any updates feel free to post a reply here to re-open the thread or create a new thread by clicking the "+ Ask a related question" button at the top if this thread has locked due to time.

    Regards,
    Sahin

  • Hello Sahin,

    Here is the version:

    SDK:3_01_00_06

    PDK:1_0_4

    IPC:3_47_01_00

    I'm using Linux on the A15

    Can you tell me how to disabling cache for the SharedRegion?

  • Hello Sahin,
    I have viewed map file, the data is located in "ti_sysbios_heaps_HeapBuf_Instance_State_0_buf__A", not in SharedRegion.
    SECTION ALLOCATION MAP
     output                                  attributes/
    section   page    origin      length       input sections
    --------  ----  ----------  ----------   ----------------
    .resource_table
    *          0    95000000    00000500    
                      95000000    00000500     Communicate.obj (.resource_table)
    .vecs      0    9531c400    00000200    
                      9531c400    00000200     Dsp1_pe66.oe66 (.vecs)
    .far       0    95a01f18    002e5f2a     UNINITIALIZED
                      95a01f18    000f8cb4     (.common:gVpsCaptInstObj)
                      95afabcc    00000004     (.common:LEFTDOWN)
                      95afabd0    00040000     (.common:ti_sysbios_heaps_HeapBuf_Instance_State_1_buf__A)
                      95b3abd0    00040000     (.common:ti_sysbios_heaps_HeapMem_Instance_State_0_buf__A)
                      95b7abd0    000275e8     (.common:gCaptAppObj)
                      95ba21b8    00021000     (.common:g_ucMagRawBuf)
                      95bc31b8    00021000     (.common:g_ucThkRawBuf)
                      95be41b8    00020000     (.common:ti_sysbios_heaps_HeapBuf_Instance_State_0_buf__A)
                      95c041b8    0001e8e0     vpslib.ae66 : vpscore_vip.oe66 (.far:gVcoreVipPathObjMemPool$0)
  • Hello Sahin,

    I attached the related code file as below, please help me to review it, thanks a lot!IPC demo.zip

  • Hello,

    Since you are running Linux on the ARM core, SharedRegion is not used, so ignore my previous advice. I'm going to review your attached code for any discrepancies - I should have an update for you early next week. 

    Regards,
    Sahin

  • Thank you so much.

    If you need more information, please let me know.

  • Hello,

    I spoke with the IPC developer - on AM57x the memory shared between the cores are assumed to be non-cached. Linux side this is in general taken care of, so there should be no need to perform cache operations. Have you made any changes to the cache settings or memory map configuration? I did not see any cache configuration in your project files. 

    Have you tried sending some known values via messageQ to make sure the issue does not have to do with the HextoStr or log_i functions?

    Regards,
    Sahin

  • Hello Sahin,

    I've tried not use HextoStr and log_i functions. I use Emulator to step into the code. There is the same problem, after cache_inv, the data goes all zero.

    The problem came out is not from beginning. When my code size is small, IPC works properly. Since I add more code, the problem occurs.

  • Hello,

    What does the data look like without calling cache_inv()?

    Could you please provide your dts and resource table? I'm wondering if it's a memory mapping issue.

    Also, what is the address of the msg buffer when you are reading all zeros?

    Regards,
    Sahin

  • Hello Sahin,

    Without calling cache_inv(), Sometimes the data is correct, but sometimes it's previous data.

    I added rsc_table.h files and *.cfg files into the zipfile and attached for you, but I don't know which is the dts file.

    The address of msg buffer is loged as shown: <A15,0x95be4018,

    8712.IPC demo.zip

  • Hello,

    The Linux device tree (dts) file needs to agree with the memory mapping in the resource table. Linux device trees are typically located in your Linux Processor SDK under arch/arm/boot/dts/

    If you are using a TI board, we could help you figure out which dts file the memory mapping would be in if you are not sure.

    Regards,

    Nick

  • Hello Nick,

    I packed the dts folder here. Please help me to review it, thanks.

    4111.dts.zip

  • Hello,

    The region where the rpmsg vring buffers reside needs to be marked as uncached. Could you please try adding the following to your DSP .cfg file to disable cache for this region?

    Cache.setMarMeta(0xA0000000, 0x01000000, 0);

    I'm not sure if this is the root cause of your issue, but it will help us determine whether it's a cache issue or not.

    Regards,
    Sahin

  • Hello Sahin,

    I've tried your solution,It's not work. There is still no data after Cache_inv().

  • Hello,

    With the cache disabled, you do not need to call cache_inv(). Without calling this, is the data still stale/incorrect?

    Given that you mentioned that you didn't see this issue when the code size was smaller, we suspect it is a memory mapping issue or that something is trampling over the data. 

    However we could not find any discrepancies after reviewing your dts, resource file, and dsp related code. Do you know after what point you started to see this issue i.e., was there some functionality or code added that we can pinpoint and narrow down our focus to?

    Regards,
    Sahin

  • Hello Sahin,

    I've skiped the problem as below:

    A15 write data in my user shared memory. Then send msg. Dsp receive the msg. Then read data from shared memory.

    So the problem is still exists, but not bother me any more.

    Thank you all the same.

  • Hi Civet,

    Thank you for the update. I'm glad to hear you were able to workaround the problem.

    I will close this thread for now, if you have any questions or see the issue reappear feel free to post a reply here.

    Thanks,
    Sahin