Hello, I am trying to use a Pro Micro (atmega32u4) as an adxl345 module, meaning I just connect a USB cable, bolt this module on to my print head, uncomment some lines in my config and be good to go.
To generate the firmware, I am doing this:
-
make menuconfig
:
Micro-controller Firmware Architecture: Atmel AVR
Processor Model: atmega32u4
Processor Speed: 16mhz
Manually Clear CPU prescaller: checked
Communication interface: USB
USB ID’s: default settings make clean
make
At this point I am using ftp to copy the klipper.elf.hex file from the ./out on the pi to my laptop to use avrdude to flash.
avrdude -C avrdude.conf -p m32u4 -P COM6 -c avr109 -U flash:w:klipper.elf.hex
AVRDude now fails, here’s the output:
Connecting to programmer: .
Found programmer: Id = "CATERIN"; type = S
Software Version = 1.0; No Hardware Version given.
Programmer supports auto addr increment.
Programmer supports buffered memory access with buffersize=128 bytes.
Programmer supports the following devices:
Device code: 0x44
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.00s
avrdude: Device signature = 0x1e9587 (probably m32u4)
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "klipper.elf.hex"
avrdude: input file klipper.elf.hex auto detected as Intel Hex
avrdude: writing flash (29292 bytes):
Writing | ################################################## | 100% 2.18s
avrdude: 29292 bytes of flash written
avrdude: verifying flash memory against klipper.elf.hex:
avrdude: input file klipper.elf.hex auto detected as Intel Hex
Reading | ################################################## | 100% 0.27s
avrdude: verification error, first mismatch at byte 0x7000
0x55 != 0x80
avrdude: verification error; content mismatch
avrdude done. Thank you.
So the 32u4 only has 32kb total flash space, and it appears that the sparkfun bootloader uses the last 4k, which leaves only 28k for programs. Is there a smaller bootloader that I should be using? Otherwise, how do I upload to klipper to a pro micro? Interestingly, when building klipper.elf.hex for my atmega2560/ramps controller board, that uses 28610kb of flash, which would fit on the 32u4. Why is the 32u4 firmware like 1k larger than the 2560 firmware, because that difference is currently preventing me from being able to upload.