I have a very basic circuit circuit setup with an Atmega 8515, LED w/resistor, reset button, bypass cap, and an SPI interface to an AVR Dragon. No issues in Atmel Studio 7, I can make the LED blink... fine, so now I have a way to output basic status. The purpose of this circuit is to try reading an SD card so I next interfaced the card reader. Upon interfacing it I can no longer program the AVR. Of course I realize there is surely a good reason for this, which is why I'm here to ask for advice. I figure the issue is related to the fact that I have the card reader hooked up to the same SPI pins as the AVR Dragon uses to communicate to the device. I'm using one of those generic micro SD-card boards that have on board level conversion (specifically this one https://www.amazon.com/gp/product/B01JYNEX56/) interfaced as follows.
CS (PB4)
MOSI (PB5) daisy chained to SPI header
MISO (PB6) daisy chained to SPI header
SCK (PB7) daisy chained to SPI header
VCC (5V+)
GND (GND)
I chose the above pinout based on some example schematics and some reading. When the card reader is interfaced (no card yet) Atmel Studio reports back the the error below when I try to program the device. When I remove the card reader it works again. Could someone kindly advise if I have this interfaced incorrectly and perhaps provide a nudge in the right direction?
Failed to enter programming mode. ispEnterProgMode: Error status received: Got 0x0c, epected 0x00.
Much appreciated.