Embetronicx / STM32-Bootloader

STM32 Custom Bootloader from scratch
76 stars 38 forks source link

CRC error in both directions #6

Open paloky opened 6 months ago

paloky commented 6 months ago

Hi, I am testing the Bootloader and App. I have problems with the CRC using UART. When I send the SOF from the APP, the bootloader gives me error when calculating the CRC. And the other way around too. If I send the ACK from the Bootloader to the App, the App also gives me an error in the CRC.

Inside Bootloader "*etx_receive_chunk( uint8_t buf, uint16_t max_len )" function: if( cal_data_crc != rec_data_crc ) { printf("Chunk's CRC mismatch [Cal CRC = 0x%08lX] [Rec CRC = 0x%08lX]\r\n", cal_data_crc, rec_data_crc ); ret = ETX_OTA_EX_ERR; break; } I get: cal_data_crc = 0x8B329C8 rec_data_crc =0x4E08BFB4**

I am using CubeIDE's hCRC component, but I don't see that anything can be configured this component.

In the other direction, the same thing happens to me... In function "etx_ota_send_resp( ETX_OTA_ACK );" The rsp.crc = HAL_CRC_Calculate( &hcrc, (uint32_t*)&rsp.status, 1); give me the crc=0xc704dd7b {sof = 170', packet_type = 3, data_len = 1, status = 0, crc = 0xc704dd7b, eof = 187} In the App I get: CRC Received: C704DD7B CRC Calculated: 4E08BFB4

Any idea what the problem might be? Thank's a lot.