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.

RTOS/TMS320C6678: How to drain IPC MessageQ before recieve new msg?

Part Number: TMS320C6678

Tool/software: TI-RTOS

Hi, friends,I 'm developing an application based on IPC messageQ(Transportqmss) and  I met some problems.

My development environment  is as below:

tmdsevm6678le

CCS8.1.0.00011

bios_6_73_00_12

ipc_3_47_02_00

pdk_c667x_2_0_9

My application consists of a server(core0) and some clients(other cores). And my clients use some code below:

MessageQ_get(msgHandle, &msg, 500); 

So there may be some msg arrived after 500us and it remain in the message queue. Thus, next time the client use MessageQ_get() it may got a previous msg .

A solution is judge what msg it is using id, but I prefer not to use id.

Therefore, I want to drain message queue before calling  messageq_get().

So I use some code below  before current msg may reach:

MessageQ_get(msgHandle, &msg, 0);

But doing this, after my application ran for a while , some core may be hault and the ccs may report some error:

Trouble Halting Target CPU: (Error -1202 @ 0x0) Device core is hung. The debugger will attempt to force the device to a ready state to recover debug control. Your application's state will be corrupt. You should have limited access to memory and registers, but you may need to reset the device to debug further.

Some I think the way I drain the messgae queue is wrong. 

Is there anyone know how to drain message queue before waiting for new message?

Thanks for your help!

  • Hi,

    I've notified the RTOS team. They will post their feedback directly here.

    Best Regards,
    Yordan
  • Hello,

    You are using version 6.73 for BIOS but the latest version released with Processor SDK is 6.52. The SDK components have some interdependence so it would be best to use the versions that come up with the SDK. You can refer to the release notes for a table of compatible versions:
    software-dl.ti.com/.../Release_Specific.html

    To answer your question, messageQ_free() may be what you are looking for. Please take a look at the IPC User's Guide and cdocs for more information:
    processors.wiki.ti.com/.../MessageQ_Module
    downloads.ti.com/.../_message_q_8h.html

    I hope this helps.
  • Hi,Sahin, Thanks for your reply.
    I'll try the version of 6.52 tomorrow.
    But about the function of messageQ_free() and how to use it to solve my question I have some confuse.
    As my understanding and what the docs say, it is used to free messages back to its heap.This should be done when a message is no longer needed by application.
    However, My situation is that the message will be release in sometime else and it maybe be transported for many times. But at last it will be freed correctly.
    And In the meantime, I need to process message. My client will wait for a message for 500us, and If time is up, client will need to be post and do something else.At this time , the message my client is waiting for may come and be pushed into the message queue. And the next time my client call messageQ_get() , it will got the expired message instead of the latest message.
    So I want to clear the message queue before calling message_get().
    Can messageq_free() do this ? I have no idea about it. Can you tell me how to use it or is there any other way to achieve this?
    Thanks.
  • Hello,

    To confirm, you want to always get the latest message in the queue whenever you perform messageQ_get() right?

    We don't have API that specifically does this, but you can probably put messageQ_get() in a loop and use the messageQ_count() API to see how many messages you have left in the queue.
  • Hi,

    I have try your advice and it works well, but then I find that what cause the core hault is not the code of draining the message queue.

    It's the code below:

    MessageQ_get(msgQHandle, &msg, 500);

    When I modify it to

    MessageQ_get(msgQHandle, &msg, MessageQ_FOREVER);

    everything works fine.

    Do you know what may cause core hault when use messageq_get() with an specific vaule of timeout, or is there an alternative which can work the same way?

    Sorry for my delay feedback and Thanks for your help!

  • I have tested messageq_get() using timeout of 500 in transportQmssBenchmarkC6678C66ExampleProject and it works well.

    Does it mean that this problem will occur only when there are multicores(more than 2)  using messageq_get() with a specific value of timeout?

    And I reread the docs and I find that ISync will be use when specific timeout is used.

    Should I use SyncSem_create() when I use messageq_create() if I want to use specific timeout?

    However, even if I use it , the situation is the same.

    I need some help to figure it out , thanks.

  • Hello,

    Can you check ROV? Do you see any errors there?
  • HI,

    The main error I can see from rov is:

    Caught exception in view init code: Problem fetching remoteSystemInUseJavaException: java.lang.Exception: Target memory read failed at address: 0xc000880, length: 32This read is at an INVALID address according to the application's section map. The application is likely either uninitialized or corrupt.

    and

    Problem retrieving the instance's Attrs struct: JavaException: java.lang.Exception: Target memory read failed at address: 0xc005c80, length: 16This read is at an INVALID address according to the application's section map. The application is likely either uninitialized or corrupt.

    and

    JavaException: java.lang.Exception: Target memory read failed at address: 0xc09dd80, length: 8This read is at an INVALID address according to the application's section map. The application is likely either uninitialized or corrupt.

    And as you can see below:

  • HI,

    I have some progress.It seems that it's my code cause the core to hault .

    I change the timeout to 2000 and it work like messageq_forever, It's somewhat odd because through my measure It will get message at average 60us.

    Sorry for my carelessness and Thanks for your help!