[SOLVED] Flash Shruthi-1 MCU without build environment

Hi,

might be a FAQ but I found contradictory information’s here…
I want to flash a blank Atmega 644p with the latest Shruthi-1 firmware without having to setup a complete build environment.
I’m a FreeBSD user and I’m going to use a simple parallel port to ISP cable (http://thomaspfeifer.net/einfaches_atmel_programmierkabel.htm).

Does the following make sense? Are the fuses correct?


— solution in post no. 4 —

1.) Download the following files:
Factory presets: http://mutable-instruments.net/static/data/factory_data.bin
Firmware: http://mutable-instruments.net/static/firmware/shruthi1_0.97.hex
Bootloader (or is it already in cluded in the firmware?): http://mutable-instruments.net/static/firmware/muboot.hex

2.) Burn everything:
avrdude -V -p m644p -c avrisp -P ppi0 -e -U lock:w:0x3F:m -e -U efuse:w:0xFD:m -U hfuse:w:0xD6:m -U lfuse:w:0xFF:m -U lock:w:0x0f:m -U flash:w:shruthi1_0.97.hex:i -U f
lash:w:muboot.hex:i -U eeprom:w:factory_data.bin:i

Thanks a lot in advance!
waldshrut

Yes, the bootloader is a different thing from the firmware. You need to flash the bootloader if you want the unit to be upgradable by MIDI (otherwise you can live without it).

I am not familiar with the ppi0 interface, so I don’t know if it is correct and if it will work. Anyway, there are a few mistakes with your command.

1/ EEPROM file

The correct file for the eeprom is shruthi/data/factory_data/internal_eeprom.hex. factory_data.bin does not get written on the AVR chip, it is on the 24LCXXX eeprom.

2/ Locks

The correct lock bits are 0x2f, and these have to be written after the last thing you do with the chip (otherwise it gets overwritten at each new invocation of avrdude).

3/ Programmer speed

The ATmega chips from the factory are by default clocked at a very low speed, so you need to flash the fuses using a very slow programming speed:

avrdude -V -p m644p -c avrisp -P ppi0 -e -B 10 -U efuse:w:0xFD:m -U hfuse:w:0xD6:m -U lfuse:w:0xFF:m

Note the -B 10 flag which instructs the programmer to work with a slow speed.

Once you have set up the fuses the chip knows that it will be running at a high speed from an external crystal, and you can continue the flashing at full speed (-B 1):

avrdude -V -p m644p -c avrisp -P ppi0 -e -B 1 -U flash:w:shruthi1_0.97.hex:i -U flash:w:muboot.hex:i -U eeprom:w:internal_eeprom.hex:i -U lock:w:0x2f:m

Actually, you could do all in one command with -B 10 ; but it would take over a minute since the whole programming would be done at slow speed.

Thanks for your super fast response! :slight_smile: Today I could give it a try. I found out that I have to specify the device as “/dev/ppi0” instead of just “ppi0”. The second issue was that I used “avrisp” as programmer, but it’s “bascom” as I use a simple parallel port to ISP cable and avrdude.conf defines bascom as what I have (from the parallel port pin connections).

So, I was able to set the fuses with this command:

avrdude -V -p m644p -c bascom -P /dev/ppi0 -e -B 10 -U efuse:w:0xFD:m -U hfuse:w:0xD6:m -U lfuse:w:0xFF:m

Unfortunately, the terminal window I used had no scrollback buffer, so I don’t have the output anymore to post it here… :frowning:
Unfortunately No.2, the Atmel doesn’t respond anymore. I get “AVR device is not responding” when I’m trying to flash the firmware/bootloader with the second command.

I’ve tried to set the fuses again -> “AVR device is not responding”.
I’ve tried to set the fuses again with B 1> “AVR device is not responding”.
I’ve tried to set the fuses again with B 10> “AVR device is not responding”.
I’ve tried to read the fuse settings with -B 1 and also with B 10> “AVR device is not responding”.

Now I’m kinda lost… Any troubleshooting ideas?

Naaaaaaa… It makes noise! Don’t know what happend. Rebootet the computer and the the Shruthi a couple of times and was able to flash the firmware I’m so happy! :)))

Solution which worked for me on FreeBSD 8.0 RELEASE (GENERIC kernel), avrdude 5.11 and a simple parallel port to ISP cable (link in first post):

Firmware: http://mutable-instruments.net/static/firmware/shruthi1_0.97.hex
Bootloader: http://mutable-instruments.net/static/firmware/muboot.hex
Factory presets: https://github.com/pichenettes/shruthi-1/raw/master/shruthi/data/factory_data/internal_eeprom.hex

#avrdude -V -p m644p -c bascom -P /dev/ppi0 -e -B 10 -U efuse:w:0xFD:m -U hfuse:w:0xD6:m -U lfuse:w:0xFF:m

#avrdude -V -p m644p -c bascom -P /dev/ppi0 -e -B 1 -U flash:w:shruthi1_0.97.hex:i -U flash:w:muboot.hex:i -U eeprom:w:internal_eeprom.hex:i -U lock:w:0x2f:m

Thanks again!

Congrats! I use my AVR programmer daily, sometimes to flash hundreds of chips in a row, and I have found that its weak spot (which triggers device not responding errors) is the ribbon cable. I think I’m at the fourth of fifth ribbon cable in 2 years…

What AVR programmer do you use?

AVR ISP mkII

Ribbon cables are pretty flimsy though. There is the temptation to disconnect the programmer by pulling on the cable, which will damage it eventually.

does anyone have a recommendation for an eeprom burner?
(DIY would be the greatest, obviously)

a what? what are you planing rosch? spaceflight with a shuttle?

i have no luck with shitty midi software to transport the factory data to the chip. maybe you have an idea what i could use? don’t say reaper.
(i only use Notator but i don’t have the patches on the Atari)

I can well send you a flashed eeprom, roschybaby - why don’t you just ask :wink:

lol, now i feel flattered!
the problem is the eeprom is already soldered and i’ll need more in the future.
there must be an easy way to get those patches over there, right?
i think i need an 101 in midi software

Just another “i solder every chip because sockets cause problems” problem :wink:

You need a Mac and an AMT-8 or GM 5x5x5… and BTW, eEprom Burners tend to have Sockets, so this is not for you…

i have a pc and a GM5x5x5 but the only software i know how to use only works with midibox devices.
my band buddy has a mac. and he is a hardcore Abletonist™ he will be able to do it.

have you tried c6 as described in shruthis manual?

of course not :wink:
thanks!
gonna try that. i didn’t have the idea to use it for something other than firmware.

@rosch c6 is very simple , Midi-ox is also very good., you get to watch what’s happening.
regards

thank you. yes i got midi-Ox on my old XP machine. using it only for the routing, i remember i was looking to update firmwares in '11 but had only luck with C6, somehow software isn’t for me.
the eeprom i wanted to fill yesterday already had the patches loaded (from MI), as i found out later. 4PM up and running, damn this is a good filter