1284p AVR_BOOT

Howdy folks! I’m trying to get a 1284p to load sketches from an SD Card (AVR_BOOT) and am stuck. I would really appreciate any help you could offer.

1284p is wired on breadboard as shown in attachment 1284pAVRBOOT.jpg. It is very similar to the MIGHTY and MightyCore circuits.

The primary exception is the addition of the Adafruit Micro SD Breakout board, and LED’s on pins 1, 2, 20 (physical numbers). Bootloading is done through an Arduino Mega (on an Uno, device always came up with zeros - strange). Also used an OSEPP FTDI for serial and sketch uploading.

I can load MightyCore using the following settings: ATmega1284, External 16 MHz, BOD 2.7, LTO Disabled, Variant 1284P, Standard Pinout, UART0, Arduino as ISP.
Sketches uploaded via FTDI can blink the LED’s and read files from the SD Card.

Next, I burn the AVR_BOOT bootloader. Settings: ATmega1284/P 16MHz External, SD CS Pin 4, BOD 2.7, Pinout Standard, Processor ATmega1284P, Arduino as ISP.
Burn succeeds just fine. No errors.

Sketch on the SD Card is very basic. digitalWrite to the the three LED pins (0, 1, 14) with various delays. Have a few Serial.println’s. Converted it to FIRMWARE.BIN using:
avr-objcopy -I ihex -O binary sketch.hex FIRMWARE.BIN

When I power it up through the MEGA, almost nothing happens. SD activity light blinks once.
Disconnect the Mega completely and power it up through FTDI is slightly more dramatic:
LED’s on pins 0 & 1 blink 5 times times dimly. SD activity light blinks once.
Nothing sent via serial.

Any ideas about what is going on? SD Card reading works fine prior to AVR_BOOT install, so why isn’t it doing much when the power is connected? It’s dimly blinking some LED’s - what does that mean? Everything works perfectly fine when I use a 328p - figured an upgrade to a more awesome processor would be easy… I’ve switched breadboards several times - I’m pretty sure this is a good one.

Many thanks for your help!

I don't know if it helps, but I use a 1284p with avr_boot this way https://github.com/jandrassy/my_boards if you take this repo to your hardware folder, you can do Burn Bootloader. I have a modified avr_boot, to disable W5500 on Ethernet shield while using SD card https://github.com/jandrassy/avr_boot

Hi @beam_me_up. I just tested your exact circuit with AVR_BOOT and it worked fine for me, so this is possible.

Some tips:

  • Not all SD cards work for me. I'm not sure exactly what makes for a good and a bad SD card as far as AVR_BOOT is concerned. If you have other SD cards, give them a try.
  • Disconnect your ISP programmer from the ATmega1284P's SPI pins. It could interfere with communication with the SD card.

It is possible to get serial debug output from AVR_BOOT, but the pre-compiled bootloader files don't provide this functionality so you'd need to compile AVR_BOOT from source with the USE_UART variable set to 1:

make MCU_TARGET=atmega1284p BOOT_ADR=0x1F000 F_CPU=16000000 SD_CS_PORT=PORTB SD_CS_DDR=DDRB SD_CS_BIT=4 USE_LED=0 USE_UART=1 ADDED_CFLAGS="-Wextra -Wno-strict-aliasing" TARGET=$(MCU_TARGET)_v0_cs4_$(F_CPU)L

Thanks for your suggestions - they gave me ideas for other things to try. Alas, no success yet. Power on, red light on sd card blinks, but led's won't light up.

Could my understanding of the pins be incorrect? Physical pin 1 (left of the "notch" when viewed from above) is digital 0, so: digitalWrite(0, HIGH). Physical pin 2 is digital 1. The SD Card pin DO should connect to MISO, which is physical pin 7.

I tried a different 1284p, rewired everything on different bread boards many times. Unplugged the FTDI and Mega. I also tried the same setup with a 328p and it worked perfectly. With the 1284p and MightyCore alone, I can read from the SD Card without issue. The led's light up fine as well.

Perhaps it's a hardware issue? I don't have a second crystal, but it works with anything other than avr_boot. Could I have somehow damaged the two 1284p's, except that they work fine with MightyCore. I only have one sd card reader, but it works with avr_boot on the 328p and can be read from the 1284p.

Juraj, I'll give your setup a try next.

Thanks for your help! What a mystery...

beam_me_up: Alas, no success yet.

I'm sorry to hear that.

beam_me_up: Physical pin 1 (left of the "notch" when viewed from above) is digital 0, so: digitalWrite(0, HIGH). Physical pin 2 is digital 1. The SD Card pin DO should connect to MISO, which is physical pin 7.

For the "Standard" variant you're using, that's correct.

Unfortunately, I don't have any ideas about what could be wrong. Short of using the UART-enabled version of the bootloader, your troubleshooting process has been very thorough.

Figured it out. Need to switch the Tools->Board back to MightyCore ATmega1284p prior to compiling. In addition, sketches aren't always loaded from the SD Card when power cycled - may need to reconnect a few times. I wonder if it has something to do with my lack of a reset button.

One other gotcha I found is if you use vMicro in Visual Studio - it automatically switches the board every time a new device is plugged in. So there's another complicating factor.

Thanks again for your suggestions - they helped a lot.