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.

Notify Event Registering

Other Parts Discussed in Thread: SYSBIOS

Hi All,

I am trying to send notify event to ARM from DSP. I did the following 

 

ARM

---------

    /* Create semaphore for application synchronization */

    semSyncHandle =

            OsalSemaphore_create(OsalSemaphore_Type_Counting);

    if (semSyncHandle == NULL) {

        Osal_printf ( "Error: Failed OsalSemaphore_create \n");

        status = -1;

    }

 

   if(status > 0)

    {

    status = Notify_registerEvent (rProcId,

               0,

               APPNOTIFY_EVENT_NO_SYNC,

               (Notify_FnNotifyCbck) rtosInfocallback,

               (Ptr)semSyncHandle);

 

    }

....

Osal_printf("Waiting for notification from processor %d\n", rProcId);

        OsalSemaphore_pend (semSyncHandle,

                            OSALSEMAPHORE_WAIT_FOREVER);

 

DSP

-------

 

    Task_sleep(3000000);

    System_printf("Sending a Notify to ARM\n");

    do {

    status = Notify_sendEvent (rProcId,

                               0,

                               (APPNOTIFY_EVENT_NO_SYNC),

                               0x1234,

                               TRUE);

        System_printf("Sendt a Notify to ARM status = %d\n",status);

    } while (status < 0);

 

ARM side everything is successful and ARM is waiting for event on semaphore,  but I am getting -14 (Notify_E_EVTNOTREGISTERED) on DSP side.

But when I add

status = Notify_eventAvailable (rProcId, 0, APPNOTIFY_EVENT_NO_SYNC);

before registering event in ARM side everything works as expected, ARM is getting event after 3s delay.

 

Can anybody explain this behaviour?  Am I doing any thing wrong in the Notify register/sent sequence?

I am working in 8148evm with ezsdk. Doing this experiment inside messageQ sample in syslink

Thanks

Jibin

 

 

 

 

  • Jibim,

    I don't think you should have to call Notify_eventAvailable() on the ARM side in order to get your notification from the DSP.  The error on the DSP side indicates that the ARM has not registered for the notification at the time the DSP has called Notify_sendEvent().  Where inside of the MessageQ example did you put these calls?  Did you move the location of the Notify_registerEvent() when adding the call to Notify_eventAvailable()?

    Best regards,

        Janet

     

  • Hi Janet,

    Thanks for the reply.

    I put these inside messageQ example. The Event registering is done before Ipc_readConfig() and wait is done just before the cleanup section. Because I not getting any error in ARM side, I believe the event registering is done properly eve without calling Notify_eventAvailable(). 

     

    Is there any documents explaining the API call sequence to be followed in ARM & DSP side from IPC (Notify, messageQ, RingIO etc..)?

     

    Thanks

    Jibin

  • Jibin,

    The SysLink User's guide and SysLink API guide have documentation on the IPC modules.  You can access these guides from the links in the SysLink release notes.  I will try to reproduce the problem you are seeing.

    Best regards,

        Janet

  • Jibim,

    I tried to reproduce the failure you are seeing, using the TI816X platform.  On the hlos side of the messageQ app (in MessageQApp.c), I added the lines in red to the function MessageQApp_threadHandler:

        Osal_printf("MessageQApp_threadHandler entered\n");

        lProcId = MultiProc_self();

        semSyncHandle = OsalSemaphore_create(OsalSemaphore_Type_Counting);
        if (semSyncHandle == NULL) {
            Osal_printf ( "Error: Failed OsalSemaphore_create \n");
            return;
        }

        status = Notify_registerEvent(rProcId, 0, APPNOTIFY_EVENT_NO_SYNC,
                (Notify_FnNotifyCbck) rtosInfocallback, (Ptr)semSyncHandle);


        /* Read the config info written by the slave. */
        do {
            status = Ipc_readConfig(rProcId, APP_INFO_TAG, &aInfo,
                    sizeof(App_Info));
        } while (status == Ipc_E_FAIL);

        ...

        Osal_printf("Waiting for notification from processor %d\n", rProcId);

        OsalSemaphore_pend (semSyncHandle, OSALSEMAPHORE_WAIT_FOREVER);


        switch (cleanupCode) {

        ...

    On the rtos side, I added the lines below in red, just before cleanup.  I had to change the Task_sleep() value to 3000 to get a 3 second delay:

        Task_sleep(3000);

        System_printf("Sending a Notify to ARM\n");

        do {
            status = Notify_sendEvent (rProcId, 0, (APPNOTIFY_EVENT_NO_SYNC),
                    0x1234, TRUE);
            System_printf("Sendt a Notify to ARM status = %d\n",status);
        } while (status < 0);


        /* Cleanup. */

    I did not need to call Notify_eventAvailable() for this to work.  This is the output I got from running the message sample:

    # ./messageapp_debug 1 DSP ./message_dsp.out

    MessageQApp sample application
    Entered MessageQApp_startup
    Loading and starting procId [0] with [./messageq_dsp.out]
    Attached to slave procId 0.
    Loaded file ./messageq_dsp.out on slave procId 0.
    Started slave procId 0.
    SlaveLoader_startup status [111693824]
    After Ipc_loadcallback:
        status [0x0]
    After Ipc_startcallback:
        status [0x97d2000]
    Leaving MessageQApp_startup 97d2000
    Entered MessageQApp_execute
    MessageQApp_threadHandler entered
    Registering heapId 0 with MessageQ for procId: 0
    MessageQ_create name MSGQ_30  status [0x0] : procId [0]
    Sending synchronizaion notification to ProcId: 0
    Sent synchronizaion notification to ProcId: 0
    MessageQ_open Status [0x0] : procId [0]
    MessageQApp_queueId  [0x0] : procId [0]
    Sending a message #100 to 0
    Sending a message #200 to 0
    Sending a message #300 to 0
    Sending a message #400 to 0
    Sending a message #500 to 0
    Sending a message #600 to 0
    Sending a message #700 to 0
    Sending a message #800 to 0
    Sending a message #900 to 0
    Sending a message #1000 to 0
    Waiting for notification from processor 0
    Received event 0x1234 from procId [0]!:
    Leaving MessageQApp_threadHandler 0
    Leaving MessageQApp_execute
    Entered MessageQApp_shutdown()
    After Ipc_stopCallback status: [0x97d2000]
    Shutting down procId [0]
    Stopped slave procId 0.
    Unloaded slave procId 0.
    Detached from slave procId 0.
    SlaveLoader_shutdown status [0]
    Leaving MessageQApp_shutdown() (0x0)

    (I renamed the dsp executable to message_dsp.out)  What value did you set APPNOTIFY_EVENT_NO_SYNC to?  I set it to 20 in my test.

    Best regards,

        Janet

  • Jibin,

    One thing that I noticed about your code is that you have

        Task_sleep(3000000);

    in your DSP code to sleep for 3 seconds.  Normally, one system tick corresponds to 1 msec.  In my code, I call

        Task_sleep(3000);

    to sleep for 3 seconds.  It looks like in your case, SysBIOS does not have the correct value for the timer frequency.  It may be assuming a frequency of 32KHz, when actually it is 20MHz, or some very high value.  These would cause the SysBIOS Clock ISR to fire much more frequently then desired, so that your DSP is spending most of the time in the Clock ISR.  This could cause your examples not to run correctly.

    If you look in the file, syslink/samples/rtos/messageQ/ti81xx/MessageQ_ti81xx_dsp.cfg you will see these lines:

    var Timer        = xdc.useModule('ti.sysbios.timers.dmtimer.Timer');
    Timer.intFreq.hi = 0;
    Timer.intFreq.lo = 32768;

    So SysBIOS will assume the clock is running at 32KHz.   If your clock is running at 20MHz, you can change Timer..intFreq.lo to 20000000:

    Timer.intFreq.lo = 20000000;

    and rebuild the DSP side.  This does not actually change the clock frequence.  It only provides the correct information to SysBIOS to generate the timer interrupt every millisecond.

    Best regards,

        Janet

     

  • Hi Janet,

    Thanks for the reply.

    The clock frequency was 32Khz and actual frequency is 20Mhz.  I changed this and now the notify is working fine. But I have another problem now.

    I also integrated RingIO example to messageQ example as I did for Notify. But the DSP side is giving error RingIO_E_NOTFOUND fro RingIO_open(). Can you help me on this?

     

    Thanks

    Jibin

  • Hi Jibin,

    I'm glad to hear that changing the value for the clock frequency fixed your Notify problem.  Regarding the RingIO_open() failure, were you able to run the RingIO sample as is, and not integrated into the MessageQ example?   In your case, it may be that the DSP is returning RingIO_E_NOTFOUND because the RingIO object has not been created on the GPP.   Are you calling RingIO_create() on the GPP?

    The RingIO sample on the rtos side calls RingIO_open() in a loop:

        do {
            Error_init (&eb) ;
            status  = RingIO_open (RingIOApp_instName,
                                   &rioOpenParams,
                                   NULL,
                                   &rioReaderHandle);
            if ((rioReaderHandle == NULL)|| (status < 0)){
                System_printf ("ERROR:Failed to open RingIO in Read mode."
                               "status 0x%x\n",status) ;
            }
        } while (rioReaderHandle == NULL) ;

    This is probably to wait for the GPP side to create the RingIO object.  Are you also calling RingIO_open() in such a loop?

    Best regards,

       Janet

  • Hi Janet,

     

    In Arm side everything is ok. No error in MessageQ as well as RingIO. But in DSP messageQ is working but RingIO is giving not found error.

    From my experiments I found that If I open RingIO before MessageQ, RingIO is working but MessageQ will not work. It seems to be some conflict between the two.

    Do you have any pointers on this?

    Thanks

    Jibin

  • Jibin,

    I am not aware of any conflicts between MessageQ and RingIO.  Does MessageQ on the DSP side also return NOTFOUND when you open the RingIO object first?  It sounds like there's a timing issue.  What are the names of the RingIO and MessageQ objects?  And, are you looping on the DSP side until you successfully open the object?

    Best regards,

        Janet

  • Hi Janet,

    The issue is solved by calling Syslink_setup() from the task in which the RingIO is accessed. Thanks for your valuable support.

    I have one more question for you. Do you have any information on McASP driver for DM8148 in SYSBIOS? This will help me to reduce number of RingIOs ...

     

    Thanks

    Jibin

  • Hi Jibin,

    Glad to hear you got your example running.  You may want to post your question regarding the McASP driver in a new thread on on BIOS forum, since I don't know the answer to this question.

    Best regards,

        Janet