Crc32 Hash for Multicast Ethernet address resolution in MPC5748G

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Crc32 Hash for Multicast Ethernet address resolution in MPC5748G

Jump to solution
2,433 Views
farozeibnejava
Contributor III

How to calculate Crc32 Hash for Multicast Ethernet address resolution in ENET MPC5748G or similar MCUs? i tried many different website codes but could not get it working.

Labels (1)
Tags (2)
1 Solution
1,941 Views
martin_kovar
NXP Employee
NXP Employee

Hello Danish.

I am sorry for the long delay. I tried to find out some information regarding your question.

I spoke with my colleague, who is ENET MCAL developer and he applied me, that there is missing some information in MPC5748G reference manual and also in MCAL documentation regarding CRC algorithm.

The code used in MCAL is correct, but right now, I am not able to point you to any document which describes it. Requirement for documentation update was created, so I hope next release of MCP5748G reference manual will be correctly updated and this information regarding CRC will be added.

Regards,

Martin

View solution in original post

9 Replies
1,941 Views
farozeibnejava
Contributor III

Any reply please!!

0 Kudos
1,942 Views
martin_kovar
NXP Employee
NXP Employee

Hello Danish.

I am sorry for the long delay. I tried to find out some information regarding your question.

I spoke with my colleague, who is ENET MCAL developer and he applied me, that there is missing some information in MPC5748G reference manual and also in MCAL documentation regarding CRC algorithm.

The code used in MCAL is correct, but right now, I am not able to point you to any document which describes it. Requirement for documentation update was created, so I hope next release of MCP5748G reference manual will be correctly updated and this information regarding CRC will be added.

Regards,

Martin

1,940 Views
farozeibnejava
Contributor III

Thanks for help Martin. much appreciated

0 Kudos
1,941 Views
martin_kovar
NXP Employee
NXP Employee

Hello Danish,

I am not sure if I understand your question correct. Are you looking for the following polynomial to compute the CRC32 hash?

pastedImage_1.png

Regards,

Martin

0 Kudos
1,941 Views
farozeibnejava
Contributor III

Hi Martin,

No. I already have the Polynomial and also the working C code from Freescale MCAL. What is need is a written description of how to calculate this Crc. i.e. Initial value, Input Reflection, Output reflection, Final Xor value. I don't find this information in MPC5748G Reference Manual in ENET Multicast address resolution chapter. Only Polynomial is defined there.

regards,

Danish

0 Kudos
1,941 Views
martin_kovar
NXP Employee
NXP Employee

Hello Danish,

please check this web page:

Catalogue of parametrised CRC algorithms 

Look at the CRC-32, which is used for Multicast address resolution in ENET module.

Hope it helps.

Regards,

Martin

0 Kudos
1,941 Views
farozeibnejava
Contributor III

Hi Martin,

it says, 

width=32 poly=0x04c11db7 init=0xffffffff refin=true refout=true xorout=0xffffffff check=0xcbf43926 residue=0xdebb20e3 name="CRC-32"

Final xorout here is given as 0xffffffff, but Freescale MCAL uses xorout=0x00000000. And Freescale code actually works on MPC5748G hardware and final xorout=0xffffffff doesn't work. This is really confusing me since i'm unable to provide any traceability on this final xorout=0 value. if there were some deviations in ENET controller it should have been made clear in MCU reference manual.

regards,

Danish

0 Kudos
1,941 Views
martin_kovar
NXP Employee
NXP Employee

Hello Danish,

my colleague sent me some source code, which he uses for CRC32 calculation in Kinetis microcontrollers. Because ENET module is the same, you can use this code also for MPC5748G:

void ENET_AddMulticastGroup(ENET_Type *base, uint8_t *address)

{

    assert(address);

 

    uint32_t crc = 0xFFFFFFFFU;

    uint32_t count1 = 0;

    uint32_t count2 = 0;

 

    /* Calculates the CRC-32 polynomial on the multicast group address. */

    for (count1 = 0; count1 < ENET_FRAME_MACLEN; count1++)

    {

        uint8_t c = address[count1];

        for (count2 = 0; count2 < 0x08U; count2++)

        {

            if ((c ^ crc) & 1U)

            {

                crc >>= 1U;

                c >>= 1U;

                crc ^= 0xEDB88320U;

            }

            else

            {

                crc >>= 1U;

                c >>= 1U;

            }

        }

    }

 

    /* Enable a multicast group address. */

    if (!((crc >> 0x1FU) & 1U))

    {

        base->GALR |= 1U << ((crc >> 0x1AU) & 0x1FU);

    }

    else

    {

        base->GAUR |= 1U << ((crc >> 0x1AU) & 0x1FU);

    }

}

Regards,

Martin

0 Kudos
1,941 Views
farozeibnejava
Contributor III

Hi Martin,

As i mentioned previously, i have the running code without any issue. My problem is that I can't provide Traceability of this algorithm to any document. (which is requirement for Safety Team in our department). Can you provide any document from Freescale that may provide some insight. Or perhaps link to some online content.

You provided this link...

  • please check this web page:

      Catalogue of parametrised CRC algorithms 

It say final xor value is 0xFFFFFFFF but your friend's code doesn't use this final xor value. why is it so?

regards,

danish

0 Kudos