This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

PMBus Writes - Check Sum Calculation

Other Parts Discussed in Thread: UCD9240

I'm trying to do configurations to UCD9240 device using the SMBus Data Flash Script.csv file I generate from Fusion Digital Power Designer tool, but I seemed to be getting nacked.  It seems that during block writes, there is a checksum packet that I need to place as well.  Is where a way for me to figure out the checksum at the end of each block write?  Thanks.

For example, the block write below is from the CSV file generated for UCD9240 from the Fusion Digital Power Designer tool:

BlockWrite 0x0B 0xF4 0x1400018BA003330A85024F000301570FA900000000

The actual write would be everything with the checksum at the end.  I'm trying to figure out how that check sum is calculated, so I may do manual writes to the devices.

BlockWrite 0x0B 0xF4 0x1400018BA003330A85024F000301570FA900000000E1

  • The Pmbus PEC (packet error check) is an 8bit CRC, polynomial 0x107 also known as CRC8. You can find info at  smbus.org.

    All bytes in the exchange are included in the PEC, including address and command, but not Ack bits

    Here is a C function to calculate the PEC:

    unsigned char crc8(unsigned char *d, int n)
    {
    int i;
    unsigned char pec;
       pec = 0;
       for (i=0; i<n; i++)
       {
          pec ^= d[i];
          pec = pec ^ (pec<<1) ^ (pec<<2) ^ ((pec&128)?9:0) ^ ((pec&64)?7:0);
       }
       return pec;
    }