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.

Mutex Between ARM and DSP

Expert 1215 points
Other Parts Discussed in Thread: SYSBIOS

Hi, 

Without DSP/Bios, is there a way to implement a truly atomic mutex between ARM and DSP?

Thanks

  • Would you please give more information/ explain like

    1. A context specific situation you come across to look for this requirement.
                 ( or )
    2. A significant need for this "atomic mutex".

    Regards,
    Shankari.

  • I am using the L3 Shared Memory as a way to pass data between the ARM and the DSP. A mutex is needed to ensure the data integrity.

    DSPBios and DSPLink can't be used in my case because of the latency and overhead.

     

  • I think this message was unanswered but did you solve your problem, so implement a mutex without the use of sysbios and dsplink?

    I would like to lock a section of memory before the DSP starts calculations on the data in this section.
    Synchronization with the use of an interrupt is not desired.

    Any means of implementing a mutex (or a semaphore) with code that does not use the SYSBIOS system.
    I found this link, but am wondering if this is the way to go?
    http://www.dsprelated.com/groups/c6x/show/8233.php 

    Regards Rob

     

  • Mutual exclusion using shared memory only is large area of study. I haven't seen simple examples of it that aren't tied to an OS. If you want to write your own, Wikipedia has a nice summary here:

    http://en.wikipedia.org/wiki/Mutual_exclusion

    I think there is no generic code out there because of the need to control instruction reordering in the processor or optimization in the compiler.

  • As Norman suggested, the above URL will be helpful.
    Especially, Peterson's algorithm is very easy to implement.
    I implemented it before to share the memory between DSP and PRUSS, it worked effectively.
    Peterson's algorithm might be a starting point.

    Hope this helps.


    Regards,
    Kawada 

  • Thanks for the reply the algorithms are really usefull, but then the next questions arrises.

    Q1: Can the C6000 compiler reorder memory accesses instructions, because all algorithms on the Wiki
            assume memory accesses can not be re-ordered.

    Q2: When the compiler can reorder memory acceses,
            Is there a way to create a memory barrier at the DSP side (pragma, assembly instruction etc.) 

    Thank you for your response,

    Regards Rob

  • Hi Rob,

    As for Peterson, what you have to do before/after the critical sections is just read/write operation for the shared flags and waiting for the condition. So basically, if you specify volatile keyword for the flags, I believe it just works. And there is no memory protection technics in compiler as long as I know.

    Regards,

    Kawada

  • Thanks, 

    I was wondering if volatile would be enough, but i think i give it a try and do some tests with the mutual exclusive algorithm.

    Thank you for the answers

  • Hi Rob,

    Ok, please try. By the way, If my understanding correct, I think DSP/LINK was using Peterson for critical section. I tried to use Perterson between Dsp and PRU because I just remembered DSP/LINK was doing in the source code. I saw the source code for a long time ago so now I can not show you the actual code, but you might be able to get some hints for mutual executive algorithm in DSP/LINK.

    Good luck.

    Kawada