I am using LIN as SCI mode (SCI2) to only recieve message which i am sending over UART from ESP32 board.When i try to recieve the message the data recieved is not consistent over time some random data is recieved.
I am attaching my code below:
void get_gps(){
j=0;
sciReceiveByte(scilinREG);
char c = scilinREG->RD;
if(c=='$'){
sciReceive(scilinREG,BUFFER_SIZE,(unsigned char *)rxBuffer);
char *token;
token = strtok(rxBuffer,",");
latitude = strtod(token,&endptr);
while (token != NULL && j<4) {
if (j ==1) {
longitude = strtod(token,&endptr);
}
else if (j == 2) {
velocity = strtod(token,&endptr);
}
else if(j==3){
altitude = strtod(token,&endptr);
}
token = strtok(NULL,",");
j++;
}
}
}
BUFFER_SIZE = 32 ,char rxBuffer[BUFFER_SIZE];
SCI data formats : baud rate -115200 , stop bits - 1 , parity - even ,parity - enable , data bits -8.