Now some notes about the firmware stuff. It was not clear on the git repository, so I had to wrote something somewhere...
$ sudo apt-get install avrdude
$ avrdude -c usbasp-clone -p m16 -t
avrdude: Device signature = 0x1e9403 (probably m16)
Fuses for using the external 8MHz crystal (better clock accuracy for data link):
$ avrdude -c usbasp-clone -p m16 -U lfuse:w:0xFF:m -U hfuse:w:0xDC:m
Flashing firmware into MCU (adapt file name to your firmware):
$ avrdude -c usbasp-clone -p m16 -U "flash:w:mk312-bt/firmware/Custom Boot Message f005-MK312-BT/HelloFriend.bin"
The mk312's documentation states "A patched version of buttshock-et312-frankenbutt-f005 is recommended". The idea is to download the encrypted firmware from the official box supplier then unscrambling it (because licencing problem I suppose), this is made automatically by the buttshock tool fw-utils.py (it also seems to apply some patches). It worked when built mine, but may not work these days because files got deleted or moved (I'm not sure about this). I keep the next instructions here for history, but it is easy to find the already unscrambled firmware on the web or on some Telegram groups.
$ cd buttshock-et312-firmware
$ scripts/fw-utils.py --downloadfw
$ sudo apt-get install binutils-avr
$ cd ../buttshock-et312-frankenbutt/
$ cd m005
$ make
$ avrdude -c usbasp-clone -p m16 -U "flash:w:m005.bin"
Done!



About the bluetooth module configuration, it can be more practical to connect it directly to a usb-ttlserial module than to build special firmwares for the mk312 for setting up more custom parameters. Remember, when you plug a RS232 cable into the "LINK" port of the box, you're disconnecting the bluetooth module. Beware, I/O are 1.8 to 3.6V (there is a resistor bridge built into the mk312).



$ picocom /dev/ttyUSB0 --baud 38400 --omap crcrlf --echo

AT+PSWD?
+PSWD:1234
OK

The bluetooth serial can be hard to get properly working, even configured right, as any desynchronisation at the serial stream level may result to the need to reset the box, and by turning it off and on again, the power to the bluetooth module will be cycled too, resetting the connection at the bluetooth level. Personally, for connecting a computer, I use a more practical cable connected to the LINK socket. A wifi bridge replacement for the bluetooth module, ESP based, with integrated encryption handling has been developed. Easy to find on the local network (reply to a specific broadcasted UDP packed) and also offering encrypted mode for legacy software (socat or others software like VSPE can be used to create a virtual serial port).



Another very easy improvement is to replace the 7805 5V linear regulator (converting the voltage drop times the current to heat) by a 5V drop-in replacement 5V switching regulator module. There are plenty of 'em. I used a mEZD71201A-G from Mouser. Somebody used this. Any 5V model with compatible pinout should be OK. As the current compsumption from the battery is lower, it should greatly improve the run time, especially with bluetooth or ESP radio module installed.


Linear 5V regulator replaced by a switching drop-in replacement

Regular 7505CV mEZD71201A-G
At boot screen with no radio module 66mA 40mA
At boot screen with ESP module idle WiFi connection 141mA 71mA
"Toggle" program, normal power level, A and B set to 100%, no load 175mA 101mA
Input voltage for measurements: 12.5V


2018-09-04: first version of this page
2022-01-26: updated: bluetooth to usb-ttlserial picture, formatting, and text body
2022-04-01: added switching 5V regulator text, picture and table
2023-04-03: bluetooth section update about its depreciation in favor of MK312WIFI