Just4Trionic - CAN and BDM FLASH programmer for Saab cars

Dependencies:   mbed

Committer:
Just4pLeisure
Date:
Wed May 19 12:39:18 2010 +0000
Revision:
0:e0b964252a05

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Just4pLeisure 0:e0b964252a05 1
Just4pLeisure 0:e0b964252a05 2 // T5Utils.h - information and definitions needed for communicating with the T5 ECU
Just4pLeisure 0:e0b964252a05 3
Just4pLeisure 0:e0b964252a05 4 #include "mbed.h"
Just4pLeisure 0:e0b964252a05 5 #include "CANUtils.h"
Just4pLeisure 0:e0b964252a05 6
Just4pLeisure 0:e0b964252a05 7 #define TRUE 1
Just4pLeisure 0:e0b964252a05 8 #define FALSE 0
Just4pLeisure 0:e0b964252a05 9
Just4pLeisure 0:e0b964252a05 10 #define CMNDID 0x05
Just4pLeisure 0:e0b964252a05 11 #define ACK_ID 0x06
Just4pLeisure 0:e0b964252a05 12 #define RESPID 0x0C
Just4pLeisure 0:e0b964252a05 13
Just4pLeisure 0:e0b964252a05 14 #define T5_RDCMND {0xC4,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF} // C4 Command template for reading something from the T5 ECU
Just4pLeisure 0:e0b964252a05 15 #define T5_WRCMND {0xC4,0x00,0x00,0x00,0x00,0x00,0x00,0x00} // C4 Command template for writing something to the T5 ECU
Just4pLeisure 0:e0b964252a05 16 #define T5ACKCMND {0xC6,0x00,0x00,0x00,0x00,0x00,0x00,0x00} // C6 Command for acknowledging receipt of last message from T5 ECU or
Just4pLeisure 0:e0b964252a05 17 // asking it to send some more data (e.g. symbol table) I'm not sure which :lol:
Just4pLeisure 0:e0b964252a05 18 #define T5_BTCMND {0xA5,0x00,0x00,0x00,0x00,0x00,0x00,0x00} // A5 Command template for sending a bootloader to the T5 ECU
Just4pLeisure 0:e0b964252a05 19 #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 0:e0b964252a05 20 #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 0:e0b964252a05 21 #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 0:e0b964252a05 22 //#define T5RAMCMND {0xC7,0x00,0x00,0x00,0x00,0xFC,0xC4,0x77} // C7 Command for reading T5 RAM (all the symbols and adaption data is in RAM)
Just4pLeisure 0:e0b964252a05 23 #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 0:e0b964252a05 24
Just4pLeisure 0:e0b964252a05 25
Just4pLeisure 0:e0b964252a05 26 #define T5DMPCMND {0xA6,0x00,0x00,0x00,0x00,0x00,0x00,0x00} // A6 Command for dumping the T5 FLASH BIN file (Bootloader must be loaded before using)
Just4pLeisure 0:e0b964252a05 27 #define T5ERACMND {0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00} // C0 Command for erasing T5 FLASH Chips !!! (Bootloader must be loaded before using)
Just4pLeisure 0:e0b964252a05 28 #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 0:e0b964252a05 29 #define T5SUMCMND {0xC8,0x00,0x00,0x00,0x00,0x00,0x00,0x00} // C8 Command for reading T5 FLASH Checksum (Bootloader must be loaded before using)
Just4pLeisure 0:e0b964252a05 30 #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 0:e0b964252a05 31
Just4pLeisure 0:e0b964252a05 32
Just4pLeisure 0:e0b964252a05 33 #define T5MESSAGETIMEOUT 500 // 500 milliseconds (half a second) - Seems to be plenty of time to wait for messages on the CAN bus
Just4pLeisure 0:e0b964252a05 34 #define T5CHECKSUMTIMEOUT 60000 // 60 seconds (60,000 milliseconds) - Usually takes less than 2 seconds so allowing 10 is plenty
Just4pLeisure 0:e0b964252a05 35 // - Increased to 60 seconds for now because using it as erase timeout too
Just4pLeisure 0:e0b964252a05 36
Just4pLeisure 0:e0b964252a05 37 extern bool T5Open();
Just4pLeisure 0:e0b964252a05 38 extern bool T5Close();
Just4pLeisure 0:e0b964252a05 39 extern char T5WaitResponse();
Just4pLeisure 0:e0b964252a05 40 extern bool T5WaitResponsePrint();
Just4pLeisure 0:e0b964252a05 41 extern char *T5GetSymbol(char *a_symbol);
Just4pLeisure 0:e0b964252a05 42 extern bool T5ReadCmnd(char c);
Just4pLeisure 0:e0b964252a05 43 extern bool T5WriteCmnd(unsigned int addr, char data);
Just4pLeisure 0:e0b964252a05 44 extern char *T5ReadRAM(char *data, unsigned int addr);
Just4pLeisure 0:e0b964252a05 45 extern char *T5ReadFLASH(char *data, unsigned int addr);
Just4pLeisure 0:e0b964252a05 46 extern bool T5RAMCmnd(unsigned int addr);
Just4pLeisure 0:e0b964252a05 47 extern char *T5WaitRAM(char *data);
Just4pLeisure 0:e0b964252a05 48 extern bool T5Ack();
Just4pLeisure 0:e0b964252a05 49 extern bool T5SendBootAddress(unsigned int addr, int len);
Just4pLeisure 0:e0b964252a05 50 extern bool T5SendBootFrame (char *frame);
Just4pLeisure 0:e0b964252a05 51 extern bool T5StartBootLoader (unsigned int addr);
Just4pLeisure 0:e0b964252a05 52
Just4pLeisure 0:e0b964252a05 53 extern bool T5BootCSumCmnd();
Just4pLeisure 0:e0b964252a05 54 extern bool T5BootResetCmnd();
Just4pLeisure 0:e0b964252a05 55 extern bool T5BootFLASHType();
Just4pLeisure 0:e0b964252a05 56 extern bool T5BootEraseCmnd();
Just4pLeisure 0:e0b964252a05 57 extern bool T5BootDumpFLASHCmnd();
Just4pLeisure 0:e0b964252a05 58 extern char *T5WaitFLASH(char *data);
Just4pLeisure 0:e0b964252a05 59 extern bool T5BootC3Command();