KansaiRobot
Member
Hello and thank you always for your help. Very much appreciated
I am now setting up a system that uses SPI. Now, as you can see in my past threads, I haven't been exactly successful at SPI. I couldnt solve a problem last time I tried to implement SPI.
Anyway, now, with a different system I am having a problem and I suspect it is the SPI part of it specifically the clock, although frankly it can be anything (you can read about it at the end of the post)
My main question here is: When connecting a micro with a device through SPI, I know you have to set the micro SPI parameters to what the device uses. SPI mode, datasize, etc. But do you also have to set the rate??? I thought the slave follows the clock that the master set through SCK so I can set the master at any rate but apparently not. Why??
My PIC (as a master) can set its speed at : Fosc/4 , Fosc/ 16, Fosc/64 and TMR2 output/2 .
My Fosc is now ummmm 16MHz I think... (I say I think because I am using PLL which sets the speed of the micro to 64MHz... so maybe this is the Fosc???)
Now, the device I want to use is the
https://www.waveshare.com/w/upload/9/98/XPT2046-EN.pdf
I am re-reading this datasheet and it says: that the A/D converter is a 12-bit 125KHz one. So maybe that is what I am doing wrong??
My head now is full of confusion so I would appreciate any help, advice or comment
Thanks
-----------------
The system I am doing is a PIC18F45K20 connected to a TFT LCD with touch panel. the touch panel uses the XPT2046 with a SPI interface. Right now the LCD is working fine but the touch panel is not. Apparently the micro detect that the panel has been touched (through a non-SPI pin) but can not find the correct X,Y position. I ve tried debugging it and reduce the problem to the SPI communication part. It seems the values returned are not correct or logical. Debugging is also not very useful, since it doesnt work very well.
I am now setting up a system that uses SPI. Now, as you can see in my past threads, I haven't been exactly successful at SPI. I couldnt solve a problem last time I tried to implement SPI.
Anyway, now, with a different system I am having a problem and I suspect it is the SPI part of it specifically the clock, although frankly it can be anything (you can read about it at the end of the post)
My main question here is: When connecting a micro with a device through SPI, I know you have to set the micro SPI parameters to what the device uses. SPI mode, datasize, etc. But do you also have to set the rate??? I thought the slave follows the clock that the master set through SCK so I can set the master at any rate but apparently not. Why??
My PIC (as a master) can set its speed at : Fosc/4 , Fosc/ 16, Fosc/64 and TMR2 output/2 .
My Fosc is now ummmm 16MHz I think... (I say I think because I am using PLL which sets the speed of the micro to 64MHz... so maybe this is the Fosc???)
Now, the device I want to use is the
https://www.waveshare.com/w/upload/9/98/XPT2046-EN.pdf
I am re-reading this datasheet and it says: that the A/D converter is a 12-bit 125KHz one. So maybe that is what I am doing wrong??
My head now is full of confusion so I would appreciate any help, advice or comment
Thanks
-----------------
The system I am doing is a PIC18F45K20 connected to a TFT LCD with touch panel. the touch panel uses the XPT2046 with a SPI interface. Right now the LCD is working fine but the touch panel is not. Apparently the micro detect that the panel has been touched (through a non-SPI pin) but can not find the correct X,Y position. I ve tried debugging it and reduce the problem to the SPI communication part. It seems the values returned are not correct or logical. Debugging is also not very useful, since it doesnt work very well.