This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hello,
I wrote the code according to the flowchart in this link www.ti.com/.../spna235.pdf , but the crc value I received is not the same as the required value. My code is as follows:
#include "sys_common.h"
#include "crc.h"
#include "reg_crc.h"
#include "rti.h"
#include "gio.h"
/* USER CODE BEGIN (1) */
#define PSA_SIGREGL1 ((crcBASE_t *)0xFE000070U)
uint64_t param1 [2] = {1, 2};
crcModConfig_t deneme = {
.mode = CRC_FULL_CPU,
.crc_channel = CRC_CH1,
.src_data_pat = param1,
.data_length = 2,
};
crcConfig_t deneme1 = {
.mode = CRC_FULL_CPU,
.crc_channel = CRC_CH1,
.pcount = 0U,
.wdg_preload = 0U,
.pcount = 1U,
.scount =1U,
};
/* USER CODE END */
/** @fn void main(void)
* @brief Application main function
* @note This function is empty by default.
*
* This function is called after startup.
* The user can use this function to implement the application.
*/
/* USER CODE BEGIN (2) */
/* USER CODE END */
uint8 emacAddress[6U] = {0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU, 0xFFU};
uint32 emacPhyAddress = 0U;
uint64 malim = 0U;
uint64 result_crc =0U;
int main(void)
{
/* USER CODE BEGIN (3) */
crcInit();
while(1){
crcChannelReset(crcREG, CRC_CH1);
crcSetConfig(crcREG,&deneme1);
crcSignGen(crcREG, &deneme);
malim = crcGetPSASig(crcREG, CRC_CH1);
}
/* USER CODE END */
return 0;
}
The data we need to get: 0x6C9E200000000000
The data I received: 0x0000000000000173
Apart from this, from which sources can I get data about the Peripheral bus operation of the crc module? The Reference Manual is not very detailed on this subject.
Best Regards,
Ata
Hi Ata,
I am working on your thread now and will provide you my update ASAP.
--
Thanks & Regards,
Jagadish.
Hi Ata,
The data we need to get: 0x6C9E200000000000
The data I received: 0x0000000000000173
The received data of 0x0000000000000173 was correct for the input data of 0x0000000000000001 and 0x0000000000000002.
CRC Calculation Online (lddgo.net)
However, i found couple of issues with the "crcSignGen" and "crcGetPSASig" functions in big-endian devices. And one issue with "crcGetPSASig" function little-endian devices.
1. Issue with crcSignGen function in big-endian devices:
High word goes into low PSA register and low word goes into high PSA register.
For example, see the below data moving into the PSA register for big-endian device(TMS570LS3137):
As you can see here i am trying copy the 0xAABBCCDDEEFFAABB value to the PSA registers and the result is that higher 32-bit data 0xAABBCCDD was moved into the lower register and lower 32-bit data 0xEEFFAABB was moved to the higher register. But actually, it should be in reverse then only we will get the proper CRC value for our input data.
For same data i tested on little-endian device(RM57L8x):
Now the data moved correctly to the PSA registers, i mean lower 32-bit was copied to the lower register and higher 32-bit was copied to the higher 32-bit register. So in this case we will get proper CRC value.
The solution for big-endian device is that we should need to swap the lower and higher 32-bit data before copying into the PSA registers. For more details about solution you can refer second thread i linked.
2. Issue with crcGetPSASig function in both little and big-endian devices:
Even after generating proper CRC also, crcGetPSASig function not returning CRC value properly.
Example i am giving 0xAABBCCDDEEFFAABB and 0x9988776655443322 data.
For this data i should get 0xEB3741C214EFE6C3 CRC.
As you can see i got correct CRC, 0xEB3741C2 value into higher PSA register and 0x14EFE6C3 into lower PSA register. But the problem is while copying total 64-bit data to the status variable we are shifting lower 32bit PSA register value by 32 times instead of higher PSA register value.
Please make sure these two errors in your code.
--
Thanks & Regards,
Jagadish.