Hi, I'm setting up an ATMEGA1284p and have produced/edited a pins_arduino.h file to corresond with my hardware connections. It all seems to work other than using the SD library, I have verified the hardware is working so I'm pretty sure I have made an error in the pins file.
Does anybody know their was around the pins_arduino.h structure and would be willing to take a look at what I have done?
I have a 1284P PCB on the bench here, that has an SD card on it too, but I wont need to be changing the pins_arduino.h at all, I just use the Bobuino pinout in the IDE.
Its never occured to me to change the standard pinouts to suit a PCB.
So bobuino maps the SPI pins to D10,11,12,13 which does work with the SD library, my pins-arduino.h file maps the SPI pins to D4,5,6,7 which doesn't work - I'm now wondering if my maping file is right but there is something upstream in the SD library which isn't seeing the correct pins even though I have them defined as SS,MOSI,MISO and SCK as per usual and setting SS pin to D4 as expected - a bit odd?
Whatever number the Arduino IDE uses for the hardware SPI pins, SCK (PB7) MISO (PB6) , MOSI (PB5) makes no difference these pins are fixed on the ATmega1284P they cannot be mapped to other ATmega1284P pins.
And the IDE might assume a default for SS, but that makes no difference either, the SS pin can be defined as any other available pin.
Hmmm, its very odd - thanks for helping out. I have PB4, PB5, PB6, PB7 mapped to D4, D5, D6, D7 and defines as SS, MOSI, MISO and SCK but the SD library only works with the bobino pins_arduino.h map which defines the same pins as D10, D11, D12 and D13. If I uses the SdFat library it works with my pin mapping so I guess it must be somehting in the SD library code?
Hi, I've just tried the Adafruit branch of the SD library which works as expected so there must be something up with the original SD library - lots of hunting but got there in the end