- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello everybody,
I implemented on Psoc3 a signal conditioning with a Modbus-RTU interface (it's works well since 1 year). The CRC is checked by software. I would like to upgrade this application and to generate the CRC by hardware instead of software but I don't succed it, the CRC is always wrong. I just made this little test (enclose) to check the CRC...If someone has already implemented the same interface(Modbus-RTU with hardware CRC)??
- Labels:
-
PSoC 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Bob,
I understand that it is necessary to create some logic between UART and CRC components. But i can't set CRC componet up for calculating Modbus RTU CRC. I just slightly change the CRC example project by changing Polynomial Value to 0xA001 and seed value to 0xFFFF, but CRC output does not meet with expected result.
Coud you please give me advice how to right configure CRC component?
My testing confiration you could find in attachment.
Thank you.
Jan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
My working CRC configuration for Modbus RTU is folowing:
Polynomial value - 0xC002
Seed value - 0xFFFF
Data in - LSB first
result is in format LSB->MSB.
For HW CRC calculation is necessary put 16bit shift register between UART tx_data and CRC di and add simply verilog component that holding CRC component in reset during first 16bits.
I tested HW Rx CRC calculation until maximal uart baud rate 921600 baud/s.
Jan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Bob,
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Olivier, please contact me as soon as you can, have proposal might interest you. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Oliver,
I am interested in your Modbus-RTU implementation, would it be possible to email me the component or project?
Yungky
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Oliver
I am looking for MODBUS-RTU slave for PSoC 5lp wonder if we can cooperate on that
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Perhaps you want a simple version : PSoC5LP_ModbusSlave.zip
http://mylab.wmsite.ru/ftpgetfile.php?id=140
( PSoC4CY8CKIT-059 PSoC 5LP / PSoC Creator 3.3 )
It here (Russian): http://mylab.wmsite.ru/moi-razrab/cypress-psoc/modbus/