mculibrk wrote:Hi!
Is there any way to add/use additional SPI flash chips connected on the "primary" SPI bus/controller?
The idea would be to use an additional CS pin and (re)use the same SCK/SDI/SDO pins used for primary spi flash used for code execution. Could this be possible? Any way to configure/enable such setup through SDK or directly via registers?
I know I could use the other (H)SPI port but it's currently used for other purposes.
Also, would it be possible to "memory map" this "second" spi flash?
Related to this... could the other (HSPI port) flash mapped directly into memory like the primary one? Any registers available for that?
Is there any support (in SDK or otherwise) for SD cards (on HSPI)?
regards,
mculibrk
Statistics: Posted by mikewang — Fri Jun 05, 2015 12:10 am
rudi wrote:Yes it is, SPI is bus system -
you can connect over cs or device adress
Code:
void ICACHE_FLASH_ATTR
hapi_overlap_init()
{
//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));
//select HSPI CS2 ,disable HSPI CS0 and CS1
CLEAR_PERI_REG_MASK(SPI_PIN(HSPI), SPI_CS2_DIS);
SET_PERI_REG_MASK(SPI_PIN(HSPI), SPI_CS0_DIS |SPI_CS1_DIS);
//SET IO MUX FOR GPIO0 , SELECT PIN FUNC AS SPI CS2
//IT WORK AS HSPI CS2 AFTER OVERLAP(THERE IS NO PIN OUT FOR NATIVE HSPI CS1/2)
PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO0_U, FUNC_SPI_CS2);
}
mculibrk wrote:
sure... but I was not talking about 'bit-banging'... I need HW assisted SPI
mculibrk wrote:
Can you explain your statement a little?
How could one just attach a spi (flash) memory to the controller and have memory mapped access to it "just like that"?
mculibrk wrote:
I think there must be a way to tell the CPU where the chip memory should be mapped, how big it is, which hw cs will be used, which kind (speed, data bits...) and only after that one could access its content transparently/memory mapped - I mean do something like this:
mculibrk wrote:
Is there any support (in SDK or otherwise) for SD cards (on HSPI)?
...
sure, sure... but I was wondering if that was hw and/or library assisted by any chance.
Probably I was not clear enough that I need/require hardware SPI access only, so any form of bit-banging is not what I need.
I know it can be done that way but I need hw support (for speed and cpu usage/blocking as low as possible)
Thanks for all!
Statistics: Posted by rudi — Tue Feb 17, 2015 3:46 am
feel free to watch
https://www.youtube.com/watch?v=RzduRWkV2LM
shows a SPI Device MCP23S17 connected to the ESP8266 by SPI
Yes you are right, CS pin is your friend and if you can manage, device adress same like other SPI devices in other MCU
You can make multiple (H) SPI , same way like SPI - only pair pin more and manage by your self
Also, would it be possible to "memory map" this "second" spi flash?
Yes - why not?
You do not need registers.
Code:
unsigned char *spimemory;
unsigned i;
spimemory = (unsigned char *)0x84001000; // let's say teh spi flas is mapped at this address
for (i=0;i++;i<2000) {
os_printf("Byte from flash: %02x\n", *spimemory);
spimemory++;
}
Is there any support (in SDK or otherwise) for SD cards (on HSPI)?
Not documented in the API
but you can make simple by use SPI and use SD protokoll by yourself
Statistics: Posted by mculibrk — Mon Feb 16, 2015 1:15 am
HSPI port flash can be mapped directly into memory like the primary one. But the chip have to boot from the primary SPI port, that means this can be applied in this kind of situation: esp8266 connect to a sdio master MCU , waiting for the mcu bootup esp8266, then run map to the HSPI flash and run the wifi stack with it.
Statistics: Posted by mculibrk — Mon Feb 16, 2015 12:47 am
mculibrk wrote:
The idea would be to use an additional CS pin and (re)use the same SCK/SDI/SDO pins used for primary spi flash used for code execution.
Could this be possible? Any way to configure/enable such setup through SDK or directly via registers?
mculibrk wrote:
I know I could use the other (H)SPI port but it's currently used for other purposes.
mculibrk wrote:
Also, would it be possible to "memory map" this "second" spi flash?
mculibrk wrote:
Related to this... could the other (HSPI port) flash mapped directly into memory like the primary one? Any registers available for that?
mculibrk wrote:
Is there any support (in SDK or otherwise) for SD cards (on HSPI)?
mculibrk wrote:
regards,
mculibrk
Statistics: Posted by rudi — Sun Feb 15, 2015 8:06 pm
Statistics: Posted by costaud — Sun Feb 15, 2015 11:59 am
Statistics: Posted by mculibrk — Sat Feb 14, 2015 8:45 pm