+ Post New Thread
Results 1 to 17 of 17
  1. #1
    Advanced Member level 5
    Points: 16,431, Level: 30
    Achievements:
    7 years registered
    neazoi's Avatar
    Join Date
    Jan 2008
    Location
    Greece
    Posts
    3,328
    Helped
    12 / 12
    Points
    16,431
    Level
    30

    Multiple external dataflash connected to MCU how to?

    In the image attached the Green block is an ATMEGA644 and the blue is a AT45DB081 flash.
    They are connected using the ISP of the MCU.

    How can I connect a second identical flash to the ISP (and possibly other devices) and being able to select each of them with the use of a jumper switch?
    Professional engineering is the top, but amateur engineering is more fun.
    It is when you cross the barrier between these two, that things become really fascinating!

  2. #2
    Super Moderator
    Points: 75,487, Level: 67
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    15,301
    Helped
    3485 / 3485
    Points
    75,487
    Level
    67

    Re: Multiple external dataflash connected to MCU how to?

    Hi,

    with SPI you should use inidvidual /CS signals to select different devices.


    Klaus
    Please donīt contact me via PM, because there is no time to respond to them. No friend requests. Thank you.


    1 members found this post helpful.

  3. #3
    Advanced Member level 5
    Points: 16,431, Level: 30
    Achievements:
    7 years registered
    neazoi's Avatar
    Join Date
    Jan 2008
    Location
    Greece
    Posts
    3,328
    Helped
    12 / 12
    Points
    16,431
    Level
    30

    Re: Multiple external dataflash connected to MCU how to?

    Quote Originally Posted by KlausST View Post
    Hi,

    with SPI you should use inidvidual /CS signals to select different devices.


    Klaus
    I was thinking of using the SS signal of the micro (in the green block) and connect it to the particular flash chip every time. Then leave the /CS pin of the rest of the flash chips unconnected.

    Will that be enough or do I need to isolate the other signals of the SPI as well?
    Professional engineering is the top, but amateur engineering is more fun.
    It is when you cross the barrier between these two, that things become really fascinating!



  4. #4
    Super Moderator
    Points: 75,487, Level: 67
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    15,301
    Helped
    3485 / 3485
    Points
    75,487
    Level
    67

    Re: Multiple external dataflash connected to MCU how to?

    Hi,

    Then leave the /CS pin of the rest of the flash chips unconnected.
    General rule:
    Never leave any (unused) input floating.

    Now the question is: is the /CS pin pulled up? Or is it floating?

    Klaus
    Please donīt contact me via PM, because there is no time to respond to them. No friend requests. Thank you.



    •   AltAdvertisement

        
       

  5. #5
    Advanced Member level 5
    Points: 16,431, Level: 30
    Achievements:
    7 years registered
    neazoi's Avatar
    Join Date
    Jan 2008
    Location
    Greece
    Posts
    3,328
    Helped
    12 / 12
    Points
    16,431
    Level
    30

    Re: Multiple external dataflash connected to MCU how to?

    Quote Originally Posted by KlausST View Post
    Hi,


    General rule:
    Never leave any (unused) input floating.

    Now the question is: is the /CS pin pulled up? Or is it floating?

    Klaus
    You mean internally? I am not sure here is the datasheet https://media.digikey.com/pdf/Data%2.../AT45DB081.pdf maybe you could help on this? I am confused about the different things mentioned regardind the /CS
    Professional engineering is the top, but amateur engineering is more fun.
    It is when you cross the barrier between these two, that things become really fascinating!



  6. #6
    Super Moderator
    Points: 257,296, Level: 100
    Awards:
    1st Helpful Member

    Join Date
    Jan 2008
    Location
    Bochum, Germany
    Posts
    44,887
    Helped
    13656 / 13656
    Points
    257,296
    Level
    100

    Re: Multiple external dataflash connected to MCU how to?

    nCS isn't pulled up internally, you need to provide external pull-up resistors for unconnected nCS pins.

    The schematic in post #1 drives the SPI signals by 5V logic. I don't expect that AT45DB081 has 5V tolerant inputs.


    1 members found this post helpful.

  7. #7
    Super Moderator
    Points: 75,487, Level: 67
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    15,301
    Helped
    3485 / 3485
    Points
    75,487
    Level
    67

    Re: Multiple external dataflash connected to MCU how to?

    Hi,

    You mean internally? I am not sure here is the datasheet
    Either internally or externally. You just need to prevent it from floating.

    If pullup is not mentioned in the datasheet...then most probably there is no internal pullup.

    Klaus
    Please donīt contact me via PM, because there is no time to respond to them. No friend requests. Thank you.



  8. #8
    Advanced Member level 5
    Points: 16,431, Level: 30
    Achievements:
    7 years registered
    neazoi's Avatar
    Join Date
    Jan 2008
    Location
    Greece
    Posts
    3,328
    Helped
    12 / 12
    Points
    16,431
    Level
    30

    Re: Multiple external dataflash connected to MCU how to?

    Quote Originally Posted by KlausST View Post
    Hi,


    Either internally or externally. You just need to prevent it from floating.

    If pullup is not mentioned in the datasheet...then most probably there is no internal pullup.

    Klaus
    Ok, but my point is, is the /CS alone enough to prevent simultaneous chips into the same ISP to interact with each other? There is a LED and a resistor that forms a potential divider to feed the chip with vcc, perhaps I should also cut off this?
    Professional engineering is the top, but amateur engineering is more fun.
    It is when you cross the barrier between these two, that things become really fascinating!



    •   AltAdvertisement

        
       

  9. #9
    Super Moderator
    Points: 75,487, Level: 67
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    15,301
    Helped
    3485 / 3485
    Points
    75,487
    Level
    67

    Re: Multiple external dataflash connected to MCU how to?

    Hi,

    VCC and signal voltages need to be within their specified ranges.
    (Did you mention voltages before?)

    Did you read post#6?

    The LED controlled power supply is a cheap and dirty solution.
    This is not my style of designing circuits.

    Try to solve it on your own:
    Find the lowest power supply current from the flash datasheet.
    Add the resistor current.
    Find the voltage drop of the LED according it's datasheet.
    Use the highest expectable 5V supply voltage
    --> to find max flash supply voltage

    Find the highest power supply current from the flash datasheet.
    Add the resistor current.
    Find the voltage drop of the LED according it's datasheet.
    Use the lowest expectable 5V supply voltage
    --> to find min flash supply voltage

    Check if this meets the flash specification.

    ****
    Also check V_OH range and and V_IH ranges of all communication partners if they meet specifications.

    Klaus
    Please donīt contact me via PM, because there is no time to respond to them. No friend requests. Thank you.



  10. #10
    Advanced Member level 5
    Points: 16,431, Level: 30
    Achievements:
    7 years registered
    neazoi's Avatar
    Join Date
    Jan 2008
    Location
    Greece
    Posts
    3,328
    Helped
    12 / 12
    Points
    16,431
    Level
    30

    Re: Multiple external dataflash connected to MCU how to?

    Quote Originally Posted by FvM View Post
    nCS isn't pulled up internally, you need to provide external pull-up resistors for unconnected nCS pins.

    The schematic in post #1 drives the SPI signals by 5V logic. I don't expect that AT45DB081 has 5V tolerant inputs.
    It must have, because it works. This is not my schematic.
    I could include jumpers for all signals and switch them off, then switch the other's chips jumpers on to select these other flash chips. But I thought that the /CS will be enough to swhitch it on/off to select the chip. I guess I will have to test it with multiple chips, I thought the answer would be straight forward, but I guess it isn't.
    Professional engineering is the top, but amateur engineering is more fun.
    It is when you cross the barrier between these two, that things become really fascinating!



  11. #11
    Super Moderator
    Points: 79,825, Level: 68
    Achievements:
    7 years registered
    Awards:
    2nd Helpful Member
    betwixt's Avatar
    Join Date
    Jul 2009
    Location
    Aberdyfi, West Wales, UK
    Posts
    13,065
    Helped
    4372 / 4372
    Points
    79,825
    Level
    68

    Re: Multiple external dataflash connected to MCU how to?

    /CS = high effectively disables any input or output to the IC. It is active low, that's what the '/' tells you so to disable it the pin has to be pulled high to VDD. The remaining pins can stay connected as they are. Use a pull-up resistor on both /CS pins so no matter which is disconnected by the jumper is disabled. The resistance isn't critical, I would suggest 10K would be adequate as the /CS pin draws negligible current and the ATMEGA should be capable of sinking several mA.

    I really wouldn't use that LED voltage dropper though, it is asking for problems, especially as the current drawn by the flash will vary quite a lot depending on whether it is reading, writing or idle. it isn't only the supply pin that should be 3.3V, the control signals should be 3.3V as well.

    Brian.
    PLEASE - no friends requests or private emails, I simply don't have time to reply to them all.
    It's better to share your questions and answers on Edaboard so we can all benefit from each others experiences.


    1 members found this post helpful.

  12. #12
    Advanced Member level 5
    Points: 16,431, Level: 30
    Achievements:
    7 years registered
    neazoi's Avatar
    Join Date
    Jan 2008
    Location
    Greece
    Posts
    3,328
    Helped
    12 / 12
    Points
    16,431
    Level
    30

    Re: Multiple external dataflash connected to MCU how to?

    Quote Originally Posted by betwixt View Post
    /CS = high effectively disables any input or output to the IC. It is active low, that's what the '/' tells you so to disable it the pin has to be pulled high to VDD. The remaining pins can stay connected as they are. Use a pull-up resistor on both /CS pins so no matter which is disconnected by the jumper is disabled. The resistance isn't critical, I would suggest 10K would be adequate as the /CS pin draws negligible current and the ATMEGA should be capable of sinking several mA.

    I really wouldn't use that LED voltage dropper though, it is asking for problems, especially as the current drawn by the flash will vary quite a lot depending on whether it is reading, writing or idle. it isn't only the supply pin that should be 3.3V, the control signals should be 3.3V as well.

    Brian.
    Ok Brian Thanks, that was the info I was looking for. I have attached a partial schematic that I have drawn yesterday. The author of the project connected the /CS of the flash to the PB4-/SS pin of the atmega644. He did not use any pullups, but since I now want to disable the flash temporarily, I used a pullup as you suggested and JP7 to disable the flash.

    1. Do you think the pullup will cause problems to the MCU when JP7 is closed?

    In the schematic you can see a simple programmer which is used to initially program the MCU with the firmware. During programming JP7 is closed so that the flash is disconnected. When the MCU is programmed, the J1, J4, J5, J6 are opened, so that the programmer is disconnected from the MCU ISP. That is the idea in general.

    2. Now, can I reduce the number of jumpers in the programmer?

    The way I see it is that, if no cable is connected to the DB-9 programming port:
    J1 can be eliminated and the T1 left connected permanently to the ISP.
    J4 can be eliminated and the D5 left connected permanently to the ISP, since I think the diode is there to prevent higher than 5v levels.
    J5 can be eliminated and the line left connected permanently to the ISP.
    J6 can be eliminated and the D6 left connected permanently to the ISP, since I think the diode is there to prevent higher than 5v levels.

    What do you think of my points 1 and 2 above?
    Professional engineering is the top, but amateur engineering is more fun.
    It is when you cross the barrier between these two, that things become really fascinating!



  13. #13
    Super Moderator
    Points: 79,825, Level: 68
    Achievements:
    7 years registered
    Awards:
    2nd Helpful Member
    betwixt's Avatar
    Join Date
    Jul 2009
    Location
    Aberdyfi, West Wales, UK
    Posts
    13,065
    Helped
    4372 / 4372
    Points
    79,825
    Level
    68

    Re: Multiple external dataflash connected to MCU how to?

    You are correct on all points.

    However, just about every voltage in the circuit is well outside the manufacturers absolute maximum rating. It may work for someone else but they may just be very lucky, you may not be. There is a high probability of the flash being permanently damaged, possibly then taking the ATMEGA with it.

    For interest only, I have a PIC based unit here that has a 9-pin D socket used for serial data and in-circuit programming. With a Pickit plugged in to it I can update the firmware and with a normal serial cable plugged in it works as a data port. In fact it normally hosts a tiny PCB inside a 'D' shell that contains an ESP8266 to allow serial over WiFi.

    Brian.
    PLEASE - no friends requests or private emails, I simply don't have time to reply to them all.
    It's better to share your questions and answers on Edaboard so we can all benefit from each others experiences.



  14. #14
    Super Moderator
    Points: 257,296, Level: 100
    Awards:
    1st Helpful Member

    Join Date
    Jan 2008
    Location
    Bochum, Germany
    Posts
    44,887
    Helped
    13656 / 13656
    Points
    257,296
    Level
    100

    Re: Multiple external dataflash connected to MCU how to?

    It must have, because it works. This is not my schematic.
    Noble simplicity! "It works" is an observation of limited significance. May be now but not next time. You should check if the chip allows the control signal to swing higher than Vdd + 0.6V or has built-in clamp diodes. In the latter case, Vdd will probably rise above safe limit of 3.6V.

    Other cheap and dirty designs are at least providing series resistors for the control signals.

    Interestingly, the Adesto AT45DB081 data sheet specifies Vcc+0.6V input voltage limit while the Atmel/Microchip version specifies absolute 6.25V. Not sure if it's a typo or actually specifying a 5V tolerant input structure. Both are however consistent regarding Vcc+0.6V limit for SO output. This means, that you need to take additional measures when operating 5V devices in the SPI bus.



    •   AltAdvertisement

        
       

  15. #15
    Super Moderator
    Points: 75,487, Level: 67
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    15,301
    Helped
    3485 / 3485
    Points
    75,487
    Level
    67

    Re: Multiple external dataflash connected to MCU how to?

    Hi,

    In my eyes J7 does not disable the FLASH, it just disconnects the pullup. This is the wrong way.

    --> The pullup needs to be continously connected to the FLASH, while J7 needs to disconnect the FLASH from the microcontroller and ISP.

    Klaus
    Please donīt contact me via PM, because there is no time to respond to them. No friend requests. Thank you.



  16. #16
    Advanced Member level 5
    Points: 16,431, Level: 30
    Achievements:
    7 years registered
    neazoi's Avatar
    Join Date
    Jan 2008
    Location
    Greece
    Posts
    3,328
    Helped
    12 / 12
    Points
    16,431
    Level
    30

    Re: Multiple external dataflash connected to MCU how to?

    Now I am really confused. Opinions seem not to agree.
    I have built the project 2 times in different building styles and the flash always work that way.

    Maybe for safety I should go the safe but idiot way, of using a big DIP switch to isolate all the flash and programmer lines completely from the ISP, so I can select between the two? I do not know, it is the simplest thing in mind that WILL work for sure.
    Professional engineering is the top, but amateur engineering is more fun.
    It is when you cross the barrier between these two, that things become really fascinating!



  17. #17
    Super Moderator
    Points: 75,487, Level: 67
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    15,301
    Helped
    3485 / 3485
    Points
    75,487
    Level
    67

    Re: Multiple external dataflash connected to MCU how to?

    Hi,

    In my eyes J7 does not disable the FLASH, it just disconnects the pullup. This is the wrong way.
    I should have wirtten: "In my eyes J7 in your schematic of post #12 does not disable..."
    This answer refers to your schematic of post#12.

    --> The schematic is wrong and needs to be corrected as explained.

    No need to use multiple DIP switches. No need to change wiring of the other SPI signals.
    If /CH of the FLASH is HIGH, then all outputs should be high impedance and the FLASH is disabled.

    Klaus
    Please donīt contact me via PM, because there is no time to respond to them. No friend requests. Thank you.



--[[ ]]--