Search code examples
eventsoperating-systemembeddedrteautosar

How to synchronise AUTOSAR RTE write and read values with different task runnable?


I am new to AUTOSAR and I would like to call a RTE function to get a specific value from one SWC to another SWC. The RTE_Write is performing by one SWC 1 runnable with 10 msec task and RTE_read is performing by another SWC 2 with 15 msec task. I am using sender receiver interface to implement this concept.

SWC 1 :

Task_10msec()
{
  eg:

  int val = 0;
  val = val +1 ; 
  Rte_write_test_port(val);
}

SWC 2 :

Task_15msec()
{
  eg:

  int val = 0;
  Rte_read_test_port(&val);
}

Now here i am facing the problem is that RTE_read value is not sync with RTE_Write value because of the runnable timing (SWC 1 is 10 msec and SWC 2 is 15 msec). I would like to know, is there any way to design the interface/ any approach to get the exact read value in SWC 2 after writing from SWC 1?


Solution

  • You could try to add a QueuedReceiverComSpec on the receiver port and set the queueLength to e.g. 2. You should then use Rte_Receive instead of Rte_Read API and read until it returns RTE_E_NO_DATA in order to get all values provided by the other component.