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.

Can't get readings and PENIRQ getting down with ADS7843

Other Parts Discussed in Thread: ADS7843

Hello,


May i ask assistance, i'm getting trouble to get a ADS7843 working with a Pic 18F97J60

I can't read X and Y positions, and PENIRQ won't get down.

Here is the schematic i use :

With no software running and No Touch i get the following voltages :

X+ = 2.28V    X- = 2.30V     Y+=0V     Y- = 0V

With no software running + Touch i get the following voltages : ( maybe an issue there ? )

X+ = 0V    X- = 0V     Y+=0V     Y- = 0V

The measured resistance between pins are :

X+ and X - = 415 ohms

Y+ and Y- = 555 ohms.

--------------------------------------------------------------------------------

First, i try to init the ADS7843 with the following function :

I need to use PENIRQ pin, so at the end of the init function i send (0xD0) in order to set the power down mode and get PENIRQ enabled. ( i'm not sure its the proper way to proceed )

#define ADS7843_SPICON1_CFG  (0x21)        /* (0x2x) is used for SPI mode 0,0  */
// 0x21 => Fosc/16 -> SCK frequency : 40/16 = 2.50 Mhz

...

void Init_ADS7843(void)
{
// Configure PENIRQ pin
    Touch_PenIRQ_TRIS = 1;                        // Touch_PenIRQ is input

    // Set up the SPI module on the PIC for communications with the ADS7843 :
    ADS7843_CS_IO = 1;                            // Disable ADS7843 CS pin
    ADS7843_CS_TRIS = 0;                         // Pic CS pin is output
                    
    ADS7843_SCK_TRIS = 0;                          // Set SCK pin as an output
    ADS7843_SDI_TRIS = 1;                          // Make sure SDI pin is an input
    ADS7843_SDO_TRIS = 0;                        // Set SDO pin as an output

    ADS7843_SPI_IF = 0;                            // Clear SPI Flag

    ADS7843_SPISTATbits.CKE = 0;                 // Transmit data on transition from Idle to Active clock state
    ADS7843_SPISTATbits.SMP = 0;                 // Input sampled at middle of data output time

    Delay10us(1);
    
    ADS7843_read(0xD0);                            // Send a read sequence in order to activate PENIRQ (PD1 and PD0 = 0)
}

Here is my reading function :

unsigned short int ADS7843_read(unsigned char address)
{
    volatile BYTE Dummy;    
    unsigned char msb, lsb;
          
    ADS7843_CS_IO = 0;                                // Enable CS
    ADS7843_SPI_IF = 0;                               // Clear SPI Flag

    _asm        NOP        _endasm                    // Add delay after CS goes low (0.1 µs = 100 ns)

    ADS7843_SSPBUF = address;                        // Transmit Start bit ( SSP1BUF )
    while(!ADS7843_SPI_IF);ADS7843_SPI_IF = 0;      // Wait until data is shifted out
    Dummy = ADS7843_SSPBUF;                            // Reading SSPBUF clears SPI Buffer
       

    ADS7843_SSPBUF = 0x00;                            // Send dummy value (0x00) in order to get the FIRST 8 bit byte
    while(!ADS7843_SPI_IF);ADS7843_SPI_IF = 0;      // Wait until data is shifted out
    msb = ADS7843_SSPBUF;                              // Get the FIRST 8 bit byte ( 8 clock edges )
       
    ADS7843_SSPBUF = 0x00;                            // Send dummy value (0x00) in order to get the SECOND 8 bit byte
    while(!ADS7843_SPI_IF);ADS7843_SPI_IF = 0;      // Wait until data is shifted out
    lsb = ADS7843_SSPBUF;                              // Get the SECOND 8 bit byte ( 8 clock edges )
       
    ADS7843_CS_IO = 1;                                // Disable CS
   return ((msb << 8) | lsb) >> 3;                 // Put the result in 16 bits : msb goes right and add the lsb
}

From the main loop of the program i check if PENIRQ goes low, then i read X and Y positions afterwards.

   while(1)
    {

     if (Touch_PenIRQ_IO == 0)        
        {
        PEN_X_pos = ADS7843_read(0x90);
        PEN_Y_pos = ADS7843_read(0xD0);
        }

Here are attached 2 logic SPI screen captures :

- One is without Touch :

During Init_ADS7843 and later during ADS7843_read for X and Y positions :

MISO is not getting any response back  to 0xD0 sent previously.

- Second one is when a Touch happens :

During Init_ADS7843 and later during ADS7843_read for X and Y positions :

MISO is not getting any response back to 0x90 and 0xD0 sent previously and PENIRQ stays high and won't get low !

Any help will be much appreciated,

Best regards,

logic screen captures.zip
  • Hi COULON,

    From the schematic, I could not see how the ADS7843 is powered, that is: how the ADS7843 pins 1, 10 and 6 are connected. I  concern about it  because: at normal condition, when No SW running and no touch, the 4 analog pins should be: X+ = X- = Vcc;  Y+ = Y- = GND, but you stated that you measured X+ ~= X- < Vcc.

    The second concern is at the SPI DCLK polarity (CPOL) and phase (CPHA), please also refer to Table VI and Figure 7at page 10 of the ADS7843 data-sheet. At ADS7843 CPOL=CPHA=0, where data lines (DIN and DOUT) change/write at the falling edge of the DCLK; and a bit at DIN or DOUT is latched/read (and thus must be kept stable) at the rising edge of the DCLK. From the SPI waveform you provided, it seems that you had CPOL=0 and CPHA=1. Please check to match ADS7843 SPI requirement.

    Thanks,
    Wendy F.

  • Thanks, Wendy.

    I confirm the chip is powered with pin 1 & 10 = 3.3V and pin 6 is grounded.

    When you say X+ = X- = Vcc and Y+ = Y- = Gnd, do you mean the touch panel has to be connected to the ADS7843 chip or these measurements should be done directly on the chip without the touch panel connected to it ?

    With no touch panel connected to the chip and no software running, just the 100K pull up resistor connected to PENIRQ and Vref pin connected to Vcc,

    i confirm that i still having X+ ~= X- ~= 2.3V

    Is this voltage not enough, should it be exactly 3.3V ?

    Are there some further tests i should do to confirm the chip is not defect ?

    Many thanks for your help,

  • Hi COULON,

    Thanks for the info!

    It seems some problem with the panel and ADS7843 connection. What I mean is the touch panel and ADS7843 are connected. The connection should be as simple, as short, as secure as possible, to reduce noise and malfunction of the whole touch system.

    Regards,
    Wendy F.

  • What voltages should i found on X+ X- Y- Y+ when the touch panel is not connected to the ADS7843 ?

    At the moment, with no touch panel connected andno software running, i get :

    X+ (pin 2 ) = 2.28V  ; Y+ (pin3) = 0V ; X- (pin4) = 0V ; Y- (pin5) = 0V

     

    If i keep the touch panel disconnected and i remove R22 ( PENIRQ pull up resistor ), then i get all voltages = 0V

    X+ (pin 2 ) = 0V  ; Y+ (pin3) = 0V ; X- (pin4) = 0V ; Y- (pin5) = 0V

     

    I need to confirm the chip is working fine with no touch panel connected, would you please tell me if these measurments are correct ?

    If they are not, maybe ADS7843 chip has been damaged and needs to be replaced ?

    Many thanks,

  • Hi COULON,

    A 4-wire resistive touch panel, if not connected to the controller, can be measured with an ohmmeter --

    Without touch:

    X+ to X- (or Y+ to Y-): 200ohms ~ 1000ohms

    X+ (or X-) to Y+ or Y-): infinite or hundreds Mohms

    With touch:

    X+ to X- (or Y+ to Y-): 200ohms ~ 1000ohms (exact the same as that without touch)

    X+ (or X-) to Y+ or Y-): some 100s ohms to some 1000s ohm, decided by pressure on the panel, stronger pressure results in lower ohms.

     

    After connecting touch panel to the controller, you may then use a voltsmeter to measure the analog interface to make sure the connection is good:

    Without touch and without SW running:

    X+ = X- = Vcc (the /PENIRQ is enabled)

    Y+ = Y- = GND.

    With touch and without SW running:

    X+ = X- = Y+ = Y- = GND.

    Hope the above info help with your debugging!

    Regards,
    Wendy F.

  • I do confirm i've measured the values you stated in your last post, this means my touch panel is working properly.

     

    For now, it looks i have an issue with the ADS7843 init function :

    Here is the logic capture for my init sequence : i send 0xD0 in order to enable PENIRQ , ADS7843 responds 0x10 ( i don't know why i get this value back because there was no touch on screen yet )

    Afterwards, reading X and Y pos always return 0xFF for MSB and LSB whatever there was a touch on the screen or not.

     

    - Do you confirm it is mandatory to enable PENIRQ during an init sequence, i've found that at the power-up of the ADS7843 PENIRQ is already staying high when there is no touch on the screen and goes low when a touch occurs.

     

    - Once the software init function has been ran, then PENIRQ no longer responds ( always stays high ) even a touch has been done on the screen.

    I've tried to change R penirq value : 10K, 47K, 100K ohms but the problem remains ! 

     

     Is there something to be done to fix PENIRQ problem ?

     I've read your article :  http://www.ti.com/lit/ml/slyt292/slyt292.pdf but i did not find the solution yet.

     

    - My SPI settings are CPOL  = 0 and CPHA = 0, SCK speed is 650 khz

     Can you tell me SMP setting should be ?

     

    Many thanks for your help,

  • I got the readings working but results exceed 12 bit resolution (4096)

     

    This is calculation i use in order to get MSB and LSB :

    I send 0x90 or 0xD0 and send twice 0x00 in order to get MSB and LSB

    then i shift the msb 8 rows left and add lsb, shift this calculation 3 rows right:

    return ((pen_msb << 8) + pen_lsb) >> 3;

    Do you confirm it is correct way to proceed ?

     

    Many thanks for your help,

  • I checked our EVM firmware, where it is:  return (((pen_msb & 0x7F) << 8) + pen_lsb) >> 3;

  • COULON,

    Had the issure been resolved? Anything may we help further?

    Regards,
    Wendy F.

  • Wendy Fang said:

    I checked our EVM firmware, where it is:  return (((pen_msb & 0x7F) << 8) + pen_lsb) >> 3;

    Hi Wendy, when you mentioned EVM firmware, which EVM are you referring to ?