what pins are these ports referring too ?

; MMC hardware controls and Flash controls (C)ChaN, 2010
; Hardware dependent macros to be modified

//sparkfun microsd
//#define DDR_CS _SFR_IO_ADDR(DDRB), 0 // MMC CS pin (DDR, PORT)
//#define PORT_CS _SFR_IO_ADDR(PORTB), 0
// i2GPS
//#define DDR_CS _SFR_IO_ADDR(DDRB), 2 // MMC CS pin (DDR, PORT)
//#define PORT_CS _SFR_IO_ADDR(PORTB), 2

// Arduino Ethernet
#define DDR_CS _SFR_IO_ADDR(DDRB), 0 // MMC CS pin (DDR, PORT)

#define DDR_CK _SFR_IO_ADDR(DDRB), 1 // MMC SCLK pin (DDR, PORT)

#define DDR_DI _SFR_IO_ADDR(DDRB), 2 // MMC DI pin (DDR, PORT)

#define PIN_DO _SFR_IO_ADDR(PINB), 3 // MMC DO pin (PIN, PORT)

I'm trying to get a bootloader to read my SD card and i have it attached to pins 50-53 but bootloader is not working correctly and i have been told to make sure the pins are correct in this bootloader file.

What pins is it using for the SPI ?

What board?
Do you not have the datasheet?
Do you not have a pin-out diagram?

Port B 0,1,2 and 3 it would appear? Consult a good pinout chart for your board (one that shows the ports and number of the pin within that port as well as the arduino pin number) to match that up with the arduino pin number.

I am using an Arduino Mega2560 and a custom bootloader with a standard SD card reader, which has MOSI, MISO, SCK, CS.

I have been staring at a chip diagram for 15 minutes and i cant find B 0 - 3, the lowest port B i find is 12. :confused:


mega diagram

never mind i just found this thread
Mega2560 port list in full

Any way the pins are correct in this bootloader, I pray its just my SD card type or something, though it works with the SD card library but this bootloader is far more simplistix in how it reads a SD card

Here's a nice pin mapping diagram for the Mega:

Courtesy of MegaCore.

never mind...