Chat freely about anything...

User avatar
By Abhimanyu G
#50565 Hello dear forum members,
I'm attempting to interface a 'Touch keypad' controller with ESP8266(On a ESP launcher dev board) . The connection between the two is standard SPI (MOSI,MISO,SCK,CS) with couple of additional pins connected to GPIO.
ESP8266 is the master and the controller is the slave, I chose to use HSPI on ESP after reading through couple of materials and forums. The HSPI pin connections are verified enough number of times.
On the ESP side, i'm running FreeRTOS with just one task.

My questions are as follows.
>There are 3 spi libraries provided (SPI overlap.c, SPI.c, and SPIinterface.c), amongst these which one is to be used and why?
>I have to just send 8 bits of data and read 8 bits of data and not use "Command" or "Address" data. Now, I cant seem to find a function that can do just that.
>My MOSI data is correctly sent, however my MISO data is wrong (considering that the slave is factory default and is not erratic). I'm supposed to recieve 0xFF as my data but recieving 0x80 can anybody tell me why?

Regards.

EDIT:
A quick analysis of the waveform of clk and the MOSI and MISO data ,led me to believe the problem resides in the way i'm reading data. Which arises a new problem!!!!
How do i Write data (MOSI) and read data (MISO) simultaneously?
User avatar
By Dam747
#52533 Hello,
I am also doing the same kind of work.
I have tested the MOSI, SCLK and SS pins on the oscilloscope and they seem to work fine.
For my testing, I have shorted the MOSI and MISO for self testing, so that I should receive the data what I sent on MOSI.
Do you have any suggestions on this ?
I am just writing simple lua script for this:

spi.setup(1, spi.MASTER, spi.CPOL_LOW, spi.CPHA_LOW, 8,8, spi.FULLDUPLEX);
s= {spi.send(1,0,0x05, 0x40,0x33, 0x54)}
read = spi.recv(1,1)
= s[1]
= s[2]
print(string.byte(read))

I am getting s[1] as 5 which indicates that 5 bytes were transferred, but I see received as 255, which is wrong.
It would be great if you have any suggestions on this
Thanks