Skip to content

Commit

Permalink
Enabled Atmel flashing
Browse files Browse the repository at this point in the history
  • Loading branch information
DieHertz committed Dec 17, 2016
1 parent 151e6c9 commit df9229c
Show file tree
Hide file tree
Showing 11 changed files with 197 additions and 128 deletions.
8 changes: 7 additions & 1 deletion _locales/en/messages.json
Expand Up @@ -248,6 +248,12 @@
"writeSetupStarted": {
"message": "Writing setup"
},
"writeSetupNoChanges": {
"message": "ESC $1: <strong>no changes</strong>"
},
"writeSetupBytesWritten": {
"message": "ESC $1: <strong>$2 byte(s)</strong> written"
},
"writeSetupFinished": {
"message": "Writing setup <span style=\"color: green\">finished</span>"
},
Expand All @@ -266,7 +272,7 @@
},

"escFlashingStarted": {
"message": "ESC $1: flashing started"
"message": "ESC $1: flashing <strong>started</strong>"
},
"escFlashingFinished": {
"message": "ESC $1: flashing <span style=\"color: green\">finished</span> in <strong>$2</strong> seconds"
Expand Down
4 changes: 4 additions & 0 deletions changelog.html
@@ -1,3 +1,7 @@
<span>2016.12.17 - 1.0/span>
<ul>
<li>Enabled Atmel flashing over both BLHeli and SimonK bootloaders</li>
</ul>
<span>2016.12.15 - 0.1.7</span>
<ul>
<li>Reduced maximum read size during flashing SiLabs ESCs to 128 bytes to circumvent an buffer overflow error in older implementations of BLHeli Passthrough on all flight controller firmwares</li>
Expand Down
Binary file modified images/icon_128.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 6 additions & 4 deletions js/_4way_if.js
Expand Up @@ -175,9 +175,10 @@ var _4way = {
return messages;
},

sendMessagePromised: function(command, params, address) {
sendMessagePromised: function(command, params, address, timeout) {
if (params == undefined) params = [ 0 ];
if (address == undefined) address = 0;
if (timeout == undefined) timeout = 2000;

var self = this,
message = self.createMessage(command, params, address),
Expand All @@ -193,7 +194,7 @@ var _4way = {
if (++retry < maxRetries) {
serial.send(message, sendCallback);
} else {
deferred.reject(new Error(JSON.stringify(msg)));
deferred.reject(new Error(_4way_command_to_string(msg.command) + ' ' + _4way_ack_to_string(msg.ack)));
}
}
}
Expand All @@ -211,7 +212,7 @@ var _4way = {
break;
}
}
}, 1000);
}, timeout);

self.callbacks.push({
command: command,
Expand Down Expand Up @@ -251,7 +252,8 @@ var _4way = {
},

writeEEprom: function(address, data) {
return this.sendMessagePromised(_4way_commands.cmd_DeviceWriteEEprom, data, address)
// writing EEprom is real slow on Atmel, hence increased timeout
return this.sendMessagePromised(_4way_commands.cmd_DeviceWriteEEprom, data, address, 10000)
},

reset: function(target) {
Expand Down
4 changes: 4 additions & 0 deletions js/blheli_eeprom_layout.js
Expand Up @@ -9,8 +9,12 @@ var BLHELI_MODES = {
var BLHELI_SILABS_EEPROM_OFFSET = 0x1A00
var BLHELI_SILABS_PAGE_SIZE = 0x0200
var BLHELI_SILABS_BOOTLOADER_ADDRESS = 0x1C00
var BLHELI_SILABS_BOOTLOADER_SIZE = 0x0200
var BLHELI_SILABS_FLASH_SIZE = 0x2000
var BLHELI_SILABS_ADDRESS_SPACE_SIZE = BLHELI_SILABS_BOOTLOADER_ADDRESS

var BLHELI_ATMEL_BLB_SIZE = 0x0200
var BLHELI_ATMEL_SK_SIZE = 0x0400
var BLHELI_ATMEL_BLB_ADDRESS_8 = 0x1E00
var BLHELI_ATMEL_BLB_ADDRESS_16 = 0x3E00
var BLHELI_ATMEL_SK_ADDRESS_8 = 0x1C00
Expand Down
4 changes: 4 additions & 0 deletions js/blheli_escs.js
Expand Up @@ -514,3 +514,7 @@ var BLHELI_ATMEL_MCUS = [
{ name: 'ATmega88P(A)', signature: 0x930F, page_size: 0x20, flash_size: 0x2000, eeprom_size: 0x200 },
{ name: 'ATmega168P(A)', signature: 0x940B, page_size: 0x40, flash_size: 0x4000, eeprom_size: 0x200 }
];

function findMCU(signature, MCUList) {
return MCUList.find(MCU => MCU.signature === signature);
}

0 comments on commit df9229c

Please sign in to comment.