ATMega1284p issues with SD Card

I just finished building new prototype (V2) for my xronos clock, this one has audio/microSD card and RF12B receiver on board. However I'm having a strange issue. With ATMega644p (Sanguino) almost everything works, microSD is read normally, but RF12B is not working. Knowing how buggy Sanguino is, I installed ATMega1284p chip (Bobuino) and now SD card is not working at all :frowning: (RF12B is working).
Now the most strange thing is when I take this same 1284p chip and put it into my V1 board (that has WaveShield connected as shield, but no RF12B) it can read SD card!
:astonished:
I have no clue what to look for. If problem is in my hardware, then why 644p can read SD card. If it's software then why 1284p works on another board (where I have same exact IC pins connected to WaveShield)...
Is RF12B connected to same SPI as SD card interfere somehow? I'm using different CS pins for each. Any suggestions? :slight_smile:

..I would not mess with those HC125 drivers as the 1284p runs fine at 3.3V/16MHz..

pito:
..I would not mess with those HC125 drivers as the 1284p runs fine at 3.3V/16MHz..

Hmm, that's true... I guess I can redesign the board, since I already have 3V reg. I only need 5V to drive LED matrix...
Thanks.

P.S. It seems issue with pin definitions somehow... I tried these bootloaders on same 1284p chip and here's result:

  • Mighty 1284 w/ Optiboot: RF12B Module works. SD card doesn't work
  • Bobuino: RF12B Module Doesn't work (I know I stated in my OP that it worked, but I was wrong). SD Card Doesn't work
  • Sanguino 1284 : RF12B Module doesn't work. SD Card WORKS!

How do I get both working? :frowning:

..have a look on the pin definitions in "pins_aruino.h" and do check the stuff around:

..
static const uint8_t SS   = 4;
static const uint8_t MOSI = 5;
static const uint8_t MISO = 6;
static const uint8_t SCK  = 7;
..

pito:
..have a look on the pin definitions in "pins_aruino.h" and do check the stuff around:

..

static const uint8_t SS   = 4;
static const uint8_t MOSI = 5;
static const uint8_t MISO = 6;
static const uint8_t SCK  = 7;
..

Tried changing it, but no difference. In fact I'm surprised that SS is defined like that, it can be any pin...
BTW speaking of powering whole thing at 3.3V I realized that my DC1307 chip requires 5V. Do you know if it will operate with 3.3V logic if I connect it to 5V VCC?

SD cards need 3.6V.

Less than that, they may work, they may do weird things...you can never tell.

I realized that my DC1307 chip requires 5V. Do you know if it will operate with 3.3V logic if I connect it to 5V VCC?

Since it is an I2C guy it may work (I2C is an open-collector based stuff)..

SD cards need 3.6V.

Nono, Never do it.. They need max 3.3V.

pito:

SD cards need 3.6V.

Nono, Never do it.. They need max 3.3V.

Here's the spec, read it for yourself:

https://www.sdcard.org/downloads/pls/simplified_specs/part1_410.pdf

3.2 Supply Voltage
In terms of operating supply voltage, two types of SD Memory Cards are defined:
• High Voltage SD Memory Cards that can operate the voltage range of 2.7-3.6 V.
• UHS-II SD Memory Card that can operate the voltage ranges VDD1: 2.7-3.6 V, VDD2: 1.70-1.95V

Many SD cards will NOT work at 3.3V.

3.5V is probably good enough for most cards but in theory they can require 3.6V.

Many SD cards will NOT work at 3.3V.

I've never met such a card. Maybe the power supply was weak or bad decoupled - therefore you needed 3.6V (a card may take 200mA peak)..

pito:

Many SD cards will NOT work at 3.3V.

I've never met such a card.

Well that proves it then. No card needs more than that.

• High Voltage SD Memory Cards that can operate the voltage range of 2.7-3.6 V.
• UHS-II SD Memory Card that can operate the voltage ranges VDD1: 2.7-3.6 V, VDD2: 1.70-1.95V

Many SD cards will NOT work at 3.3V.

SD cards need 3.6V.

Seems to me these statements are inconsistent. The first one indicates the SD card should work down
to 2.7V. So, ????

To OP, I think your ckt is ok, as is. The problem may be that, when you use the SPI peripheral with -CS
other than the standard SS pin, you still need to set the SS pin = OUTPUT, else the peripheral will revert
to slave mode.

oric_dan:
To OP, I think your ckt is ok, as is. The problem may be that, when you use the SPI peripheral with -CS
other than the standard SS pin, you still need to set the SS pin = OUTPUT, else the peripheral will revert
to slave mode.

Thanks, I will keep looking for a solution. It's very helpful to at least eliminate hardware as source of the issue :slight_smile:
As to SD card voltage (to the person who hijacked my thread :slight_smile: , I'm not an expert but from what I've learned in the past year, every circuit I've seen uses 3.3V for regular SD cards, no exceptions... And from posted specs in voltage range of 2.7 - 3.6V, 3.3V seems like a sweet spot :slight_smile:

What does this have to do with Bobuino? Nothing that I can see. I request you take Bobuino out of the title.

oric_dan:

• High Voltage SD Memory Cards that can operate the voltage range of 2.7-3.6 V.
• UHS-II SD Memory Card that can operate the voltage ranges VDD1: 2.7-3.6 V, VDD2: 1.70-1.95V

Many SD cards will NOT work at 3.3V.

SD cards need 3.6V.

Seems to me these statements are inconsistent. The first one indicates the SD card should work down
to 2.7V. So, ????

The way it works is you query the card on initialization (command 58, "READ_OCR") and the card tells you how many volts it needs. If you don't have that many volts, you're not supposed to use that card (and especially don't try to write to it).

So, 2.7V is an allowed voltage under the specification but it doesn't mean that cards will work at 2.7V - the card can ask for more, up to 3.6V.

If you ask real-life cards, most will say 3.3V but if your power supply has the slightest problem, even a tiny fraction of a volt less than that or any problems in decoupling, some cards won't work. SD cards need a lot of current, if the power droops even slightly, it will fail. This isn't something where you can do the usual hand-wave say "Well MY card works so it must be OK", it needs proper engineering practice. Adding a bit more voltage (even a tenth of a volt more) means you're much, much more likely to succeed.

That's a very good description, although it still all seems inconsistenly
bizarre with the section 3.2 spec info you gave in reply #7. Do they
possibly sell different SD cards in europe than in the US?

oric_dan:
That's a very good description, although it still all seems inconsistenly
bizarre with the section 3.2 spec info you gave in reply #7.

Why?

Let's look at AVR chips, eg. the ATtiny85 comes in two flavors, normal and 'V':

Operating Voltage
– 1.8 - 5.5V for ATtiny25V/45V/85V
– 2.7 - 5.5V for ATtiny25/45/85

Both work at 5.5V, only one works at 1.8V. Is that also "bizarre" to you? If you were designing a PCB to work with a randomly chosen ATtiny85, what supply voltage would you choose?

If there was another variant that worked at 3.4-5.5V, what voltage would you choose?

Just because there exists a 1.8V version, doesn't mean you design to it.

I don't know if there are any 2.7V SD cards or not but when they wrote the spec they allowed for it. It doesn't mean a randomly chosen SD card will run at 2.7V.

..so, based on this discussion - has a designer to provide a programmable VCC source (2.7-3.6V) for the sdcard in order to be safe?? :~

CrossRoads:
What does this have to do with Bobuino? Nothing that I can see. I request you take Bobuino out of the title.

Hmm ok I removed it. But question was relevant and about Bobuino as well as other variants of 1284p bootloaders, and why they don't work with SD card while Sanguino version did on my version of hardware... Was hoping to get some hints, this was not meant to critique your variant :slight_smile:

pito:
..so, based on this discussion - has a designer to provide a programmable VCC source (2.7-3.6V) for the sdcard in order to be safe?? :~

You could do that ... or you can just provide 3.6V.

[Edit: Bobuino removed from all titles by moderator]