Nick,
If you are reading this, could you give me some help on the loading .hex file from sd card post on your forum?
My pins 4-7 are used so I want to switch to analog pins 0-3. How do I change your code (PIND into what)?
// bit banged SPI pins
#ifdef __AVR_ATmega2560__
// Atmega2560
const byte MSPIM_SCK = 4; // port G bit 5
const byte MSPIM_SS = 5; // port E bit 3
const byte BB_MISO = 6; // port H bit 3
const byte BB_MOSI = 7; // port H bit 4
#else
// Atmega328
const byte MSPIM_SCK = 4; // Change to A0 port D bit 4
const byte MSPIM_SS = 5; // Change to A1 port D bit 5
const byte BB_MISO = 6; // Change to A2 port D bit 6
const byte BB_MOSI = 7; // Change to A3 port D bit 7
#endif
// for fast port access
#ifdef __AVR_ATmega2560__
// Atmega2560
#define BB_MISO_PORT PINH
#define BB_MOSI_PORT PORTH
#define BB_SCK_PORT PORTG
const byte BB_SCK_BIT = 5;
const byte BB_MISO_BIT = 3;
const byte BB_MOSI_BIT = 4;
#else
// Atmega328
#define BB_MISO_PORT PIND //<- How to change?
#define BB_MOSI_PORT PORTD // <-change to PORTC
#define BB_SCK_PORT PORTD // <-change to PORTC
const byte BB_SCK_BIT = 4; //<- change to 0
const byte BB_MISO_BIT = 6; //<- change to 2
const byte BB_MOSI_BIT = 7; //<- change to 3
#endif
I am also not sure about how this program affects the bootloader in the FLASH. From the .HEX files I generated, address starts from 0000. From your post, if address starts from zero, then after upload the code starts from 0000, that means the bootloader is not working (if not erased altogether). Am I correct?
I tried to send you PM but I was blocked. I didn't know one could do that. Anyway, great work! I'll go through it alone if I have to.
Thank you!