cancel
Showing results for 
Search instead for 
Did you mean: 

SPI RECEIVE DATA

jean_prieur
Associate III
Posted on June 10, 2013 at 18:53

Hello,

I am programming a resistive touch screen controller, the AR1021-I/SS.

http://ww1.microchip.com/downloads/en/DeviceDoc/41393B.pdf

This device communicates with a SPI port. Data are transmitted on SDO at SCK falling edge, but we can also configure the chip on SDA.

For the moment I just want to get back data of the touch screen controller, according to this figure:

0690X00000602ogQAA.jpg

IRQ is an interruption which goes high when the user touch the screen.

What is the proper way to generate the clock 5 times (like beat banging) on SCK? I try GPIO_SetBits/GPIO_ResetBits on SCK but it didn't works... 

Thanks !
6 REPLIES 6
Posted on June 10, 2013 at 19:04

If the STM32 is the master, I'd imagine you could transmit 5x 8-bit bytes to generate the clocks, and at the same time receive back 5x 8-bit bytes.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
jean_prieur
Associate III
Posted on June 11, 2013 at 10:39

In fact, it seems I can't do that because when I send 5x8bit to generate the clock, the touch screen controller thinks that I try to configure it (but it don't understand the 5x8bit so it crashes).

The is why in the figure of Microchip the SDI port is not active, only CLK is clocking. How can I do to achieve this ?

Posted on June 12, 2013 at 02:43

How can I do to achieve this ?

 

Send zeros? Turn the pin into a GPIO driven low?
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
jean_prieur
Associate III
Posted on June 12, 2013 at 12:30

I can't because my SPI drives 3 peripherals... Or maybe I can change the GPIO pin config each time I need to generate a clock ?

Posted on June 12, 2013 at 13:16

I can't because my SPI drives 3 peripherals...

The plot thickens. So what's the difference between sending zeros and clamping the pin low in this specific instance? Have you looked at the signals with a scope/analyzer? Do these assorted devices on the SPI have their own chip selects?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
jean_prieur
Associate III
Posted on June 12, 2013 at 14:02

Yes, theses devices have there own chip select.

Now I think it's a problem of my USART config: the touch controler is not a full duplex device (data are sent and received on two lines but not in the same time).

There is 5 possibles SPI direction configs:

#define     ((uint16_t)0x0000)

#define     ((uint16_t)0x0400)

#define     ((uint16_t)0x8000)

#define     ((uint16_t)0xC000)

#define  (MODE)

Which one fit to my application ?