Good afternoon everyone and Felix you as well. I have another slightly bizarre question for you. If I wanted to modify your bootloader to move the FlashSS pin from C7 to B1 and I modified all of the places that referenced C7 to B1 along with the corresponding port information in the optiboot.c file. I have already successfully recompiled it to 8MHz for the Atmega1284p, but for whatever reason whenever I put the mcu into powerdown mode and try wake it up using an external rtc it crashes and restarts. Mind you when I leave the flashSS pin at ddrc, portc, and pinc7 everything works fine, except that the memory slave select pin is now on the wrong pin for the hardware board I have to deal with. Do you have any advice or thoughts? You are afterall the master of all things to do with the ATMEGA1284p :). here are the code sections that I found that reference this after I made the changes. This is adapted from your dual-optiboot source.
Your Code:
My code:
#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__) || defined(__AVR_ATmega88) || defined(__AVR_ATmega8__) || defined(__AVR_ATmega88__)
#define FLASHSS_DDR DDRB
#define FLASHSS_PORT PORTB
#define FLASHSS PINB0
#define SS PINB2
#elif defined (__AVR_ATmega1284P__) || defined (__AVR_ATmega644P__)
#define FLASHSS_DDR DDRB
#define FLASHSS_PORT PORTB
#define FLASHSS PINB1
#define SS PINB4
#endif
My other modification
//SPI INIT
#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__) || defined(__AVR_ATmega88) || defined(__AVR_ATmega8__) || defined(__AVR_ATmega88__)
DDRB |= _BV(FLASHSS) | _BV(SS) | _BV(PB3) | _BV(PB5); //OUTPUTS for FLASH_SS and SS, MOSI, SCK
FLASH_UNSELECT; //unselect FLASH chip
PORTB |= _BV(SS); //set SS HIGH
#elif defined (__AVR_ATmega1284P__) || defined (__AVR_ATmega644P__)
DDRB |= _BV(FLASHSS); //OUTPUT for FLASH_SS
DDRB |= _BV(SS) | _BV(PB5) | _BV(PB7); //OUTPUTS for SS, MOSI, SCK
FLASH_UNSELECT; //unselect FLASH chip
PORTB |= _BV(SS); //set SS HIGH
#endif
granted all of the # weren't in the actual code. They seem to have just been added by pasteing here. lol
Charlie
Hi Charlie,
Quick question, how did you sucessfuly recompiled the DualOptiBoot for the 1284p 8mhz. When I clone Optiboot, I successfuly build the bootloader, but as soon as I copy the "Optiboot.c", "pin_defs.h" and "Makefile" from https://github.com/LowPowerLab/DualOptiboot into Optiboot folder, I received this error:
$ make atmega1284p
make: *** No rule to make target 'optiboot_atmega1284p.hex', needed by 'atmega1284'. Stop.