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.

PHYTC-3P-KIT-AM64: Using IPC and MCSPI together

Part Number: PHYTC-3P-KIT-AM64

Hello experts,

I'm trying to execute a data transfer from A53 core to R5F core (using IPC) and then from R5F to a peripheral using SPI. To do so, I've combined two examples IPC_rpmsg and mcspi_performance_32_bit. But After syncing both the cores using IpcNotify_syncAll, if I execute RPMessage_recv and mcspi_low_latency_transfer_32bit, only IPC gets executed but I don't see any output from SPI in the peripheral (logic analyzer).

Structure of a part of the code running in A53 core:

IpcNotify_syncAll(SystemP_WAIT_FOREVER);
ClockP_usleep(500 * 1000); // Delay for log flush

while(1)
{
print_msgBuf
print_newLine

// Send the row to R5F core
status = RPMessage_send(msgBuf, msgSize, gRemoteCoreId, REMOTE_SERVICE_END_PT, RPMessage_getLocalEndPt(&gAckReplyMsgObject), SystemP_WAIT_FOREVER);
DebugP_assert(status == SystemP_SUCCESS);

}

Structure of a part of the code running in R5F core:

IpcNotify_syncAll(SystemP_WAIT_FOREVER);
DebugP_log("[IPC RPMSG ECHO] Remote Core waiting for messages from main core ... !!!\r\n");

while(1)
{

status = RPMessage_recv(&gRecvMsgObject, msgBuf, &MsgSize, &remoteCoreId, &remoteCoreEndPt, SystemP_WAIT_FOREVER);
DebugP_assert(status == SystemP_SUCCESS);

print_msgBuf

// IpcNotify_syncAll(SystemP_WAIT_FOREVER);

mcspi_low_latency_transfer_32bit(baseAddr0, chNum0, &gMcspiTxBuffer[0], dataLength0, bufWidthShift0);
}

Important:  The above code script just shows the flow of calling the IPC and MCSPI functions. For simplicity, I've not shown some initialization of the variables and have used some symbolic functions here such as print_msgBuf. Just to check the functionality of the program, IPC data msgBuf and SPI data gMcspiTxBuffer are different here.

Any help would be greatly appreciated.

Thanks in advance!

  • Hello,

    It will take me a day or so to take a closer look at your thread.

    Regards,

    Nick

  • Hello,

    I apologize for the delayed response. I ran out of time before going on vacation for the rest of the month of March, so I am reassigning your thread to one of my teammates to help while I am out. Please ping the thread next week to make sure they see it and respond.

    Regards,

    Nick

  • Hello Nick,

    Thanks for the reply. Looking forward for a solution.

  • Hello Guenter ,

    You have integrated two examples. One is MCSPI and another one is IPC from A53 core to R5F core.

    And, you have already confirmed that IPC is working.

    Can you please confirm whether the MCSPI code is working or not without IPC ?

    If possible please share your project as well. I can look at what we have, made wrong.

    Regards,

    S.ANil.

  • Hi Anil,

    Yes, IPC and MCSPI both work properly if are run independently but if the mcspi example is combined with the IPC (R5F core) then it doesn't.
    I've attached the respective files of the IPC projects for A53 and R5F cores with mcspi integrated.

    ipc_spi_a53ss0-1.zipipc_spi_r5fss0-1.zip

  • Hello Guenter,

    I am looking at your code .

    You may expect reply by today.

    Regards,

    S.Anil.

  • Hi Anil,

    Any update on this?

  • Hello Guenter,

    I will update status by today .Sorry for delayed response .

    Regards,

    S.Anil.

  • Hello Guenter,

    Can you please confirm where you are checking the TX signal, either D0 or D1 line ?

    I have looked at your code and system config, your code looks fine to me. 

    In the above attached project, you are trying to send dummy bytes from TX_buffer without IPC . So, check whether these bytes are going or not on the D1 pin ?

    Regards,

    S. Anil.

  • Hi Anil,

    I've connected both the pins D0 and D1 to the logic analyzer to check if any of these shows the output. 

    Yes, the TX_buffer sends different data than that of the received from IPC. This is because I just want to see first if the IPC and MCSPI are working together. After it's successful execution I'll format the same data for both IPC and MCSPI.

  • Hello Guenter,

    Let me check your code and will provide my feedback comments by today.

    Regards,

    S.Anil.

  • Hi Anil,

    Any update on this?

  • Hello Guenter,

    Your code is working fine and below is the attached image for your reference.

    The problem is that in your code there is an RPMessage_recv function which will keep on waiting until it receives data from the A53 core.

    If you send data from A53 core, the RPMessage_recv API reads the data once the data receiving is finished, then control goes to MCSPI TX. 

    Please make sure that if your code hangs somewhere please debug the issue with where the control goes. This will gives an hint for the issue.

    Regards,

    S.Anil.

  • Hi Anil,

    Good to hear that it works for you. Did you change anything in the code or are you only running the mcspi function not RPMessage_recv?

    Because for me, when I'm running the program, the loop executing both the functions runs infinitely (I can judge that by seeing the received data printed in the terminal). That means the code doesn't stuck anywhere. But the logic analyzer doesn't show anything.

     

  • Hello Guenter,

    Can you put the break point at 132-line and see if break points are hit or not ?

    Mostly, it does not hit the break point since your code is waiting for data from A53 core at 124 .

    If you want to see MCSPI TX alone, then comment line 124 and see if MCSPI transmits data or not.

    You are expecting to work above code, run the IPC example on A53 core also. 

    Regards,

    S. Anil.

  • Hi Anil,

    Both functions are working perfectly if one of them is commented out. But I have to run them together as mentioned in the last screenshot. 

    Yes, I want to make the code mentioned in the screenshot running, and to do that, I'm also running the IPC example in A53. As a result, I can see the output printed from line 127. And now, if line 127 is executed, then from my understanding, the code didn't stuck at line 124. But I can't see any results from line 132.

    If you see both the examples (R5F and A53), I've written the commands to print the data of both the sides every time when one IPC transfer is taken place. And as expected, the data gets printed infinitely even if on the R5F side, both the functions (MCSPI and IPC) are implemented together. 

    In the above picture, console output is from the program running at A53 side, and terminal output is from the program running at R5F side (when both the functions running together at R5F side). At this moment I'm not getting any MCSPI signal in the logic analyzer.
    I hope you've understood the issue.

  • Hello Guenter,

    So, even IPC is working but data is not being Transmitted by MCSPI .

    I assume that this issue would be problem with Timing .Since , in while(1) continuously you are sending data from A53 core and at remote core R5F side, every time you will get an interrupt for the MAILBOX and after processing it by the R5F core and this is continuously happening .In this case might be your R5F core mostly be in to ISR routine .

    So, you do one testing instead of sending data in while(1) and send dat for 1sec in A53 and see if still has the issue or not?

    So, even IPC is working, but data is not being Transmitted by MCSPI.

    I assume that this issue would be problem with Timing .Since, in while(1) continuously you are sending data from A53 core and at remote core R5F, every time you will get an interrupt for the MAILBOX and the R5F core will processing it for every time and this is continuously happening .In this case might be your R5F core mostly be in to ISR routine .

    So, you do one testing instead of sending data in while(1) and send dat for 1sec in A53 and see if still has the issue or not?

    Regards,

    S.Anil.