ESP8266 Developer Zone The Official ESP8266 Forum 2016-10-24T19:24:02+08:00 https://bbs.espressif.com:443/feed.php?f=7&t=2912 2016-10-24T19:24:02+08:00 2016-10-24T19:24:02+08:00 https://bbs.espressif.com:443/viewtopic.php?t=2912&p=10244#p10244 <![CDATA[Re: Set HSPI CS manually (as GPIO)]]>

Code:

// GPIO2 as CS line
#define SD_CS_HIGH    while (READ_PERI_REG (SPI_CMD(1)) & (1<<18)); GPIO_OUTPUT_SET (2, 1)
#define SD_CS_LOW     GPIO_OUTPUT_SET (2, 0)

  // Init HSPI GPIO
  WRITE_PERI_REG(PERIPHS_IO_MUX, 0x105);      // Clock config
  PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDI_U, 2);
  PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTCK_U, 2);
  PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTMS_U, 2);
  // PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDO_U, 2); // Do NOT use hardware CS
  PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO2_U, FUNC_GPIO2); // CS signal


You could try this. This is for when you have GPIO2 as CS. Similarly, you could configure any pin you like as GPIO. Make sure you are using the correct MUX and pin names though!

Statistics: Posted by Guest — Mon Oct 24, 2016 7:24 pm


]]>
2016-10-24T02:28:39+08:00 2016-10-24T02:28:39+08:00 https://bbs.espressif.com:443/viewtopic.php?t=2912&p=10239#p10239 <![CDATA[Set HSPI CS manually (as GPIO)]]>
is there any way to set the CS pin of the HSPI interface as an GPIO while the other HSPI pins are driven by the hardware? For the SPI interface I found the following:

Code:

SET_PERI_REG_MASK(SPI_PIN(...), SPI_CS0_DIS | SPI_CS1_DIS | SPI_CS2_DIS);


But there is no HSPI_CS_DIS and as soon as I try to use CS as an GPIO, HSPI doesn't seem to work at all anymore.

Code:

PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDO_U, FUNC_GPIO15);


The problem is that I cannot change the connections anymore.

Thanks in advance for your responses!

Statistics: Posted by pathob — Mon Oct 24, 2016 2:28 am


]]>