Sophie Dexter
/
Just4Trionic
Just4Trionic - CAN and BDM FLASH programmer for Saab cars
Diff: t5can.cpp
- Revision:
- 3:92dae9083c83
- Parent:
- 1:d5452e398b76
- Child:
- 5:1775b4b13232
--- a/t5can.cpp Tue Dec 14 21:50:35 2010 +0000 +++ b/t5can.cpp Tue Jun 07 12:23:28 2011 +0000 @@ -77,7 +77,7 @@ timer.start(); ret = execute_t5_cmd(); pc.putc(ret); - printf("Completed in %.1f seconds.\r\n", timer.read()); + printf("Completed in %.3f seconds.\r\n", timer.read()); // reset command buffer *cmd_buffer = '\0'; // light up LED @@ -152,7 +152,8 @@ // Send a Bootloader file to the T5 ECU case 'b': case 'B': - return t5_can_send_boot_loader() + return (t5_can_send_boot_loader() && can_set_speed(1000000)) +// return (t5_can_send_boot_loader() && can_set_speed(615000)) ? TERM_OK : TERM_ERR; // Get Checksum from ECU (Bootloader must be uploaded first) @@ -164,7 +165,7 @@ // Exit the BootLoader and restart the T5 ECU case 'q': case 'Q': - return t5_can_bootloader_reset() + return (t5_can_bootloader_reset() && can_set_speed(615000)) ? TERM_OK : TERM_ERR; // Erase the FLASH chips @@ -189,11 +190,13 @@ return TERM_ERR; if (!t5_can_send_boot_loader()) return TERM_ERR; + can_set_speed(1000000); if (!t5_can_get_start_and_chip_types(&flash_start)) { t5_can_bootloader_reset(); + can_set_speed(615000); return TERM_ERR; } - return (t5_can_dump_flash(flash_start) && t5_can_bootloader_reset()) + return (t5_can_dump_flash(flash_start) && t5_can_bootloader_reset() && can_set_speed(615000)) ? TERM_OK : TERM_ERR; // Send a FLASH update file to the T5 ECU @@ -204,17 +207,20 @@ case 'F': if (!t5_can_send_boot_loader()) return TERM_ERR; + can_set_speed(1000000); if (!t5_can_get_start_and_chip_types(&flash_start)) { t5_can_bootloader_reset(); + can_set_speed(615000); return TERM_ERR; } if (!t5_can_get_checksum()) led4 = 1; if (!t5_can_erase_flash()) { t5_can_bootloader_reset(); + can_set_speed(615000); return TERM_ERR; } - return (t5_can_send_flash_bin_update(flash_start) && t5_can_get_checksum() && t5_can_bootloader_reset()) + return (t5_can_send_flash_bin_update(flash_start) && t5_can_get_checksum() && t5_can_bootloader_reset() && can_set_speed(615000)) ? TERM_OK : TERM_ERR; // Send the C3 message - should get last used address 0x7FFFF