Digital Solutions
iDigole Buyer ProtectioniDigole Buyer
My shopping cart
0 Items:
Secure Checkout
Top Rated Plus
Visit Our Live Auctions
99.9% Customer's Satisfaction
Search store:
Forum : Digole Serial Display :

 Search Forum.. 
 Creat New Topic   Reply 

Problems polling touch with SPI

 I gave up on using I2C and switched to the (software) SPI interface provided by Digole in both the old and new libraries.  The code in both libraries is idential so library version is not a factor.  The display is a 2015 v3.0 unit.

I poll the display for touch with the following (partial) code running in a loop that contains a 5ms delay between loops:

touch_x = display.read1();
touch_x <<= 8;
touch_x += display.read1();
touch_y = display.read1();
touch_y <<= 8;
touch_y += display.read1();
        ... code to check for button push...
This works well for a few minutes until one of the display.read1() calls hangs.  More specifically, it hangs in the Digole SPI library code as indicated:
        digitalWrite(_SSpin, HIGH);
        digitalWrite(_SSpin, HIGH);
        while (digitalRead(_SIpin) == LOW); //check to see the data is ready(1) or not(0)
        digitalWrite(_SSpin, LOW); //tell display module I will read data
        digitalWrite(_SSpin, LOW); //delay about 5us to wait module prepare data
        digitalWrite(_SSpin, LOW);
Why is this line required and under what conditions would the _SIpin not go LOW?
Is it possible to use hardware SPI instead of the bit-banged version?
I know that I can use PENIRQ to poll for touch.  However, I would like to get a clear understanding of how SPI works and why software polling hangs.


RE:Problems polling touch with SPI

 BTW, I LOVE these displays.  I just want to understand how to best use them and get the most of out them :)

RE:Problems polling touch with SPI

 Read data from slave is very tricky by using SPI, the master usually don't know when the data on the slave is ready to be read out, like touch screen. So, we designed a handshake signal by using DI pin on master side, for this detail, please refer to "programmer manual" on Page 8.


Copyright Digole Digital Solutions, 2008-2021. All rights reserved.
Powered by Victor Sun