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.

ADS7843 SPI settings and output data format

Other Parts Discussed in Thread: ADS7843

I have a problem with ads7843. I saw in internet that the spi settings are CPHA=0, CPOL=0. I set them, SPI psc=256(fpclk/256, fpclk=72MHz). And in result I get from SPI only zeroes. I read X in such way:

k=WriteSPI(SPI1, 0xDC);

msb=  WriteSPI(SPI1, 0x00);

lsb=WrieSPI(SPI1,0x00);

And I get Y in the same way, but send 0x9C.

When I set CPHA=1, CPOL=0, and SPI psc=2, then I get data from spi. But what is the output data format? In different forums I saw

1) result=(msb<<8)| lsb;

2)result=((msb<<8) | lsb)>>4;

3)result=(((msb&0x7f)<<8)| lsb)>>3

what variant (1, 2, 3 ) is correct or the other one? 

I use stm32f107 as a master. TFT is wf43btibedotp(evaluation board sk-wf43btibedotp ). 

 

 

  • Hello Natali,

    The ADS7843 SPI timing/protocol has been provided on the Figure 7 (pg 10) of the d/s, where the SCLK (i.e.: ADS7843 's DCLK) is low when the SPI bus has not be activated and starts to send clock when activated; and the MOSI (i.e.: ADS7843's DIN) or MISO (i.e: ADS7843's DOUT) reads/latches a bit at the rising edge of the SCLK and writes/changes a bit at the falling edge of the SCLK,  which is the so-called SPI mode with the SPI clock polarity (CPOL) = 0 and clock phase (CPHA) = 0. You may capture your SPI bus (4 channels) waveform and send to me if you have  problem with the timing so that I may help with the debug.

    Since you command X reading with 0xDC and Y reading with 0x9C, it shows you are using 8-bit mode and single-ended input.

    For the 8-bit mode, the data format, in fact, should be -

    result = ( ((msb & 0x7F) <<256) | lsb) >> 7 

    BTW#1: under the 12-bit mode, the data format is: result = ( ((msb & 0x7F) <<256) | lsb) >> 3 

    BTW#2: for better performance, please use differential mode for touch data reading.

    Regards,
    Wendy F.