Sophie Dexter
/
Just4Trionic
Just4Trionic - CAN and BDM FLASH programmer for Saab cars
t5utils.h@6:2fbcbebed28c, 2016-04-23 (annotated)
- Committer:
- Just4pLeisure
- Date:
- Sat Apr 23 18:31:40 2016 +0000
- Revision:
- 6:2fbcbebed28c
- Parent:
- 1:d5452e398b76
Version 1.6 Faster T7 P-BUS FLASHing algorithm, longer T8 erase timeout fixed BDM register display function
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Just4pLeisure | 1:d5452e398b76 | 1 | |
Just4pLeisure | 1:d5452e398b76 | 2 | // t5utils.h - information and definitions needed for communicating with the T5 ECU |
Just4pLeisure | 1:d5452e398b76 | 3 | |
Just4pLeisure | 1:d5452e398b76 | 4 | // (C) 2010, Sophie Dexter |
Just4pLeisure | 1:d5452e398b76 | 5 | |
Just4pLeisure | 1:d5452e398b76 | 6 | #ifndef __T5UTILS_H__ |
Just4pLeisure | 1:d5452e398b76 | 7 | #define __T5UTILS_H__ |
Just4pLeisure | 1:d5452e398b76 | 8 | |
Just4pLeisure | 1:d5452e398b76 | 9 | #include "mbed.h" |
Just4pLeisure | 1:d5452e398b76 | 10 | |
Just4pLeisure | 1:d5452e398b76 | 11 | #include "common.h" |
Just4pLeisure | 1:d5452e398b76 | 12 | #include "canutils.h" |
Just4pLeisure | 1:d5452e398b76 | 13 | |
Just4pLeisure | 1:d5452e398b76 | 14 | #define CMNDID 0x05 |
Just4pLeisure | 1:d5452e398b76 | 15 | #define ACK_ID 0x06 |
Just4pLeisure | 1:d5452e398b76 | 16 | #define RESPID 0x0C |
Just4pLeisure | 1:d5452e398b76 | 17 | #define RSETID 0x08 |
Just4pLeisure | 1:d5452e398b76 | 18 | |
Just4pLeisure | 1:d5452e398b76 | 19 | #define T5_RDCMND {0xC4,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF} // C4 Command template for reading something from the T5 ECU |
Just4pLeisure | 1:d5452e398b76 | 20 | #define T5_WRCMND {0xC4,0x00,0x00,0x00,0x00,0x00,0x00,0x00} // C4 Command template for writing something to the T5 ECU |
Just4pLeisure | 1:d5452e398b76 | 21 | #define T5ACKCMND {0xC6,0x00,0x00,0x00,0x00,0x00,0x00,0x00} // C6 Command for acknowledging receipt of last message from T5 ECU or |
Just4pLeisure | 1:d5452e398b76 | 22 | // asking it to send some more data (e.g. symbol table) I'm not sure which :lol: |
Just4pLeisure | 1:d5452e398b76 | 23 | #define T5_BTCMND {0xA5,0x00,0x00,0x00,0x00,0x00,0x00,0x00} // A5 Command template for sending a bootloader to the T5 ECU |
Just4pLeisure | 1:d5452e398b76 | 24 | #define T5JMPCMND {0xC1,0x00,0x00,0x00,0x00,0x00,0x00,0x00} // C1 Command template for starting a bootloader that has been sent to the T5 ECU |
Just4pLeisure | 1:d5452e398b76 | 25 | #define T5EOFCMND {0xC3,0x00,0x00,0x00,0x00,0x00,0x00,0x00} // C3 Command for reading back the last address of FLASH in the T5 ECU |
Just4pLeisure | 1:d5452e398b76 | 26 | #define T5A_DCMND {0xC5,0x00,0x00,0x00,0x00,0x00,0x00,0x00} // C5 Command for setting analogue to digital registers (don't know what this is for) |
Just4pLeisure | 1:d5452e398b76 | 27 | #define T5RAMCMND {0xC7,0x00,0x00,0x00,0x00,0x00,0x00,0x00} // C7 Command for reading T5 RAM (all the symbols and adaption data is in RAM) |
Just4pLeisure | 1:d5452e398b76 | 28 | |
Just4pLeisure | 1:d5452e398b76 | 29 | |
Just4pLeisure | 1:d5452e398b76 | 30 | #define T5ERACMND {0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00} // C0 Command for erasing T5 FLASH Chips !!! (Bootloader must be loaded before using) |
Just4pLeisure | 1:d5452e398b76 | 31 | #define T5RSTCMND {0xC2,0x00,0x00,0x00,0x00,0x00,0x00,0x00} // C2 Command for exiting the Bootloader and restarting the T5 ECU (Bootloader must be loaded before using) |
Just4pLeisure | 1:d5452e398b76 | 32 | #define T5SUMCMND {0xC8,0x00,0x00,0x00,0x00,0x00,0x00,0x00} // C8 Command for reading T5 FLASH Checksum (Bootloader must be loaded before using) |
Just4pLeisure | 1:d5452e398b76 | 33 | #define T5TYPCMND {0xC9,0x00,0x00,0x00,0x00,0x00,0x00,0x00} // C9 Command for reading T5 FLASH Chip types (Bootloader must be loaded before using) |
Just4pLeisure | 1:d5452e398b76 | 34 | |
Just4pLeisure | 1:d5452e398b76 | 35 | #define T5STARTMSG {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00} // T5 sends this message whenever the ignition is turned on? - message id is RESPID |
Just4pLeisure | 1:d5452e398b76 | 36 | #define T5RESETMSG {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF} // T5 sends this message to say that it has reset - message id is RSETID |
Just4pLeisure | 1:d5452e398b76 | 37 | |
Just4pLeisure | 1:d5452e398b76 | 38 | #define T5MESSAGETIMEOUT 500 // 500 milliseconds (half a second) - Seems to be plenty of time to wait for messages on the CAN bus |
Just4pLeisure | 1:d5452e398b76 | 39 | #define T5CHECKSUMTIMEOUT 2000 // 2 seconds (2,000 milliseconds) - Usually takes less than a second so allowing 2 is plenty |
Just4pLeisure | 1:d5452e398b76 | 40 | #define T5ERASETIMEOUT 40000 // 40 seconds (60,000 milliseconds) - Usually takes less than 20 seconds so allowing 40 is plenty |
Just4pLeisure | 1:d5452e398b76 | 41 | |
Just4pLeisure | 1:d5452e398b76 | 42 | extern bool T5Open(); |
Just4pLeisure | 1:d5452e398b76 | 43 | extern bool T5Close(); |
Just4pLeisure | 1:d5452e398b76 | 44 | extern char T5WaitResponse(); |
Just4pLeisure | 1:d5452e398b76 | 45 | extern bool T5WaitResponsePrint(); |
Just4pLeisure | 1:d5452e398b76 | 46 | extern char *T5GetSymbol(char *a_symbol); |
Just4pLeisure | 1:d5452e398b76 | 47 | extern bool T5ReadCmnd(char c); |
Just4pLeisure | 1:d5452e398b76 | 48 | extern bool T5WriteCmnd(uint32_t addr, char data); |
Just4pLeisure | 1:d5452e398b76 | 49 | extern bool t5_can_read_data(char *data, uint32_t addr); |
Just4pLeisure | 1:d5452e398b76 | 50 | extern bool T5Ack(); |
Just4pLeisure | 1:d5452e398b76 | 51 | extern bool t5_can_send_boot_address(uint32_t addr, uint8_t len); |
Just4pLeisure | 1:d5452e398b76 | 52 | extern bool t5_can_send_boot_frame(char *T5TxMsg); |
Just4pLeisure | 1:d5452e398b76 | 53 | extern bool T5StartBootLoader (uint32_t addr); |
Just4pLeisure | 1:d5452e398b76 | 54 | |
Just4pLeisure | 1:d5452e398b76 | 55 | extern bool t5_boot_checksum_command(uint32_t* result); |
Just4pLeisure | 1:d5452e398b76 | 56 | extern bool t5_boot_reset_command(); |
Just4pLeisure | 1:d5452e398b76 | 57 | extern bool t5_boot_get_flash_type(uint32_t* result, uint8_t* make, uint8_t* type); |
Just4pLeisure | 1:d5452e398b76 | 58 | extern bool t5_boot_erase_command(); |
Just4pLeisure | 1:d5452e398b76 | 59 | extern bool t5_boot_c3_command(uint32_t* result, uint16_t* mode); |
Just4pLeisure | 1:d5452e398b76 | 60 | |
Just4pLeisure | 1:d5452e398b76 | 61 | #endif |