I used the built in Matlab CRC Generator "comm.CRCGenerator" because it references the IEEE Standard of Ethernet in Section 3.2.9 page 57 from "https://ecfsapi.fcc.gov/file/1050839507018/IEEE%20Standard%20for%20Ethernet.pdf"
comm.CRCGenerator follows steps a-e of Section 3.2.9 - Frame Check Sequence (FCS) Field.
Under the original "crcGen = comm.CRCGenerator" I had to change some true and false and add a few lines of code to make it return the correct CRC. I added lines (1) and (2) and set their values to true. (NOTE: from comm.CRCGenerator Document, the original CRC32 will show 2 examples for computing 2 different ways on how to compute the same CRC. A "Direct" way and "NonDirect" way)
'Polynomial', poly, ...
'InitialConditions', 0, ...
'ReflectInputBytes', true, ... % This (1) line was added and set to 'true'
'ReflectChecksums', true, ... % This (1) line was added and set to 'true'
'DirectMethod', false, ...
How to input:
Input 8 bit HEX string the command window by
Or you can create a new scrip to call this function
*** Make sure you change the input would be byte and enter as '12345678'
WARRIOR24 (2021). crc32 (Follows IEEE Standard of Ethernet in Section 3.2.9 ) (https://www.mathworks.com/matlabcentral/fileexchange/84667-crc32-follows-ieee-standard-of-ethernet-in-section-3-2-9), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!