Sophie Dexter
/
Just4Trionic
Just4Trionic - CAN and BDM FLASH programmer for Saab cars
Diff: t8can.cpp
- Revision:
- 5:1775b4b13232
- Parent:
- 4:682d96ff6d79
--- a/t8can.cpp Wed Sep 11 11:55:51 2013 +0000 +++ b/t8can.cpp Sat Apr 25 17:07:08 2015 +0000 @@ -64,6 +64,15 @@ } } + can_reset_filters(); + can_add_filter(2, 0x645); //645h - CIM + can_add_filter(2, 0x7E0); //7E0h - + can_add_filter(2, 0x7E8); //7E8h - + can_add_filter(2, 0x311); //311h - + can_add_filter(2, 0x5E8); //5E8h - + //can_add_filter(2, 0x101); //101h - + + // main loop *cmd_buffer = '\0'; char ret; @@ -139,7 +148,7 @@ // ? TERM_OK : TERM_ERR; case 'a' : case 'A' : - if (t8_authenticate(0x01)) { + if (t8_authenticate(T8REQID, T8RESPID, 0x01)) { printf("Security Key Accepted\r\n"); return TERM_OK; } else { @@ -149,45 +158,21 @@ // return t7_authenticate() // ? TERM_OK : TERM_ERR; -// Erase the FLASH chips - case 'e': - case 'E': - return t8_erase() - ? TERM_OK : TERM_ERR; // DUMP the T8 ECU BIN file stored in the FLASH chips case 'D': - if (!t8_authenticate(0x00)) { - if (!t8_initialise()) { - printf("Trionic 7 Connection Failed\r\n"); - return TERM_ERR; - } - if (!t8_authenticate(0x00)) { - printf("Security Key Failed\r\n"); - return TERM_ERR; - } - } case 'd': return t8_dump() ? TERM_OK : TERM_ERR; // Send a FLASH update file to the T8 ECU case 'F': - if (!t8_authenticate(0x00)) { - if (!t8_initialise()) { - printf("Trionic 7 Connection Failed\r\n"); - return TERM_ERR; - } - if (!t8_authenticate(0x00)) { - printf("Security Key Failed\r\n"); - return TERM_ERR; - } - } - if (!t8_erase()) { - printf("Could not Erase FLASH!\r\n"); - return TERM_ERR; - } case 'f': return t8_flash() ? TERM_OK : TERM_ERR; +// Erase the FLASH chips + case 'r': + case 'R': + return t8_recover() + ? TERM_OK : TERM_ERR; // Try to connect to CAN I-BUS case 'I' : printf("Trying to open CAN I-Bus (47619 Bit/s)...\r\n"); @@ -255,7 +240,8 @@ printf("Trionic 8 Command Menu\r\n"); printf("======================\r\n"); printf("D - DUMP the T8 ECU FLASH to a file 'ORIGINAL.BIN'\r\n"); - printf("F - FLASH the update file 'MODIFIED.HEX' to the T8\r\n"); + printf("F - FLASH the update file 'MODIFIED.BIN' to the T8\r\n"); + printf("R - Recover your T8 ECU FLASH with 'MODIFIED.BIN' file\r\n"); printf("\r\n"); printf("I - Try to open CAN I-Bus (47619 Bit/s)\r\n"); printf("P - Try to open CAN P-Bus (500 kBit/s)\r\n"); @@ -279,7 +265,8 @@ printf("Trionic 8 Command Menu\r\n"); printf("======================\r\n"); printf("D - DUMP the T8 ECU FLASH to a file 'ORIGINAL.BIN'\r\n"); - printf("F - FLASH the update file 'MODIFIED.HEX' to the T8\r\n"); + printf("F - FLASH the update file 'MODIFIED.BIN' to the T8\r\n"); + printf("R - Recover your T8 ECU FLASH with 'MODIFIED.BIN' file\r\n"); printf("\r\n"); printf("I - Try to open CAN I-Bus (47619 Bit/s)\r\n"); printf("P - Try to open CAN P-Bus (500 kBit/s)\r\n");