Simultaneous communication between A7 and M4 using rpmsg in iMX7D

Hi,

We have developed a smart device application on Visual Studio for Win CE 7 Colibri iMX7 Platform that utilizes Rpmsg library for loading FreeRTOs application( blinking_imx_demo ) to cortex M4 core and for the communication between A7 and M4 core.

We are able to communicate between A7 and M4 core . Now we are in a process to setup a communication interface between two cores and have some queries:

  1. Is it possible for A7 and M4 core to send data simultaneously i.e. while A7 is transmitting data, M4 is also transmitting ?
  2. Communication between two cores using rpmsg is half duplex or full duplex ?
    and if full duplex, is it handled properly ?
  3. We want to develop a bare metal application on M4 side. Does above functionality possible with bm application ? We have seen the “str_echo_freertos” demo example of freeRTOS running successfully. so going with bm approach.

Regards
Bipin Kumar

Dear @bipin7301

  1. Yes, it is possible that both cores transmit data simultaneously.

  2. rpmsg is full duplex. We did not do intensive tests, so I can’t make any statement about the reliability. However, I don’t see an obvious reason for problems: Data transfer is done through the Messaging Unit (MU) - a dedicated hardware to transmit messages between multiple cores. This hardware has fully independent channels for each direction, therefore I expect it to properly work.

  3. You can use a BM application. Of course you need to implement the rpmsg protocol, if you want to use rpmsg on the WEC7 side.
    Another approach would be to ignore rpmsg and define your own transfer protocol (with or without the Messaging Unit).
    In order to simplify the initialization of the M4, you could also base your project on freeRTOS, but finally not start the freeRTOS scheduler.

Regards, Andy

Hi Andy,

I have modified the “str_echo_bm” demo project of “freertos-colibri-imx7” for testing the rpmsg communication interface between A7 and M4 cores. I have also made a visual studio project on A7 side utilising “toradexcelibraries_2.3b4555-20190107” library. A7 side application has two threads one for sending data to M4 and one for receiving data from M4. M4 side application is sending data(0 to 99) continuously in while(1) to A7 once “Ready to recieve from M4” command is sent.
Please find in attachment:

  1. M4 side application modified “str_echo_bm.c
  2. A7 side project here BKRpmsgDemo

What we observed after running these application is that:

  • After some transfers from M4 to A7, A7 does not get receive event. However when we set the event manually(in A7 application ) then it takes out the next available data from the buffer, this deduces that M4 has sent the data and it was already there in the receive FIFO.
  • As per “Toradex_CE_Libraries.chm” file the DataAvailableEvent “The Rpmsg library provides a named event which is set as long as there is any data in the receive FIFO of the Windows CE CPU core”. see attachment DataAvailableEvent.
    However if it was the case then in our demo application the DataEventAvialabe event should have remained SET since the Rx buffer had the data from M4 already.

Few more points to ask:

  • Is it safe for multi threaded applications( Rpmsg read and write functions in A7 or M4 side applications)? suppose if one write data in one thread and at the same time some another thread is also tries to write data then Rpmsg write function blocked on first thread or not ?

Hi Raja,

In one of our scenario, we want to restart our A7 side application which communicates with M4(without the power cycle or reset ). So in that case what needs to be done in A7 side application so that communication with M4 can be reestablish without any glitch when the application restarts.

Regards
Bipin Kumar

Dear @bipin7301,

Data received event notification

The data received event notification is a flag event. It doesn’t work as it was documented and thank you for bringing this to our attention, we will correct the document soon.

For your case, as soon as WaitForSingleObject is returned due to the set event, you need to read all the messages in a while loop until it returns 0 then again go to wait state.

We used Auto reset event for this application, please read here for more information.

Multi threaded Rpmsg read and Write

We didn’t implement Sync objects inside the library for multiple Write and R/W simultaneous call. As you know, Sync object will do kernel call that will degrade the performance due to that we leave it to the application developer to use sync objects according to the requirement. If you want to do multi-threaded read and write then use sync objects inside your application.

Please let us know if you have any other questions.

Hi Raja,

I am waiting for your response for my query of 28th Feb.
Hope you were doing some background checks on this topic.

Regards
Bipin Kumar

Dear @bipin7301,

I am looking into it, Could you wait for some days, we will get back you as soon as possible.

Hi Raja,

Yesterday you have asked for the update on this question. So here is the update.

  1. We have used this interface as Master(A7) - Slave(M4) as Half duplex communication to avoid the issues with full duplex communication as i mentioned in my earlier comments. However it is just a workaround, we are expecting a permanent solution to this so that full throughput of this interface could be utilised.
  2. Another issue that we raised earlier
    “In one of our scenario,we want to restart our A7 side application which communicates with M4(without the power cycle or reset ). So in that case what needs to be done in A7 side application so that communication with M4 can be reestablish without any glitch when the application restarts.”
  3. Similar scenario like mentioned in point 2 at M4 side application. If we use watchdog at M4 side application and for some reason it resets, then how the communication between M4 and A7 re-establish.

Issues are still unanswered, we need your attention for the solution of the same.

Regards
Bipin Kumar

Dear @bipin7301,

Thank you for your reply with your queries. Could you please wait for a couple of weeks, I would like to discuss this with our team and get back you in a couple of weeks.

Dear @bipin7301,

Regarding the first issue, we have suggested a workaround for the full-duplex communication issue here, Did you try that? Is that solves the issue?
If it is not solving the issue, could you share the latest reproducible application? We couldn’t reproduce the full-duplex communication issue here.

Thank you.

Hi Raja,

Thanks for the response.
I am aware that you have suggested a workaround for my first issue earlier. But we are expecting a permanent solution to the issues.

Hope you understand our concerns and act on them ASAP.

Regards
Bipin Kumar

Dear @bipin7301,

Sorry, I would like to get clarified your last reply.

Could you say which one you are not happy the solution provided here : http://www.toradex.com/community/answers/34595/view.html
Is it that Data received event notification or Multi-threaded Rpmsg read and Write.

Hi Raja,

First is Data received event notification, event should reset at each message read, even if multiple messages available in Rx buffer. Event should remain signalled until a message is not read i.e. message wise event should be signalled. if it is so then interface would be much simpler.

Secondly, I am expecting response about my issues of application restart( by Watchdog or on some user defined condition) at either side( A7 or M4). How will application behave in these scenarios? How to establish communication between A7 and M4 again ?

Even if we handle the other issues of data event notification/Multi-threaded rpmsg read write by any workaround but the handling of application restart is much more important.

Regards
Bipin

Dear @bipin7301,

Thank you for your suggestions, we are planned to discuss your suggestions internally in the coming weeks and let you know the update.

Dear @bipin7301,

We have discussed internally your valuable suggestions. Sorry, at the moment we couldn’t implement those features now. Maybe we would consider later on but not sure.

Hence, we are requesting our customers to implement those features as per their product requirement.

Please feel free to contact us in the future if you need any support from our side.

Thank you.

Thanks Raja for the support and guidance you have provided so far for our development. Hope these features will be included in future releases.

Regards
Bipin