Sophie Dexter
/
Just4Trionic
Just4Trionic - CAN and BDM FLASH programmer for Saab cars
main.cpp@5:1775b4b13232, 2015-04-25 (annotated)
- Committer:
- Just4pLeisure
- Date:
- Sat Apr 25 17:07:08 2015 +0000
- Revision:
- 5:1775b4b13232
- Parent:
- 4:682d96ff6d79
- Child:
- 6:2fbcbebed28c
Version 1.5 Is a significant milestone.; ; Supports BDM and CAN read and write of T5.x, T7 and T8 ECU's plus T8 recovery.; A Target Resident Driver for BDM gives a big speed boost.; Supports many alternative replacement FLASH chips for T5.x ECU's;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Just4pLeisure | 0:e0b964252a05 | 1 | /******************************************************************************* |
Just4pLeisure | 0:e0b964252a05 | 2 | |
Just4pLeisure | 1:d5452e398b76 | 3 | Just4Trionic by Just4pLeisure |
Just4pLeisure | 0:e0b964252a05 | 4 | ***************************** |
Just4pLeisure | 1:d5452e398b76 | 5 | (c) 2010 by Sophie Dexter |
Just4pLeisure | 0:e0b964252a05 | 6 | |
Just4pLeisure | 0:e0b964252a05 | 7 | Whilst I have written this program myself I could not have done it without |
Just4pLeisure | 0:e0b964252a05 | 8 | a lot of help and the original ideas and programs written by: |
Just4pLeisure | 0:e0b964252a05 | 9 | Dilemma - Author of the Trionic Suite software programs and general Guru |
Just4pLeisure | 0:e0b964252a05 | 10 | http://trionic.mobixs.eu/ and http://www.ecuproject.com. |
Just4pLeisure | 0:e0b964252a05 | 11 | General Failure - Author of the T5CANlib software and regular contributor at |
Just4pLeisure | 0:e0b964252a05 | 12 | http://www.ecuproject.com. |
Just4pLeisure | 0:e0b964252a05 | 13 | Tomi Liljemark - Lots of information and programs about the Saab CAN bus |
Just4pLeisure | 0:e0b964252a05 | 14 | http://pikkupossu.1g.fi/tomi/projects/projects.html. |
Just4pLeisure | 0:e0b964252a05 | 15 | Scott Howard - Author of the BDM software. |
Just4pLeisure | 1:d5452e398b76 | 16 | Janis Silins - Valued contributor at http://www.ecuproject.com and creator of |
Just4pLeisure | 1:d5452e398b76 | 17 | USBBDM. For sharing his BDM software (which also had a very useful method of |
Just4pLeisure | 1:d5452e398b76 | 18 | entering commands) |
Just4pLeisure | 1:d5452e398b76 | 19 | Plus inspiration and ideas from many others... |
Just4pLeisure | 0:e0b964252a05 | 20 | |
Just4pLeisure | 0:e0b964252a05 | 21 | Sophie x |
Just4pLeisure | 0:e0b964252a05 | 22 | |
Just4pLeisure | 0:e0b964252a05 | 23 | ******************************************************************************** |
Just4pLeisure | 0:e0b964252a05 | 24 | |
Just4pLeisure | 0:e0b964252a05 | 25 | WARNING: Use at your own risk, sadly this software comes with no guarantees. |
Just4pLeisure | 0:e0b964252a05 | 26 | This software is provided 'free' and in good faith, but the author does not |
Just4pLeisure | 0:e0b964252a05 | 27 | accept liability for any damage arising from its use. |
Just4pLeisure | 0:e0b964252a05 | 28 | |
Just4pLeisure | 0:e0b964252a05 | 29 | ******************************************************************************** |
Just4pLeisure | 0:e0b964252a05 | 30 | |
Just4pLeisure | 5:1775b4b13232 | 31 | Version 1.5 (04/2015) |
Just4pLeisure | 5:1775b4b13232 | 32 | |
Just4pLeisure | 5:1775b4b13232 | 33 | Added since Version 1.4 |
Just4pLeisure | 5:1775b4b13232 | 34 | T8 CAN functions: DUMP, FLASH and RECOVERY |
Just4pLeisure | 5:1775b4b13232 | 35 | Using modified T8Bootloaders that are slightly faster :-) |
Just4pLeisure | 5:1775b4b13232 | 36 | Algorithms for different types of 5 volt replacement FLASH Chips in T5 ECUs |
Just4pLeisure | 5:1775b4b13232 | 37 | AMD, ST and AMIC 29F010 types |
Just4pLeisure | 5:1775b4b13232 | 38 | SST 39F010 |
Just4pLeisure | 5:1775b4b13232 | 39 | ATMEL 29C512 and 29C010 |
Just4pLeisure | 5:1775b4b13232 | 40 | |
Just4pLeisure | 5:1775b4b13232 | 41 | Changes since Version 1.4 |
Just4pLeisure | 5:1775b4b13232 | 42 | BDM FLASHing uses BD32 like Target Resident Drivers. |
Just4pLeisure | 5:1775b4b13232 | 43 | Based on my 'universal scripts' |
Just4pLeisure | 5:1775b4b13232 | 44 | BDM FLASHing much faster now |
Just4pLeisure | 5:1775b4b13232 | 45 | Always use slow BDM clock function (bdm_clk_slow) for reliability |
Just4pLeisure | 5:1775b4b13232 | 46 | Even when using the slow method it only takes 8 seconds |
Just4pLeisure | 5:1775b4b13232 | 47 | longer to FLASH a T8 ECU. |
Just4pLeisure | 5:1775b4b13232 | 48 | mbed library and compiler changes make it difficult to |
Just4pLeisure | 5:1775b4b13232 | 49 | maintain the faster bdm functions that rely on software |
Just4pLeisure | 5:1775b4b13232 | 50 | delay loops for timing. |
Just4pLeisure | 5:1775b4b13232 | 51 | The file extension of the file to be FLASHed is now the more usual 'BIN'. |
Just4pLeisure | 5:1775b4b13232 | 52 | i.e. 'modified.bin' instead of 'modified.hex' |
Just4pLeisure | 5:1775b4b13232 | 53 | |
Just4pLeisure | 5:1775b4b13232 | 54 | ******************************************************************************** |
Just4pLeisure | 5:1775b4b13232 | 55 | |
Just4pLeisure | 4:682d96ff6d79 | 56 | Version 1.4 (07/2013) |
Just4pLeisure | 4:682d96ff6d79 | 57 | |
Just4pLeisure | 5:1775b4b13232 | 58 | Added since Verion 1.3 |
Just4pLeisure | 4:682d96ff6d79 | 59 | Progress indication shown as a percentage, slightly slower but more informative |
Just4pLeisure | 4:682d96ff6d79 | 60 | T8 BDM Functionality |
Just4pLeisure | 4:682d96ff6d79 | 61 | |
Just4pLeisure | 4:682d96ff6d79 | 62 | Changes since Verion 1.3 |
Just4pLeisure | 4:682d96ff6d79 | 63 | T7 CAN FLASH algorithm changed to only send 4 Bytes at a time |
Just4pLeisure | 4:682d96ff6d79 | 64 | Slightly slower but more reliable especially with I-Bus connection |
Just4pLeisure | 4:682d96ff6d79 | 65 | |
Just4pLeisure | 4:682d96ff6d79 | 66 | ******************************************************************************** |
Just4pLeisure | 4:682d96ff6d79 | 67 | |
Just4pLeisure | 3:92dae9083c83 | 68 | Version 1.3 (06/2011) - Basic T7 CAN support and faster T5 CAN bootloader |
Just4pLeisure | 3:92dae9083c83 | 69 | |
Just4pLeisure | 4:682d96ff6d79 | 70 | Changes since Verion 1.2 |
Just4pLeisure | 3:92dae9083c83 | 71 | New T7 CAN menu provides some very basic T7 CAN DUMP and FLASH functions |
Just4pLeisure | 3:92dae9083c83 | 72 | T5 CAN uses Mybooty version 2 for 1 Mbps CAN speed |
Just4pLeisure | 3:92dae9083c83 | 73 | Get MyBooty version 2.x from forum.ecuproject.com |
Just4pLeisure | 3:92dae9083c83 | 74 | Does not work with version MyBooty 1.x |
Just4pLeisure | 3:92dae9083c83 | 75 | |
Just4pLeisure | 3:92dae9083c83 | 76 | ******************************************************************************** |
Just4pLeisure | 3:92dae9083c83 | 77 | |
Just4pLeisure | 2:bf3a2b29259a | 78 | Version 1.2 (12/2010) - Only a very small update |
Just4pLeisure | 2:bf3a2b29259a | 79 | |
Just4pLeisure | 2:bf3a2b29259a | 80 | Fixed since Version 1.1: |
Just4pLeisure | 2:bf3a2b29259a | 81 | My method of detecting the FLASH type didn't work for T7 ECUs |
Just4pLeisure | 2:bf3a2b29259a | 82 | Now that that I have corrected this bug it is possible to |
Just4pLeisure | 2:bf3a2b29259a | 83 | FLASH Trionic 7 ECUs using the BDM connection |
Just4pLeisure | 2:bf3a2b29259a | 84 | See the 'get_flash_id' function in bdmtrionic.cpp |
Just4pLeisure | 2:bf3a2b29259a | 85 | |
Just4pLeisure | 3:92dae9083c83 | 86 | Changes since Verion 1.1 |
Just4pLeisure | 2:bf3a2b29259a | 87 | I have removed everything to do with the BDM DS connection |
Just4pLeisure | 2:bf3a2b29259a | 88 | I have changed the mbed pin number for the BDM DSO connection |
Just4pLeisure | 2:bf3a2b29259a | 89 | Now all BDM connections are part of the same MBED 'port' |
Just4pLeisure | 2:bf3a2b29259a | 90 | Being part of one port makes it possible to change all |
Just4pLeisure | 2:bf3a2b29259a | 91 | connections simulataneously so speeding up BDM |
Just4pLeisure | 2:bf3a2b29259a | 92 | See 'interfaces.cpp' for details of how the mbed pins connect. |
Just4pLeisure | 2:bf3a2b29259a | 93 | Uglybug's wiring circuit has these connections (thanks Uglybug) |
Just4pLeisure | 2:bf3a2b29259a | 94 | |
Just4pLeisure | 2:bf3a2b29259a | 95 | ******************************************************************************** |
Just4pLeisure | 2:bf3a2b29259a | 96 | |
Just4pLeisure | 1:d5452e398b76 | 97 | Version 1.1 (09/2010) - Still very crude way of doing things |
Just4pLeisure | 1:d5452e398b76 | 98 | |
Just4pLeisure | 1:d5452e398b76 | 99 | Additions since Version 1: |
Just4pLeisure | 1:d5452e398b76 | 100 | The BDM interface is now working |
Just4pLeisure | 1:d5452e398b76 | 101 | Based on Janis Silin's BDM software with modifications and additions |
Just4pLeisure | 1:d5452e398b76 | 102 | Detect which type of FLASH chip is fitted to work out type of ECU |
Just4pLeisure | 1:d5452e398b76 | 103 | Modifications to FLASH algorithms - I think my algorithms are |
Just4pLeisure | 1:d5452e398b76 | 104 | closer to the datasheet methods. Still to do: |
Just4pLeisure | 1:d5452e398b76 | 105 | Separate pulse counters for 28Fxxx erase |
Just4pLeisure | 1:d5452e398b76 | 106 | DQ7 and DQ5 checking method for 29Fxxx FLASH |
Just4pLeisure | 1:d5452e398b76 | 107 | Works for T5.5 ECUs with 28F010 and 29F010 chips |
Just4pLeisure | 1:d5452e398b76 | 108 | Probably works with T5.2 ECUs (chip detection method) |
Just4pLeisure | 1:d5452e398b76 | 109 | MAY work with T7 ECUs ('prep' method may need changes - I can't test T7) |
Just4pLeisure | 1:d5452e398b76 | 110 | NOTE: Some of Janis' original BDM commands may not work, or at least |
Just4pLeisure | 1:d5452e398b76 | 111 | not as originally intended |
Just4pLeisure | 1:d5452e398b76 | 112 | Lawicell CAN232 interface partially working |
Just4pLeisure | 1:d5452e398b76 | 113 | Only a few Lawicell message types to open/close, set speed and write |
Just4pLeisure | 1:d5452e398b76 | 114 | Trionic5 CAN functions |
Just4pLeisure | 1:d5452e398b76 | 115 | All-in-one 'D' and 'F' commands to DUMP and FLASH BIN files |
Just4pLeisure | 1:d5452e398b76 | 116 | Lots of checking for errors, either works or says it failed |
Just4pLeisure | 1:d5452e398b76 | 117 | No need to interpret the cryptic CAN messages anymore |
Just4pLeisure | 1:d5452e398b76 | 118 | Should now work for T5.2 and T5.5 ECUs |
Just4pLeisure | 1:d5452e398b76 | 119 | Detects FLASH chip type and works out which ECU is connected T5.2/5.5 |
Just4pLeisure | 1:d5452e398b76 | 120 | |
Just4pLeisure | 1:d5452e398b76 | 121 | ******************************************************************************** |
Just4pLeisure | 1:d5452e398b76 | 122 | |
Just4pLeisure | 1:d5452e398b76 | 123 | Version 1 (04/2010)- The basic CAN functions are working |
Just4pLeisure | 0:e0b964252a05 | 124 | |
Just4pLeisure | 0:e0b964252a05 | 125 | I have decided to 'release' this software somewhat prematurely because the FLASH |
Just4pLeisure | 0:e0b964252a05 | 126 | chips in my spare ECU have 'died' and I don't know when I will be able to do |
Just4pLeisure | 0:e0b964252a05 | 127 | carry on improving and 'polishing' it. This way others will be able to use and |
Just4pLeisure | 0:e0b964252a05 | 128 | enhance it without having to wait for me. |
Just4pLeisure | 0:e0b964252a05 | 129 | |
Just4pLeisure | 0:e0b964252a05 | 130 | For now, only option '5' Trionic ECU CAN interface is working. BDM and Lawicell |
Just4pLeisure | 0:e0b964252a05 | 131 | CAN232 functions are dummies. The intention is to build a complete suite of CAN |
Just4pLeisure | 0:e0b964252a05 | 132 | software for Trionic5, 7 and 8 ECU types as well as adding a BDM interface to |
Just4pLeisure | 0:e0b964252a05 | 133 | make an 'all-in-one' USB programming tool. |
Just4pLeisure | 0:e0b964252a05 | 134 | |
Just4pLeisure | 0:e0b964252a05 | 135 | To make this you will need an mbed system and the CAN circuit from this page: |
Just4pLeisure | 0:e0b964252a05 | 136 | http://mbed.org/projects/cookbook/wiki/CanBusExample1 |
Just4pLeisure | 0:e0b964252a05 | 137 | |
Just4pLeisure | 0:e0b964252a05 | 138 | Some ideas for the truly creative and adventurous of you is to make a gizmo that |
Just4pLeisure | 0:e0b964252a05 | 139 | doesn't even need to be connected to a laptop or PC to use, maybe even a self- |
Just4pLeisure | 0:e0b964252a05 | 140 | contained vesion of Dilemma's CarPC using ideas from this pages: |
Just4pLeisure | 0:e0b964252a05 | 141 | |
Just4pLeisure | 0:e0b964252a05 | 142 | http://mbed.org/projects/cookbook/wiki/PS2Keyboard |
Just4pLeisure | 0:e0b964252a05 | 143 | http://mbed.org/projects/cookbook/wiki/PS2Mouse |
Just4pLeisure | 0:e0b964252a05 | 144 | http://mbed.org/projects/cookbook/wiki/MobileLCD |
Just4pLeisure | 0:e0b964252a05 | 145 | http://mbed.org/projects/cookbook/wiki/SDCard |
Just4pLeisure | 0:e0b964252a05 | 146 | |
Just4pLeisure | 0:e0b964252a05 | 147 | *******************************************************************************/ |
Just4pLeisure | 0:e0b964252a05 | 148 | |
Just4pLeisure | 0:e0b964252a05 | 149 | #include "mbed.h" |
Just4pLeisure | 1:d5452e398b76 | 150 | // |
Just4pLeisure | 1:d5452e398b76 | 151 | #include "common.h" |
Just4pLeisure | 1:d5452e398b76 | 152 | #include "bdm.h" |
Just4pLeisure | 1:d5452e398b76 | 153 | #include "can232.h" |
Just4pLeisure | 1:d5452e398b76 | 154 | #include "t5can.h" |
Just4pLeisure | 3:92dae9083c83 | 155 | #include "t7can.h" |
Just4pLeisure | 4:682d96ff6d79 | 156 | #include "t8can.h" |
Just4pLeisure | 0:e0b964252a05 | 157 | |
Just4pLeisure | 1:d5452e398b76 | 158 | // constants |
Just4pLeisure | 1:d5452e398b76 | 159 | #define CMD_BUF_LENGTH 32 ///< command buffer size |
Just4pLeisure | 0:e0b964252a05 | 160 | |
Just4pLeisure | 1:d5452e398b76 | 161 | // static variables |
Just4pLeisure | 1:d5452e398b76 | 162 | static char cmd_buffer[CMD_BUF_LENGTH]; ///< command string buffer |
Just4pLeisure | 0:e0b964252a05 | 163 | |
Just4pLeisure | 1:d5452e398b76 | 164 | // private functions |
Just4pLeisure | 1:d5452e398b76 | 165 | uint8_t execute_just4trionic_cmd(); |
Just4pLeisure | 1:d5452e398b76 | 166 | void show_just4trionic_help(); |
Just4pLeisure | 0:e0b964252a05 | 167 | |
Just4pLeisure | 4:682d96ff6d79 | 168 | int main() |
Just4pLeisure | 4:682d96ff6d79 | 169 | { |
Just4pLeisure | 0:e0b964252a05 | 170 | // fast serial speed |
Just4pLeisure | 4:682d96ff6d79 | 171 | //pc.baud(921600); |
Just4pLeisure | 0:e0b964252a05 | 172 | pc.baud(115200); |
Just4pLeisure | 1:d5452e398b76 | 173 | |
Just4pLeisure | 1:d5452e398b76 | 174 | // the address of the function to be attached (leds_off) and the interval (0.1 seconds) |
Just4pLeisure | 1:d5452e398b76 | 175 | // This 'ticker' turns off the activity LEDs so that they don't stay on if something has gone wrong |
Just4pLeisure | 1:d5452e398b76 | 176 | ticker.attach(&leds_off, 0.1); |
Just4pLeisure | 1:d5452e398b76 | 177 | |
Just4pLeisure | 1:d5452e398b76 | 178 | // clear incoming buffer |
Just4pLeisure | 1:d5452e398b76 | 179 | // sometimes TeraTerm gets 'confused'. johnc does this in his code |
Just4pLeisure | 1:d5452e398b76 | 180 | // hopefully this will fix the problem |
Just4pLeisure | 1:d5452e398b76 | 181 | // unfortunately it doesn't, but it seems like a good idea |
Just4pLeisure | 1:d5452e398b76 | 182 | char rx_char; |
Just4pLeisure | 1:d5452e398b76 | 183 | while (pc.readable()) |
Just4pLeisure | 1:d5452e398b76 | 184 | rx_char = pc.getc(); |
Just4pLeisure | 1:d5452e398b76 | 185 | |
Just4pLeisure | 4:682d96ff6d79 | 186 | #ifdef DEBUG |
Just4pLeisure | 4:682d96ff6d79 | 187 | printf("*************************\r\n"); |
Just4pLeisure | 4:682d96ff6d79 | 188 | printf("** RUNNING DEBUG BUILD **\r\n"); |
Just4pLeisure | 4:682d96ff6d79 | 189 | printf("*************************\r\n"); |
Just4pLeisure | 4:682d96ff6d79 | 190 | #else |
Just4pLeisure | 4:682d96ff6d79 | 191 | printf("Running... this is a release build.\r\n"); |
Just4pLeisure | 4:682d96ff6d79 | 192 | #endif |
Just4pLeisure | 4:682d96ff6d79 | 193 | |
Just4pLeisure | 1:d5452e398b76 | 194 | show_just4trionic_help(); |
Just4pLeisure | 1:d5452e398b76 | 195 | |
Just4pLeisure | 1:d5452e398b76 | 196 | // main loop |
Just4pLeisure | 1:d5452e398b76 | 197 | *cmd_buffer = '\0'; |
Just4pLeisure | 1:d5452e398b76 | 198 | char ret; |
Just4pLeisure | 1:d5452e398b76 | 199 | while (true) { |
Just4pLeisure | 1:d5452e398b76 | 200 | // read chars from USB |
Just4pLeisure | 1:d5452e398b76 | 201 | // send received messages to the pc over USB connection |
Just4pLeisure | 1:d5452e398b76 | 202 | // This function displays any CAN messages that are 'missed' by the other functions |
Just4pLeisure | 1:d5452e398b76 | 203 | // Can messages might be 'missed' because they are received after a 'timeout' period |
Just4pLeisure | 1:d5452e398b76 | 204 | // or because they weren't expected, e.g. if the T5 ECU resets for some reason |
Just4pLeisure | 1:d5452e398b76 | 205 | t5_can_show_can_message(); |
Just4pLeisure | 1:d5452e398b76 | 206 | if (pc.readable()) { |
Just4pLeisure | 1:d5452e398b76 | 207 | // turn Error LED off for next command |
Just4pLeisure | 1:d5452e398b76 | 208 | led4 = 0; |
Just4pLeisure | 1:d5452e398b76 | 209 | rx_char = pc.getc(); |
Just4pLeisure | 1:d5452e398b76 | 210 | switch (rx_char) { |
Just4pLeisure | 1:d5452e398b76 | 211 | // end-of-command reached |
Just4pLeisure | 1:d5452e398b76 | 212 | case TERM_OK : |
Just4pLeisure | 1:d5452e398b76 | 213 | // execute command and return flag via USB |
Just4pLeisure | 1:d5452e398b76 | 214 | timer.reset(); |
Just4pLeisure | 1:d5452e398b76 | 215 | timer.start(); |
Just4pLeisure | 1:d5452e398b76 | 216 | ret = execute_just4trionic_cmd(); |
Just4pLeisure | 1:d5452e398b76 | 217 | show_just4trionic_help(); |
Just4pLeisure | 1:d5452e398b76 | 218 | pc.putc(ret); |
Just4pLeisure | 1:d5452e398b76 | 219 | // reset command buffer |
Just4pLeisure | 1:d5452e398b76 | 220 | *cmd_buffer = '\0'; |
Just4pLeisure | 1:d5452e398b76 | 221 | // light up LED |
Just4pLeisure | 1:d5452e398b76 | 222 | // ret == TERM_OK ? led_on(LED_ACT) : led_on(LED_ERR); |
Just4pLeisure | 1:d5452e398b76 | 223 | ret == TERM_OK ? led3 = 1 : led4 = 1; |
Just4pLeisure | 1:d5452e398b76 | 224 | break; |
Just4pLeisure | 1:d5452e398b76 | 225 | // another command char |
Just4pLeisure | 1:d5452e398b76 | 226 | default: |
Just4pLeisure | 1:d5452e398b76 | 227 | // store in buffer if space permits |
Just4pLeisure | 1:d5452e398b76 | 228 | if (StrLen(cmd_buffer) < CMD_BUF_LENGTH - 1) { |
Just4pLeisure | 1:d5452e398b76 | 229 | StrAddc(cmd_buffer, rx_char); |
Just4pLeisure | 1:d5452e398b76 | 230 | } |
Just4pLeisure | 1:d5452e398b76 | 231 | break; |
Just4pLeisure | 1:d5452e398b76 | 232 | } |
Just4pLeisure | 1:d5452e398b76 | 233 | } |
Just4pLeisure | 0:e0b964252a05 | 234 | } |
Just4pLeisure | 0:e0b964252a05 | 235 | } |
Just4pLeisure | 0:e0b964252a05 | 236 | |
Just4pLeisure | 1:d5452e398b76 | 237 | //----------------------------------------------------------------------------- |
Just4pLeisure | 1:d5452e398b76 | 238 | /** |
Just4pLeisure | 1:d5452e398b76 | 239 | Executes a command and returns result flag (does not transmit the flag |
Just4pLeisure | 1:d5452e398b76 | 240 | itself). |
Just4pLeisure | 1:d5452e398b76 | 241 | |
Just4pLeisure | 1:d5452e398b76 | 242 | @return command flag (success / failure) |
Just4pLeisure | 1:d5452e398b76 | 243 | */ |
Just4pLeisure | 4:682d96ff6d79 | 244 | uint8_t execute_just4trionic_cmd() |
Just4pLeisure | 4:682d96ff6d79 | 245 | { |
Just4pLeisure | 1:d5452e398b76 | 246 | |
Just4pLeisure | 1:d5452e398b76 | 247 | |
Just4pLeisure | 1:d5452e398b76 | 248 | // uint8_t cmd_length = strlen(cmd_buffer); |
Just4pLeisure | 1:d5452e398b76 | 249 | // command groups |
Just4pLeisure | 1:d5452e398b76 | 250 | switch (*cmd_buffer) { |
Just4pLeisure | 1:d5452e398b76 | 251 | // CHECK_ARGLENGTH(0); |
Just4pLeisure | 1:d5452e398b76 | 252 | case 'b': |
Just4pLeisure | 1:d5452e398b76 | 253 | case 'B': |
Just4pLeisure | 1:d5452e398b76 | 254 | bdm(); |
Just4pLeisure | 1:d5452e398b76 | 255 | return TERM_OK; |
Just4pLeisure | 1:d5452e398b76 | 256 | case 'o': |
Just4pLeisure | 1:d5452e398b76 | 257 | case 'O': |
Just4pLeisure | 1:d5452e398b76 | 258 | can232(); |
Just4pLeisure | 1:d5452e398b76 | 259 | return TERM_OK; |
Just4pLeisure | 1:d5452e398b76 | 260 | case '5': |
Just4pLeisure | 1:d5452e398b76 | 261 | t5_can(); |
Just4pLeisure | 1:d5452e398b76 | 262 | return TERM_OK; |
Just4pLeisure | 3:92dae9083c83 | 263 | case '7': |
Just4pLeisure | 3:92dae9083c83 | 264 | t7_can(); |
Just4pLeisure | 3:92dae9083c83 | 265 | return TERM_OK; |
Just4pLeisure | 4:682d96ff6d79 | 266 | case '8': |
Just4pLeisure | 4:682d96ff6d79 | 267 | t8_can(); |
Just4pLeisure | 4:682d96ff6d79 | 268 | return TERM_OK; |
Just4pLeisure | 1:d5452e398b76 | 269 | case 'h': |
Just4pLeisure | 1:d5452e398b76 | 270 | case 'H': |
Just4pLeisure | 1:d5452e398b76 | 271 | return TERM_OK; |
Just4pLeisure | 1:d5452e398b76 | 272 | default: |
Just4pLeisure | 1:d5452e398b76 | 273 | break; |
Just4pLeisure | 1:d5452e398b76 | 274 | } |
Just4pLeisure | 1:d5452e398b76 | 275 | |
Just4pLeisure | 1:d5452e398b76 | 276 | // unknown command |
Just4pLeisure | 1:d5452e398b76 | 277 | return TERM_ERR; |
Just4pLeisure | 1:d5452e398b76 | 278 | } |
Just4pLeisure | 1:d5452e398b76 | 279 | |
Just4pLeisure | 4:682d96ff6d79 | 280 | void show_just4trionic_help() |
Just4pLeisure | 4:682d96ff6d79 | 281 | { |
Just4pLeisure | 0:e0b964252a05 | 282 | printf("Just4Trionic Command Menu\r\n"); |
Just4pLeisure | 0:e0b964252a05 | 283 | printf("=========================\r\n"); |
Just4pLeisure | 1:d5452e398b76 | 284 | printf("b/B - Start BDM interface\r\n"); |
Just4pLeisure | 1:d5452e398b76 | 285 | printf("o/O - Open Lawicel CAN232 type interface\r\n"); |
Just4pLeisure | 0:e0b964252a05 | 286 | printf("5 - Start Trionic5 ECU CAN interface\r\n"); |
Just4pLeisure | 3:92dae9083c83 | 287 | printf("7 - Start Trionic7 ECU CAN interface\r\n"); |
Just4pLeisure | 4:682d96ff6d79 | 288 | printf("8 - Start Trionic8 ECU CAN interface\r\n"); |
Just4pLeisure | 0:e0b964252a05 | 289 | printf("\r\n"); |
Just4pLeisure | 0:e0b964252a05 | 290 | printf("h/H - show this help menu\r\n"); |
Just4pLeisure | 1:d5452e398b76 | 291 | printf("\r\n"); |
Just4pLeisure | 0:e0b964252a05 | 292 | return; |
Just4pLeisure | 1:d5452e398b76 | 293 | } |