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.

AM5728: IPC shared memory issue

Part Number: AM5728
Other Parts Discussed in Thread: AM5729

Hi all,

I'm trying to test IPC using shared memory transport to exchange messages between A15 and DSP. I want to allocate message once on each core and then reuse it indefinitely.

Platform:

  • AM5729 on BeagleBorad-X15
  • pdk_am57xx_1_0_15
  • processor_sdk_rtos_am57xx_6_00_00_07
  • bios_6_75_02_00

Cache is enabled on A15, disabled on DSP.

  1. A15 and DSP: Create and open queues, one on A15 side, one on DSP side using MessageQ_create() and MessageQ_open().
  2. DSP: Allocate message1 (MessageQ_alloc()) and send it over through A15 queue (MessageQ_put()).
  3. A15: Receive message1 (MessageQ_get()), allocate message2 and send it to DSP (MessageQ_put()).
  4. DSP: Receive message2 and resend message1 to A15.
  5. A15 Assert A_regionInvalid: region is invalid (A15's stack address is supplied to SharedRegion_getPtr())

I've tried to narrow down the issue. When A15 receives message1 for the first time, I see that IPC uses SWi to dequeue the message from some "shared" queue located in shared region and enqueues message1 to "internal" queue located on A15's stack. So the message head is updated, BUT no Cache_inv() is called and the updated head is in the cache only. This fires back when the message1 is received on A15 for second time, SWi does Cache_inv() and old value from the cache overwrites the new value updated by DSP. Then it tries to translate shared region address to A15's address and assertion is raised.

When I change the approach that A15 doesn't allocate message2, but uses message1 to reply to DSP, everything is OK.

So my question is if this is expected behavior or there's missing Cache_inv() when message is enqueued into A15's queue? I thought that once message is dequeued, no-one owns it and can be re-used by any core.

Thanks!

  • Hello,

    Whoever creates the message queue owns the queue. Once a message is allocated it can be sent on any queue, and once the reader thread reads the message they can either free it back to the heap or re-use it indefinitely. 

    More details on the messageQ module can be found here, can you please take a look?

    Also, I recommend taking a look at the ex11_ping example in Processor SDK for reference. This example demonstrates creating and opening a messageQ on each core.

    There is also a simpler ex02_messageq example that creates a messageQ on the A15 that is opened by the DSP.  

    I hope this helps. If you have any questions please let me know.

    Regards,
    Sahin