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.

DAC8760: SPI communication CRC verification technical support

Other Parts Discussed in Thread: DAC8760

Hi Team,

We are debugging the functions of DAC8760 and it is normal.Now because of the requirements of anti-jamming, we hope to add CRC check to SPI communication.

We used the following CRC8 algorithm, and the polynomial is x8+x2+x+1. However, It didn't work. We are looking for your support. Is there a DEMO C program with CRC verification for our reference? Thank you!

unsigned char crc_high_first(unsigned char *ptr, unsigned char len)

{

    unsigned char i; 

    unsigned char crc=0x00;

 

    while(len--)

    {

        crc ^= *ptr++; 

        for (i=8; i>0; --i)  

        { 

            if (crc & 0x80)

                crc = (crc << 1) ^ 0x07;

            else

                crc = (crc << 1);

        }

    }

 

    return (crc); 

}

 

  • Hi,


    I'm sorry but we don't have any example code for the CRC implementation. However, it is a standard CRC and there are plenty of examples that you can find online for the code. I did find one E2E post that did have a link to some example code, along with a calculator:

    https://e2e.ti.com/support/data-converters-group/data-converters/f/data-converters-forum/748586/dac8760-crc-8-atm-calculation-algorithm

    Just in case you need an example, here's an write to register, and then a readback of the register sent to the device:

    Write:
    0x01 0xBB 0x80 0x3A


    Read:
    0x01 0x00 0x00 0xD6

    In each case the last byte is the CRC result. I've used the calculator to verify the value.


    Joseph Wu

  • Follow your Example:

    Write:
    0x01 0xBB 0x80 0x3A, the DAC doesn't set the output accordingly.

    But I also do the test, without CRC_Enable, 

    Write:
    0x01 0xBB 0x80, the DAC works OK.

    I don't know what's wrong with it?

    I find the same problem as below. I don't know how to solve it?

    https://e2e.ti.com/support/data-converters-group/data-converters/f/data-converters-forum/748586/dac8760-crc-8-atm-calculation-algorithm

  • Min,

    I'm out of the office for today and tomorrow, so responses may be delayed.

    Can you use an oscilloscope and plot the communication with the device to show a couple of transactions with the device? Show the SCLK, DIN, and LATCH.

    I'd like to see the write setting the CRC and then the writing of the 0x01 0xBB 0x80 0x3A just to check. Make sure there's enough detail so that we can read the bit stream vs SCLK. The second sequence might be hard to put into one screen, so you might have to break it up into multiple shots.

    Joseph Wu

  • If CRC is not turned on, dac8760 output is OK!  But in some noisy occasions, data errors will occur. So we hope to turn on CRC.

  • When CRC is turned on, the output of dac8760 keeps 4mA unchanged! Alarm pin low level.

  • Hi Min,

    Thank you for the scope shots. Joseph will take a look at them when he is back in office tomorrow.

    Best,

    Katlynne Jones

  • Min,


    I don't see any thing wrong with the setup, but it might be missing a command, or there might be something else. I decided to try it out myself and see if there was anything wrong, but I was able to get it to work. I would just try to duplicate my sequence. First these are the commands I sent (in order, without other commands). These are the four commands I used.

    0x57 0x00 0x08 - Enable CRC
    0x55 0x00 0x05 0xFF - Set range to 4-20mA out
    0x55 0x10 0x05 0xA8 - Enable output
    0x01 0x10 0x00 0x3C - Set DAC to 1000

    After the third command, my output went to 1.2V so I know that my output is getting the current. I have a 300Ω load on the output. After the fourth command, I see the output go to 1.5V.

    Here are the scope shots of my data lines. Yellow is /CS (or LATCH), Blue is DIN, Pink is SCLK, Green is ALARM.

    1. 

    2. 

    3. 

    4. 

    It may be a little hard to see, but the shots are in order and you should be able to read the data sent to the device. In my test, these four commands are the only ones sent to the device. Again, I would try to duplicate the sequence just to make sure it works.


    Joseph Wu