ESP8266 SPI (Master) & MCP23S17 as PortExpander (Slave)

User avatar
rudi
Posts: 197
Joined: Fri Oct 24, 2014 7:55 pm

ESP8266 SPI (Master) & MCP23S17 as PortExpander (Slave)

Postby rudi » Sat Jan 17, 2015 11:17 pm

hi
just in time - i try to get on in the theme "SPI / HSPI "..
i have try this and that - but not sure - my test want not run in first time in SPI ;(
to much trouble in read in infos and threads.. and i get two OLED SPI that are not run too.

so i take my own code for bit banging the spi and make a test with a expander like the mcp23s17
it is a full 2 port expander with each 8 bit.
i show in a short youtube video the beta doing

https://www.youtube.com/watch?v=RzduRWkV2LM

and will say with this, run like a charme for me - have phun to the music too ;-)

i will managed more in this and later time i think post the project in all doing.
it is a part of a new project where esp8266 goes IoE and ..Android.. let me surprise you ..
so please understand for no beta code posting ;-) i think need time until easter
this part in going to a complette project.

best wishes rudi ;-)

i take ESP-12 and setup the pins like here:
GPIO12 MOSI
GPIO13 MISO
GPIO05 CLK
GPIO04 CS

-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

Adex
Posts: 2
Joined: Wed Jan 14, 2015 3:54 am

Re: ESP8266 SPI (Master) & MCP23S17 as PortExpander (Slave)

Postby Adex » Tue Jan 20, 2015 2:09 pm

You are using software SPI or hardware SPI?
I'm also using bargraph LED display to show GPIO status (+ resistor ladder).

User avatar
rudi
Posts: 197
Joined: Fri Oct 24, 2014 7:55 pm

Re: ESP8266 SPI (Master) & MCP23S17 as PortExpander (Slave)

Postby rudi » Tue Jan 20, 2015 2:26 pm

Adex wrote:You are using software SPI or hardware SPI?


In this example i use spi bit banging.
in a next video, with booting firmware from extern spi like from a micro sd with web template for webserver i use hardware spi
i upload a second bootloader likewise grub ( my own ) for choice loading firmware's, at mico sd can save more fw's .this simple upload over wifi2SPI or PC2MicroSD

Adex wrote:I'm also using bargraph LED display to show GPIO status (+ resistor ladder).


with SPI ? where you show this?
i read only here a text.

Adex wrote:nice but without code your example is unusable


ups.. mhm..
sure - how you see i use it useful ;-)
heads up - someday I'll even post the code.
but first try itself.
I had to learn long time to taste because it is not all documented for free in internet.
here i show - "will run if you want try"
this is a simple SPI Master - no top secrets -
try to implant spi master protocol.
posting code will not teach i think - this only be comfortable ;-)
so - try itself firsttime ;-)

best wishes
rudi ;-)

-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

metalphreak
Posts: 5
Joined: Wed Apr 29, 2015 4:33 pm

Re: ESP8266 SPI (Master) & MCP23S17 as PortExpander (Slave)

Postby metalphreak » Wed Apr 29, 2015 7:20 pm

If you want to use the hardware SPI module, I've written both an SPI driver and a library that uses it for the MCP23S17:

https://github.com/MetalPhreak/ESP8266_SPI_Driver

https://github.com/MetalPhreak/ESP8266_MCP23S17

Enjoy :D

User avatar
rudi
Posts: 197
Joined: Fri Oct 24, 2014 7:55 pm

Re: ESP8266 SPI (Master) & MCP23S17 as PortExpander (Slave)

Postby rudi » Wed Apr 29, 2015 9:01 pm

metalphreak wrote:If you want to use the hardware SPI module, I've written both an SPI driver and a library that uses it for the MCP23S17:

https://github.com/MetalPhreak/ESP8266_SPI_Driver

https://github.com/MetalPhreak/ESP8266_MCP23S17

Enjoy :D



hihihih...
nice and clear work!
you did it professional!
did it same way after soft-spi and include oled spi.
btw: TCP_Example
netcat example was good idea! txs for this.
do you take the newest sdk?
best wishes!
rudi ;-)

-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

metalphreak
Posts: 5
Joined: Wed Apr 29, 2015 4:33 pm

Re: ESP8266 SPI (Master) & MCP23S17 as PortExpander (Slave)

Postby metalphreak » Sat May 02, 2015 1:04 pm

I'm using the latest SDK (esp_iot_sdk_v1.0.1_15_04_24).

User avatar
luca.gamma
Posts: 3
Joined: Sun Apr 19, 2015 9:31 pm

Re: ESP8266 SPI (Master) & MCP23S17 as PortExpander (Slave)

Postby luca.gamma » Tue May 26, 2015 10:50 pm

metalphreak wrote:If you want to use the hardware SPI module, I've written both an SPI driver and a library that uses it for the MCP23S17:

https://github.com/MetalPhreak/ESP8266_SPI_Driver

https://github.com/MetalPhreak/ESP8266_MCP23S17

Enjoy :D


Thanks metalphreak for sharing, do you think it is possible to drive an additional SPI slave by example using GPIO2 (I'm using an ESP-03 at present time and this is the only pin available) as a second CS_SS? My idea is to have two 16-bit ADCs to read from and then transfer samples via a TCP connection in continuous mode. Not sure if this is possible, need to check the fastest throughput with TCP without loosing frames or the network connection. An other question, is this SPI driver compatible with FreeRTOS? I may need to have an OS to separate acquisition/buffering and samples transmission tasks...

Who is online

Users browsing this forum: No registered users and 1 guest