Page 1 of 1

SPI overlap

Posted: Sun Apr 17, 2016 5:05 pm
by mgrunt
Hello,
I have SPI RAM (23LC1024) which is connected to SPI (no HSPI) and using this functions to init - spiRamInit() which includes SPI overlap:
https://github.com/espressif/ESP8266_MP ... r/spiram.c

Now I can connect to same SPI second device (now I have connect to HSPI bud I can reconnect to SPI, together to RAM), bud I don't know how to drive CS. I drive CS on second device manually, and now is configured and used by this way...

Configure CS PIN:
PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDO_U, FUNC_GPIO15); // configure SPI CS (set manualy)

Using:
PIN_OUT_SET |= (1<<CS_PIN);

How to reconfigure CS to second device for SPI overlap?

Thanks, MG

Re: SPI overlap

Posted: Mon Apr 18, 2016 6:01 pm
by mgrunt
I found the mistake in file spi_overlap.c (SDK example).
Function spi_overlap_init() ans spi_overlap_deinit() is the same!!!

Code: Select all

void ICACHE_FLASH_ATTR
hspi_overlap_init(void)
{
   //hspi overlap to spi, two spi masters on cspi
   SET_PERI_REG_MASK(HOST_INF_SEL, reg_cspi_overlap);

   //set higher priority for spi than hspi
   SET_PERI_REG_MASK(SPI_EXT3(SPI),0x1);
   SET_PERI_REG_MASK(SPI_EXT3(HSPI),0x3);
   SET_PERI_REG_MASK(SPI_USER(HSPI), BIT(5));
}


Code: Select all

void ICACHE_FLASH_ATTR
hspi_overlap_deinit(void)
{
   //hspi overlap to spi, two spi masters on cspi
   CLEAR_PERI_REG_MASK(HOST_INF_SEL, reg_cspi_overlap);

   //set higher priority for spi than hspi
   CLEAR_PERI_REG_MASK(SPI_EXT3(SPI),0x1);
   CLEAR_PERI_REG_MASK(SPI_EXT3(HSPI),0x3);
   CLEAR_PERI_REG_MASK(SPI_USER(HSPI), BIT(5));
}


And deinit not working when I testes connect SPI RAM to SPI and my SPI device to HSPI and I try to switch between them because I can not find a solution to connect these two devices to together SPI (to which is also connected FLASH to).

What is correct function to deinit spi overlat? Thanks.