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.

Some problems in using OMAP L-137

Other Parts Discussed in Thread: OMAP-L137

I am trying to interface the C6747/OMAP-L137 EVM to other board by using SPI. The concept for my design is using a the SPI to receive the data from other device, and then  the received data will transmit a copy to PC through UDP(using NDK2.0).

In my recent applications, without timer interrupt,

  • I could transmit data to PC by UDP (as same as NDk2.0, using TSK is DSP/BIOS )
  • I could use SPI to receive data from other device and the SPI rx event would trigger EDMA to move the data to memory. (Without using CSL and DSP/BIOS)
  • Please note that the subroutine, SPI transmission, is in a while(1) loop in main().

However, when I tried to combine these two projects, the CCS only processed the SPI but never processed the UDP task because we had a while(1) loop in main(). In my opinion, the OMAP L-137 processes the main task first, and then deal with the NDK task.

Question:

How to program the NDK without using TSK? Then we can schedule the process: SPI receive data -> send data to PC by UDP. And then we also can process other subroutine after using UDP.

 

I'm a total newbie at DSP/BIOS and Code Composer so any help would be appreciated.

 

  • Hi Dow,

    Dow Hsieh said:
    However, when I tried to combine these two projects, the CCS only processed the SPI but never processed the UDP task because we had a while(1) loop in main().

    DSP/BIOS just starts running after main exits, so you can not put a while (1) in main.

    Dow Hsieh said:
    How to program the NDK without using TSK?

     Not possible. NDK needs DSP/BIOS and Tasks to run.

    So instead of adapting NDK to your SPI application, you will need to adapt the spi code into the NDK project. You could add another TSK that calls a function that contains the SPI program you had in main. Make sure the inside your while (1) inside the task you create for the SPI you have a TSK_sleep(nticks); to not interfere with the NDK tasks (adjust the number of ticks according to your application). Also, it would be good to keep the SPI task priority low (less than 3 should be good).

    For DSP/BIOS, please see:

    http://focus.ti.com/general/docs/techdocsabstract.tsp?abstractName=spru403o

    http://focus.ti.com/lit/ug/spru303b/spru303b.pdf

    A good document that explains NDK is:

    http://focus.ti.com/general/docs/techdocsabstract.tsp?abstractName=spraax4

    Please see the NDK page as well:

    http://tiexpressdsp.com/index.php/Category:NDK

  • Hi Mariana,

    Thanks for your detailed reply.

    Mariana said:
    DSP/BIOS just starts running after main exits, so you can not put a while (1) in main

    Since I need to deal with the SPI received data first, then trasmit the processed one to PC by UDP. After UDP process, I still have other works in OMAP. Besides, all the procedures (SPI, UDP, other works) are sequentially, and repeated and repeated again.....It's really doubted me.  Please tell me how to program these procedures with DSP/BIOS and  without using while(1) in main(). Tank you.

    Mariana said:
    You could add another TSK that calls a function that contains the SPI program you had in main. Make sure the inside your while (1) inside the task you create for the SPI you have a TSK_sleep(nticks); to not interfere with the NDK tasks (adjust the number of ticks according to your application).

    Because there're lots of works I should do in one CCS project, I could not use lots of TSK and TSK_sleep(nticks) in one project. I guess lots of TSK_sleep(nticks) would disorder the C6747. Therefore, the DSP/BIOS seems not suitable for me. As you say, the DSP/BIOS is necessary for NDK but I just need the simple function, UDP. Do TI has any suggestion or example code for only the UDP service without DSP/BIOS?

  • Dow Hsieh said:
    Since I need to deal with the SPI received data first, then trasmit the processed one to PC by UDP. After UDP process, I still have other works in OMAP. Besides, all the procedures (SPI, UDP, other works) are sequentially, and repeated and repeated again.....It's really doubted me.  Please tell me how to program these procedures with DSP/BIOS and  without using while(1) in main(). Tank you.

    What you described above is precisely what a task is good for. Tasks were designed for repetitive tasks that could be interrupted by higher priority "I need to do this now" type functions (HWIs and SWIs). The beauty of a task is that it can be suspended after it finishes processing so that the CPU has time to perform other tasks as well.

    In your case I think you should use the EDMA3 engine to copy the SPI data into a buffer in memory. When the buffer is filled the EDMA3 interrupts the CPU, and the ISR posts a semaphore (SEM) to wake up the task. The task can then process the data if needed, and if not it can set in motion the UDP transfer to the CPU.

    Dow Hsieh said:
    Because there're lots of works I should do in one CCS project, I could not use lots of TSK and TSK_sleep(nticks) in one project. I guess lots of TSK_sleep(nticks) would disorder the C6747. Therefore, the DSP/BIOS seems not suitable for me. As you say, the DSP/BIOS is necessary for NDK but I just need the simple function, UDP. Do TI has any suggestion or example code for only the UDP service without DSP/BIOS?
    TSK_sleep() is not commonly used from what I have seen, although it does have its place. I think you should instead understand the SEM object and how it works. I like to think of the Semaphores as bookmarks to be used in a Task. When you SEM_pend() you place a bookmark in the Task. A SEM_post tells the CPU to go back to that bookmark and continue processing where it was.

  • Thank you for reply.

    TimHarron said:
    ..... Tasks were designed for repetitive tasks that could be interrupted by higher priority....

    The schedule  I need is a repeatable works, i.e.

    while(1)

    {

    subroutine 1(SR1,SPI Rx)=>SR2 (EDMA)=>SR3 (UDP)

    }

    Could you tell me how to use repeatable TSKs to complete the above works? For my best knowledge, DSP just runs a TSK once if there's no for(;;) in that TSK.

    TimHarron said:
    In your case I think you should use the EDMA3 engine to copy the SPI data into a buffer in memory. When the buffer is filled the EDMA3 interrupts the CPU, and the ISR posts a semaphore (SEM) to wake up the task. The task can then process the data if needed, and if not it can set in motion the UDP transfer to the CPU.

    Do you mean that I should rewrite the EDMA by using DSP/BIOS? Please tell me more about it, thank you.

     

    The NDK is too powerful for me to finish the project, because what I need is only the UDP service. If I use NDK for only UDP service, it's like "killing a mosquito by a powerful missile". Do TI have other solution for UDP (without NDK) ?

     

  • Dow Hsieh said:
    Could you tell me how to use repeatable TSKs to complete the above works? For my best knowledge, DSP just runs a TSK once if there's no for(;;) in that TSK.

    You're right. If you allow the task to run to completion that task is complete and will not run again. As such the infinite loop is required to continue operation.

    What you would want to do is change your loop to look something like this:

    Dow Hsieh said:
    while(1){
    SEM_pend(&SEM_NAME);
    subroutine 1(SR1,SPI Rx)=>SR2 (EDMA)=>SR3 (UDP)
    }


    The SEM object is used to temporarily suspend execution of this task until something comes along and tells BIOS to resume execution (usually something like an HWI or SWI would SEM_post(&SEM_NAME);).

    Dow Hsieh said:
    Do you mean that I should rewrite the EDMA by using DSP/BIOS? Please tell me more about it, thank you.
    I'm not sure what you mean with this question. The EDMA3 and DSP/BIOS are separate entities - EDMA3 is a movement block and DSP/BIOS is a software block used to schedule the system. What I suggest is that you program one of the EDMA3 channels to handle the SPI data retrieval so that the CPU does not have to. This is not mandatory by any means, but would help reduce the CPU load.

    Dow Hsieh said:
    The NDK is too powerful for me to finish the project, because what I need is only the UDP service. If I use NDK for only UDP service, it's like "killing a mosquito by a powerful missile". Do TI have other solution for UDP (without NDK) ?
    As far as I know the NDK is the only means we offer for any transmission over the EMAC.