2016-05-03 08:51 AM
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 #uart2016-05-10 01:49 AM
Hello Ivan ,
You do not need to synchronize the 2 micros. to communicate the 2 devices should share the same parameters Did you use the Output Formatter component (From OS-Less or RLE) or Chibios Output formatter ? Often , when i communicate by UART (ESP8266 (Arduino), Other Micros ..) , i use this component. Example of source code with AT communication with ESP8266 in attachment Best regards Erwan ________________ Attachments : source.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006qUqP&d=%2Fa%2F0X0000000bno%2FUvmpYP_DTMB_f1fZEfil9dIEbdn43iu1Ggj4ImGOdHA&asPdf=false