SD Library Inconsistency between Arduinos [SOLVED]

I'm working on a project that will eventually be a custom-fab PCB with an SD socket wired to the hardware SPI pins on the AVR (an ATmega328p). I've been doing some of the development work on the software on a Sparkfun Pro Micro, based on the m32u4. I got the project to work.

I use the SD library in the usual manner:


On the Pro Micro, this works great, I can read/write the SD no problem.

I then swap out the Pro Micro for a bare 328p PDIP28. I was using the internal 8MHz RC osc on the Pro Micro, and set the 328p to the same. I changed the target to a 328p in Arduino, and compile and deploy the code. And the SD card doesn't work.

At this point, I got out my handy Saleae Logic. Here is what it looks like with the Pro Micro in place:

Great, MOSI/MISO are alive, the Pro Micro sends the request to go into SPI command mode, and the card replies. ~20ms later, the 32u4 puts the SD into high-speed 2MHz mode. Awesome.

Here's what the same code running on a 328p does with the same hardware setup:

Same signal from the AVR to the card, and we hear back nothing.

Everything seems to be alright on the 328p's end, but something clearly isn't, as it doesn't work.

Any ideas about what it could be?

...and we hear back nothing.

"Hear back nothing"? Are you expecting the processor to holler?

Are you expecting the processor to holler?

No, but the logic analyzer did with the 32u4!

Well, I figured it out. This is what a stack overflow looks like when you don't get memory protection.