MK312BT-Can you use USB-AVR to program the ATMEGA?


#1

Is there way of using a USB-AVR programmer to load the patched firmware onto the ATMEGA
I’ve gone through the process of downloading the ET312 firmware and applying the patches - do I use the m005.bin file that the process creates or the .upg file or something else ?


#2

You’ll have to use the .bin file.
If you’re going to use the BT module, temporarily flash the BT setup firmware first.


#3

Thanks I think I’ve sorted the basic flashing now and the fuses - when I now power up the unit the display says Failure Mode 21 Shut off Power !
This suggests the PIC must be running ok to drive the display etc - what does mode 21 mean???


#4

It’s not a PIC, it’s an ATMEGA, but yes, it’s probably ok. Have you reconnected the battery and removed the ICSP cable yet? According to the ET312 manual, the error you mentioned has to do with the power supply.


#5

Have connected the battery - ICSP removed
Getting failure mode 21 when connected to the mains power supply
Getting failure mode 20 when running off the battery


#6

By way of an experiment I have connected a 12V DC Model Railway transformer across the battery terminals with the mains disconnected.
The 312 then boots up and am getting stim from Channel A ok.
This suggest the battery isn’t charged and there is a problem somewhere in the charging circuit/mains power feed.
Thoughts ?


#7

I think I would check if there are any shorted pins first.
You could also try to charge the battery with an external charger.


#8

Battery is now charged - same problem
Have started a new thread - as the original USB-AVR programming problem is now solved if you don’t want to use and Arduino/avrdude method.


#9

Do you know if it’s possible to use an arduino or similar board to program the BT module? I know there’s a way to use one arduino to flash another if they both have AVR ATmega chips on them, so it can probably flash the 312’s ATmega if it was wired up on a breadboard. The bluetooth module I know is flashed differently but I haven’t read enough to tell if it’s possible from a different system like the arduino. The worst case I can imagine is writing over/removing the software from the arduino’s ATmega where it’s not able to be reflashed with the correct software.


#10

I can’t say for sure, but I have a feeling that wouldn’t work. AFAIK the reason arduinos can flash each other is because they know how to talk to each other’s bootloader. In our case with the MK312, there’s either no bootloader, or it’s not an arduino one.


#11

Google ArduinoISP. You just have to load the ArduinoISP sketch from the examples to the Arduino you want to use as a programmer. I programmed my ATMEGA this way while it was inside the MK312 over the ISP connector. Disconnect the battery before connecting the programmer and use “-c arduino” for avrdude.


#12

I stand corrected, thanks!