Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Hi all i am Chetan new to Psoc

   

I am working on my college project where i have to calculate crc of the data using the generator polynomial and then that crc is attached to data once again and crc of the data+crc calculated whose remainder should be 0

   

My generator polynomial is X^16+X^12+X^11+X^10+X^8+X^7+X^6+X^3+X^2+X^1+1

   

Presently i am using SPI master to transmit data serially to CRC component present in the library

   

my code;

   

#include <device.h>
uint16 crcval,crcval1;
uint8 arr[2]=0;
void main()
{
SPIM_1_Start();
CRC_1_Start();
arr[0]=0x9a;
SPIM_1_WriteByte(0x9a);
CyDelay(1);
crcval=CRC_1_ReadCRC();
//CyDelay(1);
LCD_Char_Start();
LCD_Char_Position(0,0);
LCD_Char_PrintInt16(crcval);

SPIM_2_Start();
CRC_2_Start();

arr[1]=HI8(crcval);
arr[2]=LO8(crcval);

SPIM_2_PutArray(arr,3);//the data 9a+fcs is fed into array and array into SPI 2
CyDelay(2);
crcval1=CRC_1_ReadCRC();
LCD_Char_Position(1,7);
LCD_Char_PrintInt16(crcval1);
LCD_Char_Position(1,0);
LCD_Char_PrintInt8(arr[0]);
LCD_Char_PrintInt8(arr[1]);
    LCD_Char_PrintInt8(arr[2]);
    for(;;)
    {
        /* Place your application code here. */
    }
}
 

   

The data is inconsistant as the (data+crc )'s crc is not 0 .

   

I have been on this problem since very long please help.

   

i am attaching the schematic

   

Thanks

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

Attached is a project, that is tested to work perfectly.

View solution in original post

0 Likes
3 Replies