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.
Hi~
Recently I tested running Vision_apps, when I tried to use share memory between MCU2_1 and C7x, I found that C7x sometimes read data form share memory failed.
The code I runed on C7x is as below:
AppMemCacheInv(addr, size);
memcpy(data, addr, size);
A probability of one in ten thousandth may be wrong.
Can you provide some more details? Like cache settings and region settings on MCU 2_1, MMU page table setting and cache settings on C7x?
Regards,
Shyam
Hi,
Thanks for providing details, on the MCU2_1 side are you updating the data every time? Also can you please tell the cache operations done on MCU2_1?
You might have to do a cache writeback on MCU2_1 before sending an interrupt to C7x to read it.
Regards,
Shyam
A72 transfers data to C71 through shared memory. When C71 reads shared memory, It often reads the wrong data with appMemCacheInv.
But, When C71 reads shared memory : appMemCacheInv + memcpy + appMemCacheWbInv , it is ok!
why?
"A72 transfers data to C71 through shared memory. When C71 reads shared memory, It often reads the wrong data with appMemCacheInv."
Can you please let us know how you are checking if the data is wrong?
Regards,
Shyam
hi,
A72 writes 4-bytes integer data to shared memory, and sends the 4-bytes integer to c71 through IPC.
After C71 receives the IPC, it compares the data the IPC receives with the data it reads from shared memory.
Then C71 sends ack + integer to A72. After A72 receives ACK, it confirms whether the integer in ack is the integer sent last time, and then sends next time.
thanks!
Thanks for letting us know,
As of today there is a software issue because of which auto cache coherence does not exist between C7x and A72.
So we have to do cache operations as below,
generally :
C7x read:cacheinv + memcpy
C7x write:memcpy + cachewb
but, A72-> C7x:
C7x read:cacheinv + memcpy + cachewb
C7x write:memcpy + cachewb
When C71 reads shared data from A72 , C71 must add CacheWB. This will solve the problem temporarily. Is it right?
thanks!
Hi,
C7x read: cacheinv + memcpy (is the destination, DDR or L3 or L2)
If the memcpy destination is DDR we will need a cachewb but if the destination is L2 cachewb is not expected.
Also this is assuming that you have programmed C7x MMU accordingly.
Regards,
Shyam
Reply on behalf of Michael Cui.
C7x read share memory data from A72: cacheinv + memcpy, ---failed
C7x read share memory data from A72: cacheinv + memcpy + cachewbinv, ---OK
C7x write share memory data from A72: memcpy + cachewb, ---OK
I think we do not need cachewbinv operation for reading. What is the effect of cachewbinv?
C7x read share memory data from A72: cacheinv + memcpy, ---failed
Can you please let me know what is the destination address of the memcpy? If the destination address is DDR, then a cachewbinv may be required, if the destination address L2 SRAM then cachewbInv is not required.
Regards,
Shyam
Thanks Shyam. Destination Addr is DDR.
After a call with Michael Cui, I can help add more details: He might not express clearly.
1. A72 write data to Shared DDR, then do a CacheWB. Correction: no CacheWB, but they use mmap with o_sync option.
2. C71 do a cacheInv to Shared DDR. If you read the value now, you will have a very small chance to get a wrong value.
3. C71 do a memcoy to local heap, then do a CacheWB, We can get the correct result all the time.
ZM
ZM,
3. is expected behaviour. If you want to "view" the contents of local heap in DDR with the latest values, you will have to to a CacheWB for the changes in L1D write buffer to be committed to DDR.
As an experiment, you can try changing the destination address to L2SRAM. Here you will not require a CacheWB as L1D and L2 are coherent. I hope this answers your question.
Regards,
Shyam