Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By gunnarfur
#84643 Hello! I have been playing with ESP8266 esp07 for a while. Now I want to test it as Master for MCP23S19 expander, using the SPI interface. To simplify coding I have tried some classes made for the SPI interface.
in total 3 of them. Unfortunately all of them behave in the same way. The expander does not respond at all. I have used example code from the designer of the SPI class, in orer not to mess it up with my own code. It seems so easy but .....
Obviously I am missing something but What?
I have connected LEDs to pin 1 an 2 on the expander.

I have enclosed the code and my wiring.
/ Gunnar
You do not have the required permissions to view the files attached to this post.
User avatar
By AcmeUK
Connected pins
esp8266/esp07 -----> MCP23S17
ss = pin15 ------> CS pin 11
Mosi = gpio13------> Mosi pin 13
Miso = gpio12------> Miso pin 14
sclk = gpio14------> scl pin 12

The pins used as SPI in the ESP8266 are:


Have you got MISO and MOSI reversed?

ESP8266 Pinout Reference :-
User avatar
By gunnarfur
#84735 Thanks for the link I have not seen it before. It is good. I tried the shift of the GPIO12 and 13. No result there either.
Now, Comparing the picture at the top and the text you refer to further down there is a mismatch.
The picture refer to GPIO13 as MOSI but he text refer to GPIO12. How come?

I have done some tracing with a oscilloscope ( I am new to it) The signals coming out on
GPIO15: CS it is dropping from high to low every about 2 sec according to loop
GPIO14: CLK , A batches of 8 rise from low to High. I guess each batch represent one lap in the for loop, sending a command.
GPIO13: MOSI, after modifying the script I got response on it.
GPIO12: LOW no action
It seems as if the ESP is doing what it is supposed to do.
I'll post the script as it is now. Wired as in the first attachment
Next step is to get the MCP23S17 working
It is wired as follows
pin 14: MISO not used
pin 13: MOSI signal in as described above.
pin 12: CLK signal as above
pin 11 GND
pin 10 3.3 V
pin 18 RESET 3.3 V

Chip address corresponding to the whats stated in the instruction MCP outputchip(1, 15);
A0 tested with both GND and 3.3 , A1 A2 GND in both cases

Still no result on the output pins of MCP23S17

Anybody got an idea?
You do not have the required permissions to view the files attached to this post.
User avatar
By gunnarfur
#84802 Well, well.. I never got it working with the Buffington interface class. However I did a lot of reading to learn about SPI interface. When reading about "SPI.beginTransaction(SPISettings" I remembered another interface support class, the Sumotoy one. That one includes the transaction instructions. So back to testing that one. Of cause it did not work, like last time I tried it. But then I remembered that the MCP23S17 has a maxfrequensy of 10 MHz. The Sumotoy class specified 80 MHz. So I changed the maxFrequensy to10 MHZ for the ESP8266 in the .h script. Like this
#elif defined(ESP8266)
const static uint32_t _MCPMaxSpeed = 10000000UL;
Yes.... It worked!!!!!!!
Observe that I use the ESP8266 and one MSP23S17
My testscript is enclosed. Very much like the Sumotoy example
You do not have the required permissions to view the files attached to this post.