CRC in nextion DIsplay

Hi is there any method and code you can provide for implementing CRC in enction display as i am doing communication over UART with STM32 microcontroller also Nextion model is Intelligent series NX8048P070 i have to send data over Nextion display by STM32 microcontroller via UART and vice-versa also as communication is in serial mode there is no such error till now but sometime i recieve wrong values as my sending speed from nextion is 400ms on every 400ms nextion display is sending the request.

where do you receive the wrong values? for example, if you’re using the sprintf function the wrong way in your stm32, it could be outputting wrong values. hook up a usb-serial convertor in place of the device which you see the wrong data at, and check if you’re really getting a wrong data. if you want to implement crc calculation in nextion, nextion has bitwise operators and serial communication buffer calls so you should be able to implement it from scracth, check the link for a general guide for crc calculation below:

If you search the forum I have crc16 code for the nextion