AnsweredAssumed Answered

Two SPC5EL60 communicating via UART

Question asked by colla.ivan on May 3, 2016
Latest reply on May 10, 2016 by Erwan Y
Good morning to everyone.

I am trying to have two mocro (SPCEL60 family) tha exchange some bytes. The micros are connected via UART. I am using the serial driver in cluded in SPC5 Studio.

Now I am tryong to use chnWrite and chnRead ol alternatevily sdGet and sdPut.

I am searching for instructions or tutorial, but I found only simple things (like continuosly send some bytes).

The problem I am trying to solve is the subsequent:
micro A do some thing and calculate a value.
micro B do the same thing.
micro A send the value to B.
B receive the value verify if is the same his.
B send the value to A.
A receive the value. If the value match, the two micro start again doing calculations, until the next comparison.

What I don't clearly understand is how to achieve this sort of "conversation". The two micro are not synchronous.

If I correctly understand, B should wait, for example calling a chnRead. But if micro transmit before B call that function? When B call the chnRead, it find the value in an underlying buffer managed by the hardware? Or the value is lost and B wait forever?

Are there standard methods to apply in order to achieve a two way exchange of values between tow micros connected via UART?

Regards,
Ivab

Outcomes