SPI device in parallel

Hello,

I am using one common spi peripheral (let’s say SPI0 of mcu) for two spi chip. one is spi flash and second is spi based eeprom.both chips are sharing common spi lines and both have individual chip select line.

So can i create two different instance for one common spi peripheral like this ? will it cause any problem during operation.

SPIFBlockDevice spif(MOSI, MISO, SCK, CS_SPIF);

SPI EEP(MOSI, MISO, SCK, CS_EEP);

Thanks in Advance.

Hi Nitin,

I’m not a SPI expert but can’t you only have one SPI master/controller + multiple SPI peripherals/slaves ? Wouldn’t your calls there be trying to create multiple masters/controllers ?

Anna

So can i create two different instance for one common spi peripheral like this ? will it cause any problem during operation.

Theoretically it shouldn’t but for real behaveiour beware of this bug.

Hello Anna ,

Thanks for you comments.

I have only one spi master (cpu) and two spi slaves (spi flash and eeprom). Now my spi flash uses spif driver ( SPIFBlockDevice) of mbed. So this class will creates one instance of spi.

Now the problem is that eeprom shares same spi but it cant uses SPIFBlockDevice driver.

So i am just trying to search is it possible to create two instance of same peripheral or i should go with two separate spi peripheral (like spi0 , spi1 different for both).