The reset signal of the CRC-component is synchronus to clock, so there must be a reset while a clock pulse comes. The clock pulse will come only while receiving a byte from UART, so there will be at least one bit missing in the CRC.
Since CRC is mostly used to ensure transmission of several bytes(messages) I would suggest to use the Start() and Stoip() APIs to clear the CRC-component.
Another point would be: You have a loop-delay which will be completely unsynchronus to the receiving baud-rate, CRC-generation can be in the middle of a byte, no exact result possibe.
You declared a local loop-variable as "volatile" which is not needed, but you forgot to declare your global "nb"-variable as "volatile" because this is changed in an interrupt handler.
Thanks for you fast answer.
I make the modification that you provide me and made some new test... In the same time, I received an answer from the technical support concerning the CRC in modbus and I can't use it for an external device (in may case IHM) so the only way to check the CRC is by software.
I am interested in your Modbus-RTU implementation, would it be possible to email me the component or project?
Very interesting Olivier. Does it work 100% right?? If so, please contact me via email cause I'm planning to use it on the psoc 5lp platform
Olivier, please contact me as soon as you can, have proposal might interest you. Thanks!
I am looking for MODBUS-RTU slave for PSoC 5lp wonder if we can cooperate on that
Perhaps you want a simple version : PSoC5LP_ModbusSlave.zip
( PSoC4CY8CKIT-059 PSoC 5LP / PSoC Creator 3.3 )
It here (Russian): http://mylab.wmsite.ru/moi-razrab/cypress-psoc/modbus/