cancel
Showing results for 
Search instead for 
Did you mean: 

CRC multithreading

EmbedMaster
Associate II
Posted on July 01, 2016 at 10:45

Good day.

In my program i use CAN interface. I send and receive messages (consist of few CAN packs) with crc.

  1. When i receive the CAN pack i put it into buffer and when the message complete i calculate it crc.
  2. Transmitting message

    depends on

    free CAN bus. When i can send another CAN pack i want to calculate next crc and send CAN bytes.

Time to send 8 full CAN packs with 250kbit/s is about 10ms. In this time i can not use CRC because it has no way to set the DR register, like CRC->DR=0x12345678; bool temp = (CRC->DR == 0x12345678); temp = true

So the question is - is there a way to do this? Or i need to use software calculation?

I mean function like this:

uint CRCcalc(uint previousCRC, uint data);

Thanks
2 REPLIES 2
Posted on July 01, 2016 at 12:05

In most STM32 families you must serialize access to the CRC resource. Others you can select the initialization value.

It is possible to compute a value to write to the DR that will change it from what it is, to what you want it to be, but you'd need to do that in software. So probably not a net win there for doing 8-byte frames at a time.

[DEAD LINK /public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Background%20CRC32%20in%20segments%20on%20STM32F4&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&TopicsView=https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/AllItems.aspx?Paged%3DTRUE%26p_StickyPost%3D%26p_DiscussionLastUpdated%3D20130305%252013%253a40%253a44%26p_ID%3D28690%26View%3D%257bF47A9ED8%252dE726%252d42BE%252dACED%252d732F13B66581%257d%26FolderCTID%3D0x012001%26PageFirstRow%3D41&currentviews=49]https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Background%20CRC32%20in%20segments%20on%20STM32F4&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&TopicsView=https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/AllItems.aspx?Paged%3DTRUE%26p_StickyPost%3D%26p_DiscussionLastUpdated%3D20130305%252013%253a40%253a44%26p_ID%3D28690%26View%3D%257bF47A9ED8%252dE726%252d42BE%252dACED%252d732F13B66581%257d%26FolderCTID%3D0x012001%26PageFirstRow%3D41¤tviews=49

[DEAD LINK /public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/STM32F4%20CRC%20-%20Preload%20CRC-DR&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=2306]https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=%2Fpublic%2FSTe2ecommunities%2Fmcu%2FLists%2Fcortex_mx_stm32%2FSTM32F4%20CRC%20-%20Preload%20CRC-DR&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B¤tviews=2306

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
EmbedMaster
Associate II
Posted on July 01, 2016 at 13:16

That what i am looking for!

Thank you.

Yeah,

opportunity

to set the reset value

looks very good

.

It would be great if it would be in each controller