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: Conflict of SPI and PENIRQ

Part Number: ADS7843

I use ADS7843in my scheme. When I working with it, there were problems: at some moment the pin PENIRQ stops working (does not respond to touch press).

I use ATmega88PA and Mikroc Pro for AVR. The code for the conversion is as follows:

<program>

char Xpos_MSB, Xpos_LSB, Ypos_MSB, Ypos_LSB;

char buffer1, buffer2, buffer3, buffer4;

main()

{

while(1)

{

if (Peirq_bit == 0)

{

Chip_Select=0;

SPI1_Write(0b11010000); //X

Xpos_MSB = SPI1_Read(buffer1);

Xpos_LSB = SPI1_Read(buffer2);

SPI1_Write(0b10010000); //Y

Ypos_MSB = SPI1_Read(buffer3);

Ypos_LSB = SPI1_Read(buffer4);

Chip_Select=1;

}

}

}

</program>


Connection beyween LCD and ADS7843, ADS7843 and ATmega is made correctly.

The SPI is initialized as required by the ADS7843 datasheet (CPOL=0, CPHA=0).

The problem is the following, if I leave the processing of only X in the code or only Y  then everything works.

Example:

...

Chip_Select=0;

SPI1_Write(0b11010000); //X

Xpos_MSB = SPI1_Read(buffer1);

Xpos_LSB = SPI1_Read(buffer2);

// SPI1_Write(0b10010000); //Y

// Ypos_MSB = SPI1_Read(buffer3);

// Ypos_LSB = SPI1_Read(buffer4);

Chip_Select=1;

...

But if I do them one by one, then after the first transformation the pin PENIRQ stops working. Help me please.

  • Hello Ivan,
    Thank you for your code, but it is easier and more efficient to debug using scope shots instead. Would you provide a scope shot of the malfunction, when PENIRQ does not works and when it does work with the related lines, such as the digital communications.
    Also, just a side thought, could you be inadvertently disabling the PENIRQ pin through the PD1/0 selection, might be worth a check.

    Regards
    Cynthia