- Wed Mar 25, 2015 8:17 am
#12604
Ok,
I have the hardware HSPI working and as expected it is a speed improvement over a bit banged SPI interface.
There are interface engines embedded in the esp8266 (UART SPI I2C) silicon. They are exposed by setting certain registers.
Not all IO pins are capable of being selected for these engines. The engines can only be assigned ( muxed) to a fixed set of pins. The names of I/O pins for SPI CLK MISO MOSI CS are obvious in external devices but
obtuse in the esp8266 world of register notation.
The code below initializes HSPI on the esp8266. The esp8266 is a master to an external slave device
Code: Select all /////// init the remap to HSPI
WRITE_PERI_REG(PERIPHS_IO_MUX, 0x105); //clear bit9
PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDI_U, FUNC_GPIO12);//GPIO12 - HSPIQ MISO, not using it for MISO but as LCD A0
PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTCK_U, 2);//configure io to spi mode GPIO13 - HSPID MOSI
PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTMS_U, 2);//configure io to spi mode GPIO14 - CLK
PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDO_U, 2);//configure io to spi mode GPIO15 - CS
Notice that obtusely MTCK is MOSI, MTMS is CLK, MTDO is CS ( chip select) .
The good news is that this code works and that it can be wrapped in an init spi call.
Thanks to all that helped