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.

BQ78350-R1: How to calculate the PEC when read from Dataflash

Part Number: BQ78350-R1
Other Parts Discussed in Thread: BQ78350,

Hi Team,

I am facing in calculating the PEC for data I read from data flash.

For E.g to read serial number at dataflash address 0x406D I calculate PEC  0x94 for byte string of, 0x16 0x44 0x17 0x22 0x6D 0x40 0x11 0x11. but I receive on SMbus as 0x06.

I am using CRC width as 8

I need your help in in understanding of how ro calaculate the PEC for bq78350 dataflash read commands

  • Hi Shreyas,

    It looks like your calculation of PEC is correct for the byte string you sent. However, it looks like you have 0x22 for the data length - are you sure you want to read 34 bytes? I think this should be 0x04 and this would result in a PEC value of 0xBB.

    Best regards,

    Matt

  • Hi Matt,

    Please find the attachment. In the attached example I am reading dataflash value from address 0x44D3.

    There are three attachments,

    1. Sequence of PEC Input buffer for calculating the PEC

    2. Rx buffer the data received from data flash through manufacturing block access (0x44) read command

    3. Receive Buffer size, 

    In the attach example the length I get is 34 even though the rx size is 5. I am not sure how/why it is sending 34 as length every time while reading from dataflash.

    I need your help in calculating the PEC with received data. In Rxlocalbuff[5] I think PEC is received from GG as 16.

    Note: The value observed in the images are in decimal

  • Hi Shreyas,

    I checked and I see what you are talking about. In the TRM, reading from data flash is a 32 byte block, that is why the length is 0x22 (2 bytes for flash address and 32 bytes for data). The comes after the 32 bytes and it is correct. 

    For example, I powered up the BQ78350-R1 with default settings and changed the serial number to 0x1111. Then I read this from data flash:

    16 44 17 22 6D 40 11 11 11 54 65 78 61 73 20 49 6E 73 74 72 75 6D 65 6E 74 73 20 20 20 07 62 71 37 38 33 35 30 20 33

    (where 0x33 is the CRC)

    Best regards,

    Matt

  • Hi Matt,

    Does it mean we can only calculate the PEC only by reading the length of 32 bytes at a time from dataflash ?

    Regards,

    Shreyas Shroff

  • Hi Shreyas, 

    Yes, the PEC is calculated at the end of the read transaction. Data flash reads are 32-bytes according to the TRM.

    In the application, normally you should not need to read the data flash. There are commands that can be used to read the critical parameters and most commands return only a small number of bytes.

    Regards,

    Matt