How to use CRC for UART communication between multiple FRDM-K20D50M boards?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to use CRC for UART communication between multiple FRDM-K20D50M boards?

4,388 Views
Amit_Kumar1
Senior Contributor II

Hi

I am trying to communicate between 3 uc using UART but before that I tried with 2 uc and I found out that when the baud rate is 115200 the amount of garbage data is very high, If using the same code for same uc and diff. UART ports, i.e communication b/w UART1 and UART2 of same uc then no garbage is received at same Baud rate. So I want to filter the actual signal from garbage containing data, I came across this CRC_LDD processor expert component. I tried using this in my program but when I called the function CRC1_GetCRCResult(); I am getting some random nos some time negative and some time positive for the same string which I am transmitting and receiving on same UART port i.e I have shorted Rx-Tx. I have gone through the help of the component but still didn't got how to use this. Is there any way to get garbage free data at this baud rate as for 9600 baud rate, both the FRDM-K20D50M board is communicating without any garbage values. I am using UART1 PTE0 and PTE1 pins for both the uc from FRDM board pinouts.

Thanks & Regards

Amit Kumar

0 Kudos
5 Replies

1,820 Views
egoodii
Senior Contributor III

I'm concerned about what might be giving you so much communication trouble.  115,200 should be 'plenty slow enough' -- what does your physical layer look like, especially to share communication between 3 uC?  Clock sources too?  Having a communication-packet check, like CRC, is a 'great addition' to any protocol, but really you'd ought to expect <<0.1% faulted messages.

0 Kudos

1,820 Views
Amit_Kumar1
Senior Contributor II

Hi Earl

I have configured the clocks on each FRDM board at 48MHZ. I think we can communicate b/w at the most 2 uc on a single UART. And if we are communicating b/w 3 uc we need to have a RS-232 or RS-422/485 driver as the signal may be weak enough or may contain noise.So now I am trying with SN75176BDR (RS-422/485 driver IC from TI). and I am now communicating with 3 FRDM boards.i.e FRDM-K20D50M as master which is extracting data from the accelerometer from a slave FRDM-K20D50M, and magnetometer data from the FRDM-KL46 board. in that the maximum possible baud rate without any garbage I am getting is 38400. Slight improvement from before. The length of wire is 10cm and it is shielded twisted pair with 120E impedance.But still I didn't get how to use this CRC.

Thanks and regards

Amit Kumar 

0 Kudos

1,820 Views
egoodii
Senior Contributor III

So your basic systems clocks are 48MHz -- what is their primary source?  How accurate are these clocks?  UART byte framing can work with up to about +/-3% overall baud rate tolerance.  RS232 signals should be 'pretty darn reliable' up to 115,200 and out to 'several meters' (but can't be shared by multiple transmitters), and RS485 can do 10Mbits/s out to 100 meters or more.  Either one works on three wires, two signal plus ground.  I don't use PE so I can't really help you with their components.  I use the CRC module directly myself, in this case for a CRC32.  You don't mention what polynominal you are using.  This use is to scan thru my on-chip flash (four words at a time) out to, and including, the CRC at the end so that the result must be zero.

uint 32_t * memptr=(uint32_t *)boot_CRC_start;

SIM_SCGC6 |= SIM_SCGC6_CRC_MASK;
CRC_CTRL = CRC_CTRL_WAS_MASK | CRC_CTRL_TCRC_MASK;   //32bit CRC
CRC_CRC = 0xFFFFFFFF;                                  //Starting value
CRC_CTRL = CRC_CTRL_TCRC_MASK;
CRC_GPOLY = 0x04C11DB7;                       //Poly to match IAR 32-bit default
do{
    CRC_CRC = *memptr++;
    CRC_CRC = *memptr++;
    CRC_CRC = *memptr++;
    CRC_CRC = *memptr++;
}while (memptr <= (uint32_t *)&__checksum);
if( CRC_CRC == 0 )

......

0 Kudos

1,820 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Amit:

Did you get any improvement with the UART communication between the freedom boards?

I have not used the CRC_LDD component, but it seems that you have to call the ResetCRC method each time you want to obtain a new calculation.

Let us know what you found.

Kind Regards!

Jorge Gonzalez

0 Kudos

1,820 Views
Amit_Kumar1
Senior Contributor II

Hi Jorge

I am still unable to use CRC_LDD. There is some improvement which I mentioned in the below reply to Earl. But the problem is still not resolved.

Thanks and Regards

Amit Kumar

0 Kudos