Multiple Dataflash memories on one SPI interface

Hello guys,

I'm using AT45DB161D flash memories together with this library: https://forum.arduino.cc/index.php?topic=298022.0

I also know how to connect one single DataFlash memory with the Arduino:
dataflash arduino
pin 1 -- pin 11
pin 2 -- pin 13
pin 3 -- pin 8
pin 4 -- pin 10
pin 5 -- pin 7
pin 6 -- V (3.3v to 3.6v)
pin 7 -- ground
pin 8 -- pin 12

However, I wonder if is it feasible to use multiple dataflash memories at the same time with this library?
I thought maybe it is possible for all dataflash chips to share the same SPI pins (MISO, MOSI, SCK) and just to have different chip selects (CS). Am I on a right way? How should I organize the code?

Thank you for your time and effort.

Sincerely,
Bojan.

bojankoce:
Hello guys,

I'm using AT45DB161D flash memories together with this library: https://forum.arduino.cc/index.php?topic=298022.0

I also know how to connect one single DataFlash memory with the Arduino:
dataflash arduino
pin 1 -- pin 11
pin 2 -- pin 13
pin 3 -- pin 8
pin 4 -- pin 10
pin 5 -- pin 7
pin 6 -- V (3.3v to 3.6v)
pin 7 -- ground
pin 8 -- pin 12

However, I wonder if is it feasible to use multiple dataflash memories at the same time with this library?
I thought maybe it is possible for all dataflash chips to share the same SPI pins (MISO, MOSI, SCK) and just to have different chip selects (CS). Am I on a right way? How should I organize the code?

Thank you for your time and effort.

Sincerely,
Bojan.

Which Arduino are you using, This part is not 5V tolerant. You will need voltage level shifters on the CS, SCK, DO, DI .

That library does not support multiple chips. The CS pin definition is hardcoded through out the library.
I would recode the library to store the CSpin value in a Class variable this would require minimal changes to the code.

The SPI hardware will support multiple of these chips, Attached is the library modified to support multiple CS pins. But it is UNTESTED because I don't have one of these chips.

Chuck.

dataflash.zip (7.9 KB)

Chuck, buddy,

Thank you a ton for you time and effort. You are really great !

I will definitely try your library and let you know the results since I have two memory chips with me.

I'm using Arduino Uno for mastering the dataflash. I'm just supplying the AT45DB161D flash chip with 3.3V and I'm using Uno's 5V signals to interface with flash SPI (CS, SCK, DO, DI). It is working for me. Furthermore, the very last line on the page 3 of the memory datasheet (http://datasheet.octopart.com/AT45DB161D-TU-Atmel-datasheet-9684019.pdf) confirms the fact.

Thank you one more time and have a nice day.

Sincerely,

Bojan.