I assembled an Anushri from the PCBs and sourced my own components, and due to my being relatively unfamiliar with microcontrollers and synthesizers (I’m new to both!), I have no clue how to compile the firmware into a .hex to be burned onto the 328p. I have Linux or Windows available at my disposal, anyone able to hold my hand, a.k.a. give me a list of Linux commands for the process? I have no clue where to begin, aside from using wget on the Anushri’s github page.
Anushri hex file is here For programming, search online for an avrdude tutorial - adafruit has one.
Do I install the bootloader and the firmware, or just the firmware, and do I need to set any of the fuses before I burn either? Help is greatly appreciated!
You can install this bootloader too if you plan to do upgrades by MIDI later. The fuses are:
LFUSE = ff, HFUSE = d4, EFUSE = fd, LOCK = 2f
Hmmm, can the bootloader for the Shruthi be omitted if MIDI upgrades aren’t required, and will that leave a bit more space for (customised) program code? The compiled bootloader looks to be about 2800 bytes. Obviously the bootloader is essential if an ISP programmer is not available, but you need one to omit it.
This would free 1024 bytes. Don’t forget to change the fuses so that the new split between program/bootloader code is taken into account.
OK, thanks! Hmmm, will need to read up a lot on AVR fuses lest I end up with bricked chips. Maybe omitting the bootloader is not such a good idea.
I find this very useful for finding the fuse settings…
@larsen: thanks, yes, I discovered that, very useful, and it works both ways. I entered the default Shruthi fuse values and it shows which bits are toggled (um, to zero, err, on - so confusing!).
Just not sure what to set to omit the bootloader reservation. There are bits for various bootloader reservation sizes, but none for zero words of bootloader. My understanding of embedded devices is currently minimal…
The BOOTRST is the one that decides whether you start from the bootloader section or from 0x0000.
OK, beginning to understand it now, I think. The BOOTSZ bits are currently 11 (i.e. both off) which specifies a 512 word bootloader segment, but instruction words on the AVR are two bytes, hence the 1024 bytes you mention above. But the size of the bootloader segment is irrelevant if the boot reset vector is disabled (BOOTRST=1) which causes execution to start at 0x0000 as you say, not at the start of the bootloader section (before a jump back to 0x0000). Thus the low, high and extended fuses fuses need to change from
-U lfuse:w:0xff:m -U hfuse:w:0xd6:m -U efuse:w:0xfd:m
-U lfuse:w:0xff:m -U hfuse:w:0xd7:m -U efuse:w:0xfd:m
in order to disable the bootloader.
Now the only thing I need to work out is the lock bits - presumably the bootloader segment is write protected. More research needed, hasten slowly, Bennie.
OK, the standard Shruthi lock byte is 0x2F which is 101111, which means all the lock bits are disabled except BLB11 which stops SPM (self programming mode) writing to the bootloader segment - that is, the bootloader can’t overwrite itself, which makes sense.
So, to allow the bootloader segment to be used for program code, just need to disable all the lock bits i.e. the lock byte should be 0x3F (i.e. 111111). Probably unnecessary because a) a chip erase resets them anyway, and b) without a bootloader then SPM won’t be used anyway.
To summarise, in order to omit the bootloader when programming the atmega644p for the shruthi-1 using an ISP programmer, the following lock bits and fuses should be used:
LOCK = 3f
LFUSE = ff
HFUSE = d7
EFUSE = fd
Does that sound right?