This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430_BSL Olimex Rocket firmware for UART?

Other Parts Discussed in Thread: CC430F5137, MSP430F1611

Hello guys!

I have just bought the Olimex Rocket MSP430-BSL for programming through Python Tools (msp430.bsl5.uart) a CC430F5137. It doesn`t works because I realize that rocket firmware it's done for I2C BSL. I have downloaded the source code from https://git.ti.com/msp430-bsl and I've tried to change it for use with UART, but I don't have success. Also, I read all points of http://processors.wiki.ti.com/index.php/BSL_(MSP430) to learn more about this hardware and its tools, using another tools like BSL_scripter, but I don't obtained any result.

So, MSP430-BSL rocket could program CC430 chips? Anyone has the firmware TXT for use the rocket for UART BSL?

Thanks in advance!

BR

Luis

  • Hi Luis,

    I actually think that if you have the msp430-bsl code loaded in the olimex rocket board without any alteration, it supports both I2C and UART. It determines which interface to used based on if you change the baud rate on the USB side - for example, if I want to start the BSL in UART mode I go into my terminal program and set the baud rate to 9601 and this will cause the UART BSL interface to be used (you can find this in the IAR project if you look for 9601). The latest version of the BSL Scripter software from the download www.ti.com/lit/zip/slau319 sends this 9601 baud rate change for you, so it will get the rocket board to start the BSL using the UART interface automatically.

    So I'd recommend going back and trying a fresh unaltered version of the msp430-bsl software (leave it with the predefined symbol for I2C_BASED), and try using it with the BSL Scripter software. Let us know if you keep having a problem, and we can look at your script and BSL connections to see what might be going on.

    Regards,

    Katie

  • Hi Katie!

    Thanks a lot for your reply.

    I've tried the BSL-Scripter with the default firmware of the MSP430-BSL Rocket and I don't have success.  I run an example script only for view if the programm process starts on my CC430F5137, but nothing occurs. Only one fast reset at the beginning and then the CC430F5137 starts its normal program.

    BSL-Scripter screen:

    Initializing, Mode: 5xx COM: COM7       DONE

    Changing Baud Rate to 9601              FAIL

    Mass Erase:                             FAIL(

    RX Password:                            FAIL(

    Writing Big_File.txt to device: FAIL writing

    CRC from 5c00 of 4096 bytes to 982b     FAIL

     


    The TXT that I've used on Rocket is version 2.1, downloaded from http://processors.wiki.ti.com/index.php/MSP430-BSL.

    The connections between the CC430F5137 and the Rocket BSL are:

    ROCKET BSL             CC430F5137

    BSL-RST                      #RST/NMI/SBWTDIO 

    BSL-TCK                     PJ.3/TCK

    BSL-TEST                   TEST/SBWTCK

    BSL-TX                        P1.6/PM_UCA0TXD

    BSL-RX                        P1.5/PM_UCA0RXD

    VCC                              VCC

    GND                             GND

    I have been testing the continuity between all the signals and they are all OK.

    So, in summary, at this moment I can't program the CC430F5137 with Rocket MSP430-BSL with any software tool like PYTHON MSP430.BSL5.UART, or BSL-Scripter.

     Could the problem be the CC430F5137?

    BR

    Luis

  • Hi Luis,

    If you use the most recent version of the scripter (version I of SLAU319, which should be linked from my download above), you do not need to use the Change Baud Rate command at all - it is already behind the scenes going to do the BSL entry sequence for you.

    It might be useful to add the "VERBOSE" command into your script.txt at the beginning, so that you can see the bytes going back and forth - it will help give a clue if you are getting any response from the MSP430 at all or not. You may want to comment out the line for loading a new firmware then so it doesn't take so long to run for testing, and just try to get the mass erase / rx password commands working.

    I will try to find a Rocket board here to test with the same firmware.
    -Katie
  • Thanks again Katie.

    I use the simple script.txt:

    MODE 5xx COM7

    VERBOSE

    MASS_ERASE

    And the results are the same: FAIL

    I have a 1nF capacitor in my reset line... could it be a problem?

    BR

    Luis

  • Hi Luis,

    I did not have a CC430F5137 here so I used another device, but I was able to successfully use BSL_Scripter.exe with the BSL rocket board and the version of the rocket firmware that you mentioned from the wiki, version 2.1.

    What board do you have for the CC430F5137? Is it a TI board or a custom board?

    Additionally, one thing that I did not check on your connections is the Vcc connection. The Rocket board has two different Vcc connections - one for powering the target board from the Rocket, and one for the target board being externally powered. In my test I powered the board from the rocket, which means connecting the device Vcc to rocket pin 6. Is this the same pin that you used? Maybe you could provide BSL rocket pin numbers for your pin connections (rather than just saying BSL-TX, BSL-RX, etc)? Does your board consume a lot of current - in this case maybe you'd have to power it externally and make that connection instead.

    luis.lopez said:
    I have a 1nF capacitor in my reset line... could it be a problem?

    We usually say you should have no more than 2.2nF capacitor on RST, so this would be ok. However, just in case your lines between the MSP and the rocket board are long (and so could have a lot of capacitance themselves) and for testing's sake, you may want to try removing this 1nF cap to see if it lets you into the part as it would be a fairly simple test to try.

    Regards,

    Katie

  • Good morning Katie. 

    Thanks again for your help.

    I am using a custom board based on CC430F5137. Until now, I am programming and debugging it with the eZ430-EMULATION part of the TI Board MSP-EXP430F5529, as you can see in the attached pic, via CCS.

    Nevertheless, I want to program the circuit via BSL with a simple script ant TXT firmware, without running any platform as CCS or IAR.

    On the other hand, as you say, I have supplied the circuit with external power supply, and it still failing. Also, I quit the reset capacitor and doesn't run.

    Here is the connections that I have between rocket and my circuit:

    I guess that if I can program and debug my board without any problem with the TI FET, the lines of my circuit are correct. 

    BR,

    Luis.

  • Hi Luis,

    You don't need TCK but the lines look OK. 

    Can you check the TEST+RESET lines with an oscilloscope? It also helps to load a simple LED toggle to the MCU (using JTAG) to check if the entry sequence is working or not. If the LED stops toggling, then the entry sequence is OK, and we would need to check the UART communication.

    Now, I tried using the Rocket with a EM430F5137RF900 and I had some problems with the entry sequence, but I'm not sure if that's because I'm using an old pre-release silicon. In any case, the problem got fixed when I changed the following line in uart.c:

    //Step 3
    //RESET LOW
    //TEST LOW
    //TCK HIGH
    PJOUT = TCK_PIN;

    //Delay(20);                            // This smaller delay is due to bug SYS10 of older Revs/devices like F5438A Rev G

     Delay(INVOKE_DELAY);    // Increasing the delay seems to work for CC430

     


    Here are the updated binaries if you want to try them: 

    @A000
    82 02 01 02 80 1C C0 1C 00 1D 40 1D 80 1D C0 1D
    A1 21 00 00 00 00 07 00 FF 00 5A C2 00 00 21 20
    00 00 00 00 07 00 FF 00 FA C7 00 00 21 22 FF FF
    00 00 00 00 CF 00 38 C8 00 00 00 01 01 00 00 00
    00 00 FF 00 32 C7 00 00 02 01 00 00 FF 00 00 00
    F7 00 5E C3 00 00 80 08 00 00 00 00 01 00 FF 00
    8C C7 00 00 80 06 FF 01 FF FF FF FF D0 00 20 C7
    00 00 80 06 FF 02 FF FF FF FF D0 00 FC C6 00 00
    80 06 FF 03 FF FF FF FF D0 00 30 C1 00 00 81 0A
    00 00 FF FF 01 00 F3 00 88 C6 00 00 80 00 00 00
    00 00 02 00 FF 00 2A C5 00 00 81 00 00 00 FF 00
    02 00 F7 00 6E C6 00 00 82 00 00 00 FF 00 02 00
    F7 00 10 BD 00 00 00 05 FF 00 00 00 00 00 DF 00
    54 C6 00 00 00 09 FF 00 00 00 00 00 DF 00 B8 C5
    00 00 00 03 FF 00 00 00 00 00 DF 00 0E C7 00 00
    02 03 FF 00 FF 00 00 00 D7 00 E0 C2 00 00 01 0B
    FF 00 FF 00 00 00 D7 00 9C C7 00 00 FF FF FF FF
    FF FF FF FF 00 00 B8 C7 00 00 12 01 00 02 02 00
    00 08 47 20 0B 03 00 01 01 02 03 01 09 02 43 00
    02 01 04 80 32 09 04 00 00 01 02 02 01 05 05 24
    00 10 01 05 24 01 00 01 04 24 02 02 05 24 06 00
    01 07 05 81 03 40 00 FF 09 04 01 00 02 0A 00 00
    00 07 05 02 02 40 00 FF 07 05 82 02 40 00 FF 04
    03 09 04 24 03 54 00 65 00 78 00 61 00 73 00 20
    00 49 00 6E 00 73 00 74 00 72 00 75 00 6D 00 65
    00 6E 00 74 00 73 00 22 03 4D 00 53 00 50 00 20
    00 42 00 53 00 4C 00 20 00 55 00 53 00 42 00 20
    00 54 00 6F 00 6F 00 6C 00 04 03 30 00 16 03 4D
    00 53 00 50 00 34 00 33 00 30 00 20 00 55 00 53
    00 42 00 22 03 4D 00 53 00 50 00 20 00 42 00 53
    00 4C 00 20 00 55 00 53 00 42 00 20 00 54 00 6F
    00 6F 00 6C 00 00 00 00 1A 41 0A 8D 20 06 46 10
    0A 82 00 31 41 00 21 20 00 91 15 00 B1 0A 00 E1
    05 00 71 02 00 AD 15 00 0C 
    @A21A
    01 
    @A21C
    31 40 00 34 3C 40 02 24 3D 40 89 02 B0 13 7A C7
    3C 40 00 24 3D 40 1A A2 3E 40 01 00 B0 13 3C C8
    B0 13 18 AD B0 13 2C C8 1F 15 1F 42 FE 05 E0 0F
    74 3C 73 3C 04 3C 71 3C 70 3C 05 3C 60 3C F2 40
    05 00 44 25 6A 3C C2 93 43 25 17 20 1F 42 10 24
    DF 42 EC 05 00 00 92 53 10 24 1F 42 10 24 CF 93
    FF FF 03 24 E2 D2 E0 05 58 3C D2 43 43 25 B2 40
    03 00 12 24 82 43 14 24 50 3C B2 53 12 24 82 93
    12 24 10 24 1F 42 10 24 DF 42 EC 05 00 00 92 53
    10 24 92 93 12 24 41 20 82 93 14 24 3E 24 E2 D2
    E0 05 3B 3C 82 93 14 24 22 20 1F 42 10 24 DF 42
    EC 05 00 00 92 53 10 24 1F 42 10 24 5E 4F FE FF
    4E 4E 1F 42 10 24 5F 4F FF FF 4F 4F 3F F0 FF 00
    8F 10 0F DE 82 4F 14 24 82 93 14 24 02 20 E2 D2
    E0 05 1F 42 14 24 2F 53 82 4F 12 24 16 3C 1F 42
    10 24 DF 42 EC 05 00 00 E2 43 44 25 0E 3C 82 93
    0E 24 09 24 1F 42 0C 24 E2 4F EE 05 92 53 0C 24
    B2 53 0E 24 02 3C E2 42 44 25 1E 17 00 13 0C 12
    0F 12 1F 42 9A 01 E0 0F 04 3C 05 3C 06 3C 0A 3C
    0B 3C 03 43 0D 3C 03 43 0B 3C 92 C3 6E 01 A2 C3
    02 01 06 3C 03 43 04 3C 82 43 98 01 B0 13 96 C5
    3F 41 3C 41 00 13 00 13 3F 15 1F 42 DE 05 E0 0F
    13 3C 01 3C 10 3C 03 43 C2 43 71 26 4E 43 1D 43
    3C 40 CC 05 B0 13 F4 BB 3F 40 71 26 0F 93 FC 27
    D2 C3 DD 05 01 3C 03 43 3C 17 00 13 0F 12 1F 42
    0E 05 E0 0F 08 3C 07 3C 06 3C 05 3C 04 3C 03 3C
    02 3C 01 3C 00 3C 3F 41 00 13 5F 15 4A 43 E2 B2
    3E 09 05 28 B0 13 A0 C2 4A 4C E2 C2 3E 09 1F 42
    32 09 3F F0 3F 00 E0 0F 84 3C 1E 3C 82 3C 81 3C
    1D 3C 23 3C 2B 3C 7D 3C 7C 3C 31 3C 33 3C 35 3C
    3D 3C 46 3C 76 3C 75 3C 4E 3C 73 3C 72 3C 54 3C
    70 3C 6F 3C 6E 3C 6D 3C 6C 3C 6B 3C 55 3C 69 3C
    68 3C 67 3C 66 3C 65 3C 03 43 63 3C 92 B3 1E 24
    60 28 B0 13 24 C8 4A 4C 5C 3C B0 13 98 C3 A2 B3
    1E 24 57 28 B0 13 D4 C6 4A 4C 53 3C B0 13 14 C2
    A2 B2 1E 24 4E 28 B0 13 F2 C7 4A 4C 4A 3C B0 13
    A2 C6 47 3C B0 13 8E C0 44 3C B0 13 D8 AE B2 B2
    1E 24 3F 28 B0 13 20 C8 4A 4C 3B 3C B0 13 FE C3
    B2 B0 10 00 1E 24 35 28 B0 13 1C C8 4A 4C 31 3C
    B0 13 BC C6 B2 B0 20 00 1E 24 03 28 B0 13 14 C8
    4A 4C 5A 43 26 3C F2 40 80 00 21 09 F2 40 80 00
    23 09 B0 13 A0 C2 1D 3C 4C 43 B0 13 CC AA 0A 12
    C1 4C 00 00 3A 41 15 3C 4C 43 B0 13 E8 C6 0C 93
    09 20 B2 B0 40 00 1E 24 0C 28 4C 43 B0 13 04 C5
    4A 4C 07 3C 4C 43 B0 13 60 B0 0A 12 C1 4C 00 00
    3A 41 4A 93 04 24 B1 C0 D0 00 0C 00 03 43 5A 17
    00 13 0A 12 F2 D0 10 00 2B 02 F2 D0 20 00 2B 02
    B2 D0 06 00 24 03 32 C2 03 43 B2 40 52 2D C0 01
    F2 40 15 00 E4 01 F2 40 14 00 E5 01 82 43 C0 01
    03 43 32 D2 D2 D3 C0 05 F2 D0 80 00 C0 05 F2 40
    C0 00 C1 05 0D 83 1C 20 3C 80 B0 04 32 24 3C 80
    B0 04 31 24 3C 80 60 09 30 24 1C 83 31 24 1C 83
    3F 24 3C 80 BE 12 B2 24 1C 83 B2 24 3C 80 7F 25
    27 25 3C 80 00 4B 27 25 3C 80 00 4B 27 25 34 3D
    1D 83 04 20 3C 80 00 C2 24 25 2E 3D 2D 83 04 20
    3C 80 00 84 20 25 28 3D 2D 82 04 20 3C 80 00 08
    1D 25 22 3D 3D 80 07 00 1F 21 3C 80 00 10 19 25
    1B 3D 5A 43 1A 3D 6A 43 18 3D 7A 40 03 00 15 3D
    32 C2 03 43 B0 13 96 C5 3E 40 A0 86 1F 43 3E 53
    3F 63 0D 4E 0D DF 0D 93 FA 23 B0 13 00 10 05 3D
    D2 D3 02 02 B2 40 06 00 22 03 3E 40 E8 03 0F 43
    3E 53 3F 63 0D 4E 0D DF 0D 93 FA 23 3E 40 E8 03
    0F 43 3E 53 3F 63 0D 4E 0D DF 0D 93 FA 23 3E 40
    E8 03 0F 43 3E 53 3F 63 0D 4E 0D DF 0D 93 FA 23
    82 43 22 03 3E 40 E8 03 0F 43 3E 53 3F 63 0D 4E
    0D DF 0D 93 FA 23 A2 42 22 03 3E 40 E8 03 0F 43
    3E 53 3F 63 0D 4E 0D DF 0D 93 FA 23 82 43 22 03
    3E 40 E8 03 0F 43 3E 53 3F 63 0D 4E 0D DF 0D 93
    FA 23 A2 42 22 03 3E 40 E8 03 0F 43 3E 53 3F 63
    0D 4E 0D DF 0D 93 FA 23 82 43 22 03 3E 40 E8 03
    0F 43 3E 53 3F 63 0D 4E 0D DF 0D 93 FA 23 A2 43
    22 03 3E 40 E8 03 0F 43 3E 53 3F 63 0D 4E 0D DF
    0D 93 FA 23 3E 40 E8 03 0F 43 3E 53 3F 63 0D 4E
    0D DF 0D 93 FA 23 3E 40 E8 03 0F 43 3E 53 3F 63
    0D 4E 0D DF 0D 93 FA 23 6A 42 8F 3C 6A 42 8D 3C
    E2 D3 02 02 B2 40 0E 00 22 03 3E 40 E8 03 0F 43
    3E 53 3F 63 0D 4E 0D DF 0D 93 FA 23 3E 40 E8 03
    0F 43 3E 53 3F 63 0D 4E 0D DF 0D 93 FA 23 3E 40
    E8 03 0F 43 3E 53 3F 63 0D 4E 0D DF 0D 93 FA 23
    B2 42 22 03 3E 40 E8 03 0F 43 3E 53 3F 63 0D 4E
    0D DF 0D 93 FA 23 A2 42 22 03 3E 40 E8 03 0F 43
    3E 53 3F 63 0D 4E 0D DF 0D 93 FA 23 B2 42 22 03
    3E 40 E8 03 0F 43 3E 53 3F 63 0D 4E 0D DF 0D 93
    FA 23 A2 42 22 03 3E 40 E8 03 0F 43 3E 53 3F 63
    0D 4E 0D DF 0D 93 FA 23 B2 40 06 00 22 03 3E 40
    E8 03 0F 43 3E 53 3F 63 0D 4E 0D DF 0D 93 FA 23
    B2 40 0A 00 22 03 3E 40 E8 03 0F 43 3E 53 3F 63
    0D 4E 0D DF 0D 93 FA 23 3E 40 E8 03 0F 43 3E 53
    3F 63 0D 4E 0D DF 0D 93 FA 23 3E 40 E8 03 0F 43
    3E 53 3F 63 0D 4E 0D DF 0D 93 FA 23 6A 42 15 3C
    7A 40 05 00 12 3C 7A 40 06 00 0F 3C 7A 40 07 00
    0C 3C 7A 42 0A 3C 7A 40 09 00 07 3C 7A 40 0A 00
    04 3C 7A 40 0B 00 01 3C 4A 43 4A 93 15 24 4A 4A
    0F 4A 41 18 0F 5A D2 4F F5 A1 C6 05 4A 4A 0F 4A
    41 18 0F 5A D2 4F F6 A1 C7 05 4A 4A 0F 4A 41 18
    0F 5A D2 4F F7 A1 C8 05 D2 C3 C0 05 D2 D3 DC 05
    4C 4A 3A 41 10 01 3B 15 4A 4E 4F 4A 5F 0E 5B 4F
    02 A0 0D 93 02 24 0C 93 03 20 7C 40 07 00 46 3D
    08 42 38 F2 32 C2 03 43 C2 93 87 26 03 20 D2 93
    88 26 03 24 02 D8 7C 42 39 3D 4F 4A 5F 0E 8F 93
    32 24 05 24 03 43 02 D8 7C 40 03 00 2F 3D 4F 4A
    5F 0E 8F 4D 36 24 4F 4A 5F 0E 8F 4D 38 24 4F 4A
    5F 0E 8F 4C 32 24 4F 4A 5F 0E CF 93 40 24 73 24
    4E 4A 4F 4A 5F 0E 1D 4F 3A 24 4F 4A 5F 0E 1C 4F
    34 24 B0 13 5E BB 4F 4A 5F 0E 8F 93 38 24 0F 20
    4F 4A 5F 0E 8F 43 32 24 B2 B0 00 01 1E 24 03 28
    4C 4A B0 13 D8 C7 02 D8 7C 40 05 00 FF 3C 4F 4A
    5F 0E 4E 4B 5E 0A 3E 50 8A 23 8F 9E 3A 24 10 20
    4F 4B 5F 0A 3F 50 8E 23 4E 4A 5E 0E 8E 4F 3A 24
    4F 4A 5F 0E 4E 4A 5E 0E 9E 4F 0A A0 34 24 0F 3C
    4F 4B 5F 0A 3F 50 8A 23 4E 4A 5E 0E 8E 4F 3A 24
    4F 4A 5F 0E 4E 4A 5E 0E 9E 4F 08 A0 34 24 4F 4A
    5F 0E 1F 4F 3A 24 6E 4F 4E 93 11 34 7E C0 80 00
    4F 4A 5F 0E CF 4E 40 24 4E 4A 4F 4A 5F 0E 1D 4F
    3A 24 4F 4A 5F 0E 1C 4F 34 24 B0 13 5E BB 4F 4A
    5F 0E 8F 93 38 24 0F 20 4F 4A 5F 0E 8F 43 32 24
    B2 B0 00 01 1E 24 03 28 4C 4A B0 13 D8 C7 02 D8
    7C 40 05 00 AB 3C 4E 43 4F 4A 5F 0E CF 93 41 24
    25 20 4F 4B 5F 0A CF 93 8A 23 44 34 4F 4A 5F 0E
    4E 4A 5E 0E 9E 4F 08 A0 34 24 4F 4B 5F 0A 3F 50
    8A 23 4E 4A 5E 0E 8E 4F 3A 24 4F 4A 5F 0E 4E 4A
    5E 0E 9E 4F 0A A0 3E 24 4B 4B 5B 0A 3B 50 8E 23
    4F 4A 5F 0E 8F 4B 3C 24 5E 43 24 3C 4F 4B 5F 0A
    CF 93 8E 23 1F 34 4F 4A 5F 0E 4E 4A 5E 0E 9E 4F
    0A A0 34 24 4F 4B 5F 0A 3F 50 8E 23 4E 4A 5E 0E
    8E 4F 3A 24 4F 4A 5F 0E 4E 4A 5E 0E 9E 4F 08 A0
    3E 24 4B 4B 5B 0A 3B 50 8A 23 4F 4A 5F 0E 8F 4B
    3C 24 5E 43 4E 93 44 24 4F 4A 5F 0E 1F 4F 3A 24
    6E 4F 05 3C 4F 4A 5F 0E 1F 4F 3A 24 6E 4F 4E 93
    F9 27 4E 93 35 34 7E C0 80 00 4F 4A 5F 0E CF 4E
    40 24 4E 4A 4F 4A 5F 0E 1D 4F 3A 24 4F 4A 5F 0E
    1C 4F 34 24 B0 13 5E BB 4F 4A 5F 0E 1F 4F 3C 24
    6E 4F 4F 4A 5F 0E 8F 93 38 24 1A 24 4E 93 18 34
    7E C0 80 00 4F 4A 5F 0E CF 4E 40 24 4E 4A 4F 4A
    5F 0E 1D 4F 3C 24 4F 4A 5F 0E 1C 4F 3E 24 B0 13
    5E BB 4F 4A 5F 0E 4B 4A 5B 0E 9B 4F 3C 24 3A 24
    4F 4A 5F 0E 8F 93 38 24 0F 20 4F 4A 5F 0E 8F 43
    32 24 B2 B0 00 01 1E 24 03 28 4C 4A B0 13 D8 C7
    02 D8 7C 40 05 00 02 3C 02 D8 6C 42 38 17 10 01
    5B 15 4A 4C 4B 43 4F 4A 5F 0E 56 4F 02 A0 4F 4A
    0F 5F 07 4F 5F 06 0F 57 8F 93 2A 24 49 20 4F 4A
    0F 5F 07 4F 5F 06 0F 57 CF 93 2F 24 3F 20 4F 4A
    0F 5F 07 4F 5F 06 0F 57 DF 43 2F 24 4F 4A 0F 5F
    07 4F 5F 06 0F 57 FF 90 40 00 30 24 21 20 4F 4A
    0F 5F 07 4F 5F 06 0F 57 CF 93 2E 24 05 20 46 46
    56 0A C6 43 CA 23 04 3C 46 46 56 0A C6 43 CE 23
    4F 4A 0F 5F 07 4F 5F 06 0F 57 5E 4F 2E 24 5E 53
    5E F3 4F 4A 0F 5F 07 4F 5F 06 0F 57 CF 4E 2E 24
    4F 4A 0F 5F 07 4F 5F 06 0F 57 8F 43 28 24 C2 93
    1E 24 04 34 4C 4A B0 13 C4 C7 4B 4C 4C 4B CC 3C
    4F 4A 0F 5F 07 4F 5F 06 0F 57 CF 43 2F 24 4F 4A
    0F 5F 07 4F 5F 06 0F 57 CF 93 2E 24 11 20 4F 4A
    5F 0E 1C 4F 0C A0 49 46 59 0A 39 50 CA 23 4F 4A
    5F 0E 17 4F 0E A0 46 46 56 0A 36 50 CE 23 10 3C
    4F 4A 5F 0E 1C 4F 0E A0 49 46 59 0A 39 50 CE 23
    4F 4A 5F 0E 17 4F 0C A0 46 46 56 0A 36 50 CA 23
    4F 4A 0F 5F 0E 4F 5F 06 0F 5E BF 90 41 00 2A 24
    03 28 78 40 40 00 07 3C 4F 4A 0F 5F 0E 4F 5F 06
    0F 5E 58 4F 2A 24 6E 49 4E 93 85 34 4E 48 4F 4A
    0F 5F 0D 4F 5F 06 0F 5D 1D 4F 2C 24 80 13 04 24
    C9 48 00 00 4F 4A 0F 5F 0E 4F 5F 06 0F 5E 5E 4F
    2E 24 5E 53 5E F3 4F 4A 0F 5F 0D 4F 5F 06 0F 5D
    CF 4E 2E 24 4F 4A 0F 5F 0E 4F 5F 06 0F 5E 48 48
    8F 88 2A 24 4F 4A 0F 5F 0E 4F 5F 06 0F 5E 48 48
    8F 58 2C 24 4F 4A 0F 5F 0E 4F 5F 06 0F 5E CF 48
    30 24 6E 46 4F 4A 0F 5F 0D 4F 5F 06 0F 5D 8F 93
    2A 24 49 24 4E 93 47 34 4F 4A 0F 5F 0E 4F 5F 06
    0F 5E BF 90 41 00 2A 24 03 28 78 40 40 00 07 3C
    4F 4A 0F 5F 0E 4F 5F 06 0F 5E 58 4F 2A 24 4E 48
    4F 4A 0F 5F 0D 4F 5F 06 0F 5D 1D 4F 2C 24 0C 47
    80 13 04 24 C6 48 00 00 4F 4A 0F 5F 07 4F 5F 06
    0F 57 5E 4F 2E 24 5E 53 5E F3 4F 4A 0F 5F 07 4F
    5F 06 0F 57 CF 4E 2E 24 4F 4A 0F 5F 07 4F 5F 06
    0F 57 48 48 8F 88 2A 24 4F 4A 0F 5F 07 4F 5F 06
    0F 57 48 48 8F 58 2C 24 4A 4A 0A 5A 0F 4A 5A 06
    0A 5F CA 48 30 24 4C 4B 56 17 10 01 3B 15 21 82
    0B 43 0A 43 18 43 B0 13 74 C5 B0 13 DE C4 3E 40
    C0 C6 3F 40 2D 00 3E 53 3F 63 0D 4E 0D DF 0D 93
    FA 23 B0 13 18 C6 D2 E3 02 02 E2 E3 02 02 3F 40
    CE 12 3E 40 13 00 3F 53 3E 63 FD 2F D2 E3 02 02
    E2 E3 02 02 3F 40 CE 12 3E 40 13 00 3F 53 3E 63
    FD 2F D2 E3 02 02 E2 E3 02 02 3F 40 CE 12 3E 40
    13 00 3F 53 3E 63 FD 2F D2 E3 02 02 E2 E3 02 02
    3F 40 CE 12 3E 40 13 00 3F 53 3E 63 FD 2F 03 43
    32 D2 01 3C 03 43 C2 93 00 24 2D 20 B0 13 C8 BA
    7C 80 80 00 F7 27 5C 83 F6 27 5C 83 F4 27 5C 83
    07 24 5C 83 1A 24 6C 83 1C 24 5C 83 18 24 EB 3F
    0E 41 0D 41 2D 53 4C 43 B0 13 34 B8 6C B2 E3 2B
    4E 43 1D 43 3C 40 45 25 B0 13 22 A8 D2 B3 CA 05
    FD 2F D2 42 45 25 CE 05 D6 3F 03 43 D4 3F 03 43
    D2 3F 03 43 D0 3F D2 93 00 24 CD 23 B0 13 C8 BA
    7C 80 80 00 0D 24 5C 83 C6 27 5C 83 C4 27 5C 83
    09 24 5C 83 54 24 6C 83 56 24 5C 83 52 24 BB 3F
    03 43 B9 3F 0E 41 0D 41 2D 53 4C 43 B0 13 34 B8
    6C B2 05 28 3C 40 45 25 B0 13 9E B6 4A 4C 0A 93
    31 24 1A 93 0E 20 3C 40 45 25 B0 13 30 BA 0B 4C
    08 93 02 38 0B 93 26 34 1B 43 F2 40 55 00 45 25
    21 3C 0D 4A 3C 40 45 25 B0 13 88 BF 08 4C B0 13
    02 C8 00 3C 3F 40 03 0D 3F 53 FE 2F 08 93 02 20
    0B 43 07 3C 18 93 05 38 3C 40 45 25 B0 13 30 BA
    0B 4C 08 93 02 38 0B 93 04 34 1B 43 F2 40 55 00
    45 25 0A 43 1B 93 77 3B C2 43 71 26 4E 43 0D 4B
    3C 40 45 25 B0 13 F4 BB 0B 43 03 43 6C 3F 03 43
    6A 3F 03 43 68 3F 03 43 66 3F 03 43 0A 12 B2 40
    28 96 00 09 C2 43 88 26 C2 43 87 26 C2 43 89 26
    C2 43 73 26 C2 43 74 26 C2 43 3C 09 B2 43 16 24
    B2 43 18 24 C2 43 86 26 C2 43 3F 09 F2 40 80 00
    21 09 F2 40 80 00 23 09 F2 40 8C 00 20 09 F2 40
    8C 00 22 09 F2 40 05 00 2F 09 F2 40 07 00 2E 09
    0D 43 86 3C 0F 4D 5F 0E 5E 4F 02 A0 4F 4E 5F 0A
    FF 40 94 00 C8 23 0F 4D 5F 0E 1F 4F 0C A0 3F 50
    00 E4 5F 0B 4C 4E 5C 0A CC 4F C9 23 0F 4D 5F 0E
    1F 4F 0E A0 3F 50 00 E4 5F 0B 4A 4E 5A 0A CA 4F
    CD 23 4F 4E 5F 0A FF 40 80 00 CA 23 4F 4E 5F 0A
    FF 40 80 00 CE 23 4F 4E 5F 0A FF 40 40 00 CF 23
    4F 4E 5F 0A FF 40 94 00 88 23 0F 4D 5F 0E 1F 4F
    08 A0 3F 50 00 E4 5F 0B 4A 4E 5A 0A CA 4F 89 23
    0F 4D 5F 0E 1F 4F 0A A0 3F 50 00 E4 5F 0B 4A 4E
    5A 0A CA 4F 8D 23 4F 4E 5F 0A CF 43 8A 23 4F 4E
    5F 0A CF 43 8E 23 4F 4E 5F 0A FF 40 40 00 8F 23
    0F 4D 5F 0E EF 93 03 A0 2A 20 4F 4E 5F 0A FF 40
    94 00 C0 23 0F 4D 5F 0E 1F 4F 04 A0 3F 50 00 E4
    5F 0B 4A 4E 5A 0A CA 4F C1 23 0F 4D 5F 0E 1F 4F
    06 A0 3F 50 00 E4 5F 0B 4A 4E 5A 0A CA 4F C5 23
    4F 4E 5F 0A FF 40 80 00 C2 23 4F 4E 5F 0A FF 40
    80 00 C6 23 4E 4E 5E 0A FE 40 40 00 C7 23 1D 53
    1D 93 78 3B B0 13 38 C6 F2 40 40 00 3C 09 C2 43
    3E 09 F2 40 C4 00 3D 09 B2 40 00 96 00 09 4C 43
    3A 41 10 01 3B 15 4A 4C 4B 43 4F 4A 5F 0E 5E 4F
    02 A0 4F 4A 5F 0E 8F 93 38 24 06 20 4A 4A 5A 0E
    8A 43 32 24 4C 4B A0 3C 4F 4E 5F 0A 4D 4E 5D 0A
    5D 4D 8A 23 5D DF 8E 23 7D B0 80 00 02 20 4C 4B
    93 3C 4F 4A 5F 0E CF 93 41 24 1C 20 4F 4A 5F 0E
    1C 4F 08 A0 4F 4E 5F 0A 3F 50 8A 23 4D 4A 5D 0E
    8D 4F 3A 24 4F 4A 5F 0E 4D 4A 5D 0E 9D 4F 0A A0
    3E 24 4E 4E 5E 0A 3E 50 8E 23 4F 4A 5F 0E 8F 4E
    3C 24 1B 3C 4F 4A 5F 0E 1C 4F 0A A0 4F 4E 5F 0A
    3F 50 8E 23 4D 4A 5D 0E 8D 4F 3A 24 4F 4A 5F 0E
    4D 4A 5D 0E 9D 4F 08 A0 3E 24 4E 4E 5E 0A 3E 50
    8A 23 4F 4A 5F 0E 8F 4E 3C 24 4F 4A 5F 0E 1F 4F
    3A 24 6E 4F 4E 93 31 34 7E C0 80 00 4F 4A 5F 0E
    CF 4E 40 24 4E 4A 4F 4A 5F 0E 1D 4F 3A 24 B0 13
    5E BB 4F 4A 5F 0E 1F 4F 3C 24 6E 4F 4F 4A 5F 0E
    8F 93 38 24 1A 24 4E 93 18 34 7E C0 80 00 4F 4A
    5F 0E CF 4E 40 24 4E 4A 4F 4A 5F 0E 1D 4F 3C 24
    4F 4A 5F 0E 1C 4F 3E 24 B0 13 5E BB 4F 4A 5F 0E
    4E 4A 5E 0E 9E 4F 3C 24 3A 24 4F 4A 5F 0E 8F 93
    38 24 19 20 4F 4A 5F 0E 8F 43 32 24 B2 B0 00 01
    1E 24 04 28 4C 4A B0 13 D8 C7 4B 4C 4F 4A 5F 0E
    CF 93 40 24 08 24 B2 B0 40 00 1E 24 04 28 4C 4A
    B0 13 04 C5 4B 4C 4C 4B 38 17 10 01 0E 4C 0F 4D
    0F 83 1C 20 3E 80 B0 04 40 24 3E 80 B0 04 41 24
    3E 80 60 09 42 24 1E 83 44 24 1E 83 46 24 3E 80
    BE 12 47 24 1E 83 49 24 3E 80 7F 25 4A 24 3E 80
    00 4B 4B 24 3E 80 00 4B 4C 24 7F 3C 1F 83 09 20
    3E 80 A0 86 5A 24 1E 83 60 24 3E 80 5F 3B 45 24
    74 3C 2F 83 04 20 3E 80 00 84 43 24 6E 3C 3F 80
    03 00 06 20 3E 80 80 1A 58 24 1E 83 5E 24 65 3C
    1F 83 04 20 3E 80 00 08 38 24 5F 3C 3F 80 07 00
    5C 20 3E 80 00 10 35 24 58 3C C2 43 00 24 80 00
    FE A4 C2 43 00 24 80 00 FE A4 C2 43 00 24 80 00
    FE A4 C2 43 00 24 80 00 FE A4 C2 43 00 24 80 00
    FE A4 C2 43 00 24 80 00 FE A4 C2 43 00 24 80 00
    FE A4 C2 43 00 24 80 00 FE A4 C2 43 00 24 80 00
    FE A4 C2 43 00 24 80 00 FE A4 C2 43 00 24 80 00
    FE A4 C2 43 00 24 80 00 FE A4 C2 43 00 24 80 00
    FE A4 C2 43 00 24 80 00 FE A4 D2 43 00 24 0E 4C
    0F 4D 7C 40 48 00 80 00 E2 B4 D2 43 00 24 0E 4C
    0F 4D 7C 40 48 00 80 00 E2 B4 D2 43 00 24 0E 4C
    0F 4D 7C 40 48 00 80 00 E2 B4 D2 43 00 24 0E 4C
    0F 4D 7C 40 48 00 80 00 E2 B4 4C 43 10 01 B2 D0
    06 00 24 03 3E 40 E8 03 0F 43 3E 53 3F 63 0D 4E
    0D DF 0D 93 FA 23 B2 40 0E 00 22 03 3E 40 E8 03
    0F 43 3E 53 3F 63 0D 4E 0D DF 0D 93 FA 23 3E 40
    E8 03 0F 43 3E 53 3F 63 0D 4E 0D DF 0D 93 FA 23
    A2 42 22 03 3E 40 E8 03 0F 43 3E 53 3F 63 0D 4E
    0D DF 0D 93 FA 23 3E 40 E8 03 0F 43 3E 53 3F 63
    0D 4E 0D DF 0D 93 FA 23 B2 40 06 00 22 03 3E 40
    E8 03 0F 43 3E 53 3F 63 0D 4E 0D DF 0D 93 FA 23
    3E 40 E8 03 0F 43 3E 53 3F 63 0D 4E 0D DF 0D 93
    FA 23 3E 40 E8 03 0F 43 3E 53 3F 63 0D 4E 0D DF
    0D 93 FA 23 3E 40 E8 03 0F 43 3E 53 3F 63 0D 4E
    0D DF 0D 93 FA 23 A2 43 22 03 3E 40 E8 03 0F 43
    3E 53 3F 63 0D 4E 0D DF 0D 93 FA 23 3E 40 E8 03
    0F 43 3E 53 3F 63 0D 4E 0D DF 0D 93 FA 23 3E 40
    E8 03 0F 43 3E 53 3F 63 0D 4E 0D DF 0D 93 FA 23
    10 01 0A 12 0E 43 0A 42 3A F0 40 00 32 C0 40 00
    3F 40 00 10 3C 90 81 3E 03 28 5D 03 1E 43 05 3C
    0C 5C 03 3C 3F 50 00 10 5D 03 3D 90 01 02 FA 2F
    82 43 60 01 B2 F0 00 FC 64 01 3D 53 0F DD 82 4F
    64 01 3C 90 77 02 03 2C 82 43 62 01 33 3C 3C 90
    E2 04 04 2C B2 40 10 00 62 01 2C 3C 3C 90 C4 09
    04 2C B2 40 20 00 62 01 25 3C 3C 90 88 13 04 2C
    B2 40 30 00 62 01 1E 3C 3C 90 10 27 04 2C B2 40
    40 00 62 01 17 3C 3C 90 20 4E 04 2C B2 40 50 00
    62 01 10 3C 3C 90 40 9C 04 2C B2 40 60 00 62 01
    09 3C B2 40 70 00 62 01 05 3C B2 F0 F4 FF 6E 01
    A2 C3 02 01 A2 B3 02 01 F8 2F 1E 93 09 20 1F 42
    68 01 3F F0 88 FF 3F D0 33 00 82 4F 68 01 08 3C
    1F 42 68 01 3F F0 88 FF 3F D0 44 00 82 4F 68 01
    02 DA 3A 41 10 01 1B 15 4B 4C 5A 43 32 C2 03 43
    B2 40 52 2D C0 01 F2 40 17 00 E4 01 F2 40 18 00
    E5 01 82 43 C0 01 03 43 32 D2 D2 43 E0 05 F2 40
    0F 00 E1 05 F2 40 81 00 E0 05 1F 83 06 20 3E 80
    A0 86 17 24 1E 83 0A 24 2B 3C 3F 80 05 00 28 20
    3E 80 80 1A 1F 24 1E 83 12 24 22 3C F2 E0 03 00
    02 02 B0 13 0A B3 D2 D3 02 02 F2 40 C8 00 E6 05
    18 3C D2 D3 02 02 F2 40 C8 00 E6 05 12 3C F2 E0
    03 00 02 02 B0 13 0A B3 E2 D3 02 02 F2 40 32 00
    E6 05 07 3C E2 D3 02 02 F2 40 32 00 E6 05 01 3C
    5A 43 C2 43 E7 05 4B 4B 82 4B F2 05 F2 D0 30 00
    2B 02 D2 C3 E0 05 B2 40 43 24 10 24 F2 B0 10 00
    EA 05 0C 28 F2 C0 10 00 2B 02 F2 C0 10 00 23 02
    F2 D0 10 00 25 02 F2 D0 30 00 2B 02 C2 43 44 25
    4C 4A 1A 17 10 01 1B 15 F2 40 A5 00 21 01 1E 42
    2E 01 B2 F0 88 CC 2E 01 1D 42 24 01 1A 42 26 01
    82 43 2C 01 4F 4C 3F D0 00 44 82 4F 24 01 B2 B0
    10 00 2C 01 FC 2B B2 C0 10 00 2C 01 B2 B0 20 00
    2C 01 12 28 B2 C0 10 00 2C 01 82 4D 24 01 B2 B0
    10 00 2C 01 FC 2B B2 F0 88 FF 2C 01 82 4E 2E 01
    C2 43 21 01 1C 43 3B 3C 4F 4C 3F F0 FF 00 8F 10
    82 DF 24 01 B2 B0 10 00 2C 01 FC 2B B2 C0 10 00
    2C 01 C2 4C 20 01 4F 4C 4C 4C 3C F0 FF 00 8C 10
    0F DC 3F D0 00 44 82 4F 26 01 92 B3 2C 01 FD 2B
    92 C3 2C 01 B2 F0 07 03 26 01 3A F0 F8 FC 82 DA
    26 01 B2 F0 07 03 24 01 3D F0 F8 FC 82 DD 24 01
    92 B3 2C 01 04 2C B2 B0 10 00 2C 01 F9 2B B2 F0
    88 FF 2C 01 82 4E 2E 01 C2 43 21 01 0C 43 1A 17
    10 01 0A 12 0A 4C 0C 43 5E 42 42 24 4E 83 07 24
    5E 83 1C 24 6E 83 36 24 6E 83 4C 24 55 3C 4E 43
    1D 43 0C 4A B0 13 22 A8 FA 90 80 00 00 00 05 20
    82 43 02 24 D2 43 42 24 07 3C FA 90 A0 00 00 00
    03 20 F2 40 05 00 42 24 0C 43 41 3C C2 43 72 26
    4E 43 2D 43 0C 4A 1C 53 B0 13 22 A8 C2 93 72 26
    FD 27 5E 4A 01 00 4E 4E 5F 4A 02 00 4F 4F 3F F0
    FF 00 8F 10 0F DE 82 4F 02 24 F2 40 03 00 42 24
    0C 43 25 3C C2 43 72 26 4E 43 1D 42 02 24 2D 53
    3A 50 03 00 0C 4A B0 13 22 A8 C2 93 72 26 FD 27
    4C 43 B0 13 24 BE C2 43 42 24 1C 42 02 24 3C 50
    05 00 0D 3C 4E 43 1D 43 0C 4A B0 13 22 A8 6C 4A
    4C 4C C2 43 42 24 03 3C C2 43 42 24 0C 43 3A 41
    10 01 0A 12 21 82 5A 43 81 43 00 00 4A 4A FA 40
    03 00 8B 26 5A 53 0F 41 0E 41 2E 53 4D 43 7C 42
    B0 13 E0 C0 C1 93 02 00 0B 20 E2 42 8B 26 4A 4A
    CA 43 8B 26 5A 53 4A 4A CA 43 8B 26 5A 53 41 3C
    4E 43 0F 3C 7F 50 37 00 4A 4A CA 4F 8B 26 5A 53
    4A 4A CA 43 8B 26 5A 53 5E 53 2F 41 1F 53 81 4F
    00 00 5E 91 02 00 28 2C 7E 92 26 2C 2F 41 6F 4F
    43 19 4F 10 7F 90 0A 00 07 2C 7F 50 30 00 4A 4A
    CA 4F 8B 26 5A 53 06 3C 7F 50 37 00 4A 4A CA 4F
    8B 26 5A 53 4A 4A CA 43 8B 26 5A 53 2F 41 6F 4F
    7F F0 0F 00 7F 90 0A 00 CD 2F 7F 50 30 00 4A 4A
    CA 4F 8B 26 5A 53 CC 3F 41 18 4E 5E 6E 53 C2 4E
    8B 26 21 52 3A 41 10 01 5B 15 0A 4E 4F 43 8D 43
    00 00 8A 43 00 00 4B 4C 5B 0E 5E 4B 02 A0 0B 42
    3B F2 32 C2 03 43 48 4C 08 58 09 48 58 06 08 59
    88 93 2A 24 11 24 5F D3 48 4C 08 58 09 48 58 06
    08 59 18 48 28 24 49 4C 09 59 06 49 59 06 09 56
    18 89 2A 24 8D 48 00 00 4D 4C 5D 0E 8D 93 32 24
    0C 24 6F D3 4E 4C 5E 0E 1E 4E 36 24 4C 4C 5C 0E
    1E 8C 38 24 8A 4E 00 00 13 3C C2 93 87 26 10 20
    4D 4E 5D 0A 5D 4D 8E 23 7D F0 80 00 4E 4E 5E 0A
    5E 4E 8A 23 7E F0 80 00 4E DD 4E 93 01 24 6F D2
    C2 93 87 26 03 20 D2 93 88 26 01 24 7F 42 02 DB
    03 43 4C 4F 56 17 10 01 3B 15 4A 43 3B 40 80 23
    3C 40 10 A0 02 3C 3C 50 06 00 6E 4C 1C 53 6F 4C
    1C 53 7E 93 02 20 7F 93 08 24 F2 90 C0 00 80 23
    04 24 F2 90 40 00 80 23 07 20 3C 50 FE FF D2 B3
    3E 09 24 28 4C 4A 35 3C 5E 92 80 23 1C 20 5F 92
    81 23 19 20 7D 40 C0 00 7E 40 20 00 6F 43 0B 3C
    4F 4F 08 4B 08 5F E8 9C 00 00 01 20 4D DE 1C 53
    40 19 4E 10 5F 53 7F 92 F3 2B 6D FC 6D 9C CB 23
    3C 50 F8 FF DC 3F 3C 50 0C 00 C7 3F 18 4C 0A 00
    19 4C 0C 00 B0 13 30 C8 38 90 54 C6 09 20 39 90
    00 00 06 20 C2 93 3F 09 03 24 B0 13 18 C8 4A 4C
    4C 4A 38 17 10 01 3B 15 F2 40 A5 00 21 01 1F 42
    2E 01 B2 F0 88 CC 2E 01 1E 42 24 01 1D 42 26 01
    B2 F0 CC FF 2C 01 4A 4C 4B 4C 3B F0 FF 00 8B 10
    0A DB 3A D0 00 44 82 4A 24 01 4B 4C 4A 4C 3A F0
    FF 00 8A 10 0B DA 3B D0 00 44 82 4B 26 01 B2 B0
    10 00 2C 01 FC 2B 92 B3 2C 01 F9 2B B2 F0 EE FF
    2C 01 C2 4C 20 01 B2 F0 07 03 26 01 3D F0 F8 FC
    82 DD 26 01 B2 F0 07 03 24 01 3E F0 F8 FC 82 DE
    24 01 92 B3 2C 01 04 2C B2 B0 10 00 2C 01 F9 2B
    B2 F0 88 FF 2C 01 82 4F 2E 01 C2 43 21 01 0C 43
    38 17 10 01 0A 12 F2 C0 10 00 E0 05 D2 D3 FC 05
    82 4C 10 24 92 43 12 24 C2 43 43 25 D2 43 44 25
    E2 D3 E0 05 3C 40 40 42 3D 40 0F 00 D2 93 44 25
    0A 20 0E 4C 0F 4D 0C 4E 0D 4F 3C 53 3D 63 0A 4E
    0A DF 0A 93 F3 23 0F 4C 0F DD 0F 93 04 24 F2 90
    05 00 44 25 13 20 B0 13 02 C8 3C 40 40 42 3D 40
    0F 00 E2 B2 E0 05 0A 28 0E 4C 0F 4D 0C 4E 0D 4F
    3C 53 3D 63 0A 4E 0A DF 0A 93 F3 23 E2 93 44 25
    0A 20 82 93 14 24 05 24 1C 42 14 24 3C 50 06 00
    03 3C 2C 42 01 3C 3C 43 3A 41 10 01 B2 B2 08 09
    03 2C 7C 40 80 00 10 01 B2 B2 08 09 06 28 A2 B3
    02 09 03 2C 7C 40 81 00 10 01 B2 B2 08 09 0C 28
    A2 B3 02 09 09 28 D2 93 88 26 06 20 D2 93 87 26
    03 24 7C 40 83 00 10 01 B2 B2 08 09 0C 28 A2 B3
    02 09 09 28 D2 93 88 26 06 24 D2 93 87 26 03 20
    7C 40 87 00 10 01 B2 B2 08 09 0C 28 A2 B3 02 09
    09 28 D2 93 88 26 06 20 D2 93 87 26 03 20 7C 40
    84 00 10 01 B2 B2 08 09 09 28 A2 B3 02 09 06 28
    D2 93 88 26 03 24 7C 40 82 00 10 01 7C 40 86 00
    10 01 3B 15 08 4C 09 4D 4A 4E 4F 4A 5F 0E 5F 4F
    40 24 4F 4F 4B 4A 5B 0E 1F 9B 38 24 05 2C 4F 4A
    5F 0E 5B 4F 40 24 04 3C 4F 4A 5F 0E 5B 4F 38 24
    4E 4B 0D 48 4F 4A 5F 0E 1C 4F 32 24 80 13 08 24
    4F 4A 5F 0E 4B 4B 8F 8B 38 24 4F 4A 5F 0E 4B 4B
    8F 5B 32 24 4F 4A 5F 0E 5B 9F 40 24 11 20 4F 4A
    5F 0E 5E 4F 41 24 5E 53 5E F3 4F 4A 5F 0E CF 4E
    41 24 4A 4A 5A 0E CA 43 40 24 C9 43 00 00 0A 3C
    4F 4A 5F 0E CF 8B 40 24 4B 4B 08 5B 4A 4A 5A 0E
    8A 48 34 24 38 17 10 01 3B 15 4F 4E 5F 0E 5A 4F
    02 A0 0D 93 03 20 7C 40 07 00 3B 3C 0F 42 3F F2
    32 C2 03 43 C2 93 87 26 03 20 D2 93 88 26 03 24
    02 DF 7C 42 2E 3C 4B 4E 0B 5B 08 4B 5B 06 0B 58
    8B 93 2A 24 05 24 03 43 02 DF 7C 40 03 00 21 3C
    4B 4E 0B 5B 08 4B 5B 06 0B 58 8B 4D 28 24 4B 4E
    0B 5B 08 4B 5B 06 0B 58 8B 4D 2A 24 4E 4E 0E 5E
    0B 4E 5E 06 0E 5B 8E 4C 2C 24 1E 43 5A 53 5A 83
    02 30 CA 18 0E 5E 5A 53 C2 DE 30 09 03 43 02 DF
    5C 43 38 17 10 01 1B 15 4F 43 4E 4C 5E 0E 5E 4E
    02 A0 0D 42 3D F2 32 C2 03 43 C2 93 87 26 03 20
    D2 93 88 26 03 24 02 DD 4C 43 32 3C 4A 4C 5A 0E
    CA 93 40 24 14 24 4F 4C 5F 0E 5F 4F 40 24 4B 4C
    5B 0E 1B 4B 3C 24 CB 93 00 00 20 34 4C 4C 5C 0E
    1B 4C 3C 24 6E 4B 7E F0 7F 00 4F 5E 17 3C 4B 4E
    5B 0A CB 93 8A 23 06 34 4F 4E 5F 0A 5F 4F 8A 23
    7F F0 7F 00 4B 4E 5B 0A CB 93 8E 23 07 34 4E 4E
    5E 0A 5E 4E 8E 23 7E F0 7F 00 4F 5E 02 DD 4C 4F
    1A 17 10 01 5F 42 84 23 7F F0 0F 00 4F 93 1C 20
    C2 93 84 23 06 34 5E 42 20 09 7E F2 C2 4E 76 26
    05 3C 5E 42 22 09 7E F2 C2 4E 76 26 5E 42 76 26
    42 19 4E 10 C2 4E 76 26 B0 13 0E C8 A2 43 16 24
    3C 40 76 26 80 00 D8 C5 7F 53 7F 90 07 00 12 2C
    C2 93 84 23 08 34 4F 4F 5F 0A 5E 4F C8 23 7E F2
    C2 4E 76 26 07 3C 4F 4F 5F 0A 5E 4F 88 23 7E F2
    C2 4E 76 26 5E 42 76 26 42 19 4E 10 C2 4E 76 26
    B0 13 0E C8 A2 43 16 24 3C 40 76 26 80 00 D8 C5
    21 82 81 43 02 00 B2 B2 08 09 02 2C 5C 43 3A 3C
    92 B3 02 09 06 28 B2 B0 00 01 10 09 02 28 4C 43
    31 3C B2 40 28 96 00 09 3C 40 00 C0 B0 13 30 C4
    B2 40 17 01 12 09 B2 40 00 03 10 09 82 43 14 09
    81 43 00 00 04 3C 2F 41 1F 53 81 4F 00 00 B1 90
    E8 03 00 00 F8 2B 1F 41 02 00 0E 4F 1E 53 81 4E
    02 00 3F 90 0B 00 05 28 B2 40 00 96 00 09 5C 43
    09 3C 82 93 14 09 E2 23 92 D3 02 09 B2 40 00 96
    00 09 4C 43 21 52 10 01 1B 15 4F 4C 5F 0E 5E 4F
    02 A0 0F 42 3F F2 32 C2 03 43 C2 93 87 26 04 24
    03 43 02 DF 7C 42 2C 3C 4D 4C 5D 0E 8D 93 32 24
    25 20 4D 4E 5D 0A 5D 4D 8A 23 7D F0 80 00 4A 4E
    5A 0A 5A 4A 8E 23 7A F0 80 00 4D EA 4D 93 0A 24
    4B 4C 5B 0E 5D 4B 41 24 5D 53 5D F3 4B 4C 5B 0E
    CB 4D 41 24 4B 4E 5B 0A CB 43 8A 23 4E 4E 5E 0A
    CE 43 8E 23 4C 4C 5C 0E CC 43 40 24 02 DF 4C 43
    1A 17 10 01 3B 15 58 42 7E 26 48 48 5A 42 7F 26
    4A 4A 0B 43 4B EA 0B EA 8B 10 3A F0 FF 00 8A 10
    5C 42 80 26 4C 4C 0D 43 0D 4C 0C 43 5E 42 81 26
    4E 4E 0F 43 3E F0 FF 00 8E 10 0F 4E 0E 43 0E DC
    0F DD 0E DA 0F DB 0E D8 82 4E 20 24 82 4F 22 24
    D2 42 82 26 25 24 D2 42 83 26 26 24 D2 42 84 26
    24 24 1C 42 20 24 1D 42 22 24 B0 13 C8 B1 4C 93
    04 20 82 43 20 24 82 43 22 24 38 17 10 01 B2 93
    16 24 31 24 B2 90 09 00 16 24 07 28 7E 42 B2 50
    F8 FF 16 24 D2 43 86 26 17 3C B2 92 16 24 07 2C
    5E 42 16 24 B2 43 16 24 C2 43 86 26 0D 3C 7E 42
    D2 93 75 26 05 20 82 43 16 24 D2 43 86 26 04 3C
    B2 43 16 24 C2 43 86 26 4F 43 08 3C 1D 42 1A 24
    4F 4F EF 4D 78 23 92 53 1A 24 5F 53 4F 9E F6 2B
    C2 4E 21 09 10 01 C2 43 86 26 10 01 D2 C3 FC 05
    F2 F0 D5 00 FD 05 F2 D0 22 00 FC 05 82 4C 0C 24
    82 4D 0E 24 F2 40 03 00 44 25 F2 D0 12 00 E0 05
    F2 90 03 00 44 25 FC 27 E2 92 44 25 0C 20 82 4C
    0C 24 1F 42 0C 24 FF 90 1B 00 03 00 02 20 0C 43
    10 01 1C 43 10 01 F2 90 05 00 44 25 02 20 3C 43
    10 01 3C 43 10 01 0A 12 21 83 0A 42 3A F2 32 C2
    03 43 B2 40 28 96 00 09 B2 40 80 00 04 09 B2 40
    40 08 08 09 81 43 00 00 04 3C 2F 41 1F 53 81 4F
    00 00 B1 90 A0 0F 00 00 F8 2B B2 40 40 0A 08 09
    B2 40 00 96 00 09 82 43 1E 24 B0 13 6E B7 B0 13
    CC C1 03 43 02 DA 4C 43 21 53 3A 41 10 01 5E 42
    23 09 7E F0 7F 00 4E 4E 82 9E 18 24 1D 28 4F 43
    09 3C 4F 4F 1D 42 1C 24 DD 4F 70 23 00 00 92 53
    1C 24 5F 53 4F 9E F5 2B 4E 4E 82 8E 18 24 82 93
    18 24 05 24 B0 13 0E C8 E2 43 86 26 10 01 B0 13
    08 C8 C2 43 86 26 10 01 B0 13 08 C8 C2 43 86 26
    10 01 F2 D0 10 00 3C 09 C2 43 21 09 E2 93 86 26
    1E 20 B0 13 3A C0 C2 93 86 26 1B 20 F2 90 20 00
    81 23 17 20 1F 42 84 23 0F 83 0B 24 1F 83 09 24
    1F 83 09 24 1F 83 07 24 1F 83 07 24 1F 83 05 24
    10 01 80 00 A0 BE 80 00 40 C8 80 00 42 C8 F2 D2
    22 09 10 01 1B 15 3B 40 08 1A 09 3C CB 9C 00 00
    01 20 7D 53 5A 4B 01 00 4A 4A 0B 5A 2B 53 3B 90
    FF 1A 08 2C CB 9C 00 00 02 20 4D 93 03 24 FB 93
    00 00 EC 23 CB 9C 00 00 07 20 DE 4B 01 00 00 00
    2B 53 8F 4B 00 00 04 3C CE 43 00 00 8F 43 00 00
    1A 17 10 01 0A 12 5A 42 82 23 B0 13 0E C8 7A 90
    03 00 0A 20 5F 42 8B 26 4F 4F 82 4F 16 24 3C 40
    8B 26 B0 13 D8 C5 14 3C 0C 43 04 3C 5F 4C 6F A1
    4F 4F 0C 5F 4E 4A 4A 4E 7A 53 4E 93 F7 23 5F 4C
    6F A1 4F 4F 82 4F 16 24 3C 50 6F A1 B0 13 D8 C5
    3A 41 10 01 1B 15 4B 4C 0C 43 7B F0 03 00 1A 42
    20 01 3A F0 03 00 07 3C 1A 53 0C 12 C1 4A 00 00
    3C 41 B0 13 C2 B5 4B 4B 0B 9A 02 24 0C 93 03 24
    4B 4B 0B 9A 0B 2C 4B 4B 0A 9B EE 2B 3A 53 0C 12
    C1 4A 00 00 3C 41 B0 13 92 B9 ED 3F 1A 17 10 01
    B2 40 50 C5 04 24 B2 40 00 00 06 24 B2 40 50 C5
    08 24 B2 40 00 00 0A 24 B2 F0 E0 FF 00 05 92 42
    00 05 00 05 B2 40 C0 1F 10 05 92 D3 08 05 B2 40
    8E C4 04 24 B2 40 00 00 06 24 B2 40 8E C4 08 24
    B2 40 00 00 0A 24 10 01 21 83 81 43 00 00 04 3C
    2F 41 1F 53 81 4F 00 00 B1 90 D0 07 00 00 F8 2B
    B2 B2 08 09 12 2C B2 40 28 96 00 09 C2 43 88 26
    C2 43 87 26 82 43 02 09 B2 C0 00 01 10 09 B2 F0
    FB EB 08 09 B2 40 00 96 00 09 21 53 10 01 D2 42
    24 24 7C 26 D2 42 26 24 7B 26 D2 42 25 24 7A 26
    1E 42 20 24 1F 42 22 24 8F 10 4E 4F 0F 43 C2 4E
    79 26 1E 42 22 24 C2 4E 78 26 D2 42 21 24 77 26
    D2 42 20 24 76 26 B2 40 07 00 16 24 3C 40 76 26
    80 00 D8 C5 4C 43 F2 D0 10 00 3C 09 03 3C F2 F0
    FA 00 3E 09 C2 93 80 23 03 34 D2 D3 3C 09 02 3C
    D2 C3 3C 09 C2 43 86 26 4F 43 04 3C 4F 4F CF 43
    76 26 5F 53 7F 92 FA 2B B0 13 E4 B8 D2 B3 3E 09
    E6 2F 10 01 82 93 82 23 1A 20 5F 42 84 23 7F F0
    0F 00 4F 93 02 20 80 00 AA C7 7F 53 7F 90 07 00
    10 2C C2 93 84 23 05 34 4F 4F 5F 0A FF D2 C8 23
    04 3C 4F 4F 5F 0A FF D2 88 23 80 00 AA C7 B0 13
    CE C7 10 01 82 43 02 02 82 43 0A 02 B2 40 FF F0
    06 02 B2 40 00 0F 04 02 82 43 22 02 82 43 2A 02
    B2 43 26 02 82 43 42 02 82 43 4A 02 B2 43 46 02
    B2 40 F9 FF 24 03 82 43 22 03 F2 D0 03 00 04 02
    10 01 5F 42 84 23 7F F0 0F 00 4F 93 02 20 80 00
    AA C7 7F 53 7F 90 07 00 10 2C C2 93 84 23 06 34
    4F 4F 5F 0A FF F0 D7 00 C8 23 05 3C 4F 4F 5F 0A
    FF F0 D7 00 88 23 B0 13 AA C7 10 01 21 83 81 43
    00 00 04 3C 2F 41 1F 53 81 4F 00 00 B1 90 D0 07
    00 00 F8 2B B2 40 28 96 00 09 B2 D0 00 04 08 09
    B2 F0 F9 FF 08 09 B2 40 00 96 00 09 21 53 10 01
    F2 D0 0C 00 4A 02 1F 42 66 01 3F F0 8F FF 3F D0
    20 00 82 4F 66 01 1F 42 68 01 3F F0 FF F8 3F D0
    00 02 82 4F 68 01 3D 40 62 02 3C 40 20 4E 80 00
    FE B3 D2 43 87 26 B2 40 28 96 00 09 F2 D0 10 00
    3C 09 F2 C0 40 00 3E 09 B2 C0 00 01 10 09 B2 D0
    00 01 6C 01 F2 40 20 00 3D 09 B2 40 00 96 00 09
    4C 43 10 01 1F 42 6C 01 3F F0 00 C0 0F 9C 05 24
    B2 F0 FF 3F 6C 01 82 DC 6C 01 B2 C0 00 01 6C 01
    05 3C B2 F0 F4 FF 6E 01 A2 C3 02 01 A2 B3 02 01
    F8 2F 10 01 4C 43 B2 B2 08 09 01 28 5C D3 D2 93
    88 26 02 20 7C D0 20 00 A2 B3 02 09 02 28 7C D0
    40 00 D2 93 87 26 02 20 7C D2 10 01 7C D0 10 00
    10 01 0E 93 11 24 82 4C 16 05 82 4D 12 05 82 4E
    1A 05 B2 D0 10 00 10 05 92 D3 10 05 B2 B2 10 05
    FD 2B B2 C0 10 00 10 05 10 01 B2 40 28 96 00 09
    A2 D3 02 09 B2 D0 00 04 08 09 B2 40 00 96 00 09
    03 43 03 43 03 43 03 43 03 43 03 43 03 43 4C 43
    10 01 B0 13 E2 BF 3C 40 7E 01 B0 13 EA C7 B0 13
    60 C4 5C B3 08 28 B0 13 9C BD 4C 93 04 20 B0 13
    D8 AE B0 13 B6 C4 10 01 0A 12 4A 4C 4C 4A B0 13
    82 BC 4C 93 02 20 5C 43 08 3C 4A 4A CA 93 8A 26
    03 20 4A 4A DA 43 8A 26 5C 43 3A 41 10 01 F2 B0
    40 00 33 A1 02 28 D2 43 76 26 D2 93 89 26 02 20
    E2 D3 76 26 B0 13 0E C8 A2 43 16 24 3C 40 76 26
    80 00 D8 C5 0A 12 21 83 0A 43 09 3C 0F 4D 0F 5A
    E1 4F 00 00 0F 4C 0F 5A EF 41 00 00 1A 53 0A 9E
    F5 2B 21 53 3A 41 10 01 B2 40 80 5A 5C 01 32 C2
    03 43 B0 13 20 C3 7C 40 03 00 B0 13 80 C1 B0 13
    CC C3 03 43 32 D2 80 00 F8 C5 B2 40 28 96 00 09
    82 43 02 09 B2 C0 00 01 10 09 B2 40 00 96 00 09
    C2 43 88 26 C2 43 87 26 4C 43 10 01 B0 13 08 C8
    D2 42 82 23 73 26 B0 13 AA C7 D2 93 73 26 03 20
    D2 43 88 26 10 01 C2 43 88 26 10 01 82 4C 1A 24
    1F 42 86 23 82 9F 16 24 05 28 82 4F 16 24 C2 43
    75 26 02 3C D2 43 75 26 80 00 1A BF 32 C2 03 43
    B2 40 52 2D C0 01 A2 43 C2 01 F2 40 17 00 E4 01
    F2 40 18 00 E5 01 82 43 C0 01 10 01 B2 40 10 00
    02 04 B2 40 04 01 00 04 B2 C0 10 00 00 04 B2 40
    21 00 12 04 B2 D0 10 00 00 04 10 01 3E 40 0A 00
    0D 43 3C 40 28 24 B0 13 68 C7 3E 40 10 00 0D 43
    3C 40 32 24 80 00 68 C7 B0 13 08 C8 B2 90 80 00
    82 23 05 2C D2 42 82 23 3F 09 80 00 AA C7 80 00
    CE C7 B0 13 0E C8 A2 43 16 24 C2 43 76 26 D2 42
    74 26 77 26 3C 40 76 26 80 00 D8 C5 B0 13 0E C8
    A2 43 16 24 C2 43 76 26 D2 42 74 26 77 26 3C 40
    76 26 80 00 D8 C5 F2 D0 10 00 3C 09 C2 43 23 09
    D2 93 86 26 02 20 80 00 1A BF F2 D2 20 09 10 01
    B0 13 9C BD F2 F0 9F 00 3E 09 F2 40 C4 00 3D 09
    C2 43 87 26 4C 43 10 01 B0 13 9C BD 4C 93 04 20
    B0 13 D8 AE B0 13 B6 C4 5C 43 10 01 4C 4C 5C 0E
    8C 93 32 24 02 24 5C 43 01 3C 4C 43 4C 4C 10 01
    B0 13 0E C8 B2 40 43 00 16 24 3C 40 2C A1 80 00
    D8 C5 92 93 82 23 04 20 D2 43 89 26 80 00 AA C7
    80 00 CE C7 B0 13 0E C8 B2 40 12 00 16 24 3C 40
    1A A1 80 00 D8 C5 92 93 82 23 04 20 C2 43 89 26
    80 00 AA C7 80 00 CE C7 82 4C 1C 24 92 42 86 23
    18 24 E2 43 86 26 80 00 0E C8 0F 4C 04 3C FF 4D
    00 00 1F 53 3E 53 0E 93 FA 23 10 01 0F 4C 04 3C
    CF 4D 00 00 1F 53 3E 53 0E 93 FA 23 10 01 0F 4C
    0F 5D 03 3C CC 43 00 00 1C 53 0C 9F FB 23 10 01
    B0 13 0E C8 92 43 16 24 3C 40 73 26 80 00 D8 C5
    B0 13 08 C8 D2 42 84 23 74 26 80 00 AA C7 B2 43
    16 24 C2 43 86 26 C2 43 21 09 10 01 D2 B3 3E 09
    02 2C B0 13 CE C7 10 01 4C 4C DC 43 71 26 4C 43
    10 01 F2 D2 20 09 F2 D2 22 09 10 01 4C 4C DC 43
    72 26 4C 43 10 01 B2 D0 00 01 6C 01 10 01 82 4C
    1E 24 4C 43 10 01 B0 13 E2 C7 5C 43 10 01 3C 40
    7E 26 80 00 44 C7 E2 D2 E0 05 10 01 F2 D2 22 09
    10 01 C2 43 23 09 10 01 5C 43 10 01 5C 43 10 01
    5C 43 10 01 5C 43 10 01 5C 43 10 01 80 00 34 C8
    80 00 28 C8 19 15 10 01 FF 3F 03 43 80 00 AA C7
    80 00 56 C7 10 01 10 01 
    @FFD8
    72 A3 
    @FFE4
    A8 A3 C6 A3 
    @FFEE
    44 A2 74 A3 
    @FFFA
    3A A3 
    @FFFE
    1C A2 
    q
    

    Which device Rev are you using?

    Regards,

    Luis R

  • Thank you for your reply, Luis.

    I have loaded your attached firmware, and now, at least the CC430F5137 chip puts in BSL mode (the main program stops running), although the communication still fails. I still have the same results for the MASS ERASE code as previous steps. The led 2 of the rocket board is set, and anything more occurs.

    By the other hand I disconnect the TCK wire because you are rigth: it is not necessary.

    The revision of my CC430F5137 chip is E.

    The lines of Reset and Test have the following behaviour in the oscilloscope when I execute BSL-Script:

    The Rocket Transmission and the Rocket Reception has this behaviour:

    As you can see, the Rocket transmission can't put level '0' as if the CC430 don't let it. I guess that CC430 at the time is receiving that frame, isn't in BSL mode.

    What could be the problem?

    Thanks in advance!

    BR,

    Luis

  • Hi Luis,

    That's odd. 

    Your "Rocket TX" is BSL_RX/P1.5; and "Rocket RX" is BSL_TX/P1.6, correct?

    Do you have anything else connected to these lines? Other devices, pull-ups, caps, etc?

    Based on what you tell me, the MSP430 is not executing the application anymore, so the BSL_RX line should be an input. A floating input if the device is in reset, or a UART input if the device is in BSL mode. In both cases, the MSP430 shouldn't be driving the line actively.

    I can see that "Rocket RX" goes high and I assume that happens after the entry sequence when the MSP430 configures the pin as UART_TX. It's hard to tell for sure but that could be an indication that the MSP430 is really going to BSL. 

    But even if the device is not going to BSL and staying in application, are you configuring that pin as an output high or something?

    So, a few things to try/check:

    - Can the rocket send the packet correctly when disconnected from MSP430?

    - Can the MSP430 toggle that pin when disconnected from Rocket (i.e. using JTAG)? 

    - Are you powering the board from the rocket? 

    - Are all the CC430 connections OK? VCC, GND, VCore, etc? Any abnormal power consumption when you run code using JTAG?

    Regards,

    Luis R

  • Hi Luis.

    Indeed, I am sharing the UART lines with a RS485 chip, but they don't have any pull resistor or capacitor in RX/TX tracks. I have removed it from the PCB, and the MASS ERASE script runs properly! Although, the script for transmit a new firmware doesn't do it, even the mass erase step fails.

    But in others designs that I have (with MSP430F1611), I have the same situation, sharing the UART, and the UART BSL works properly, so I have searched others solutions instead removing RS485 chip, because it is not possible for our design:

    I've tested removing the 100 Ohms resistors and bypassing them on the BSL lines of ROCKET and it works properly with the MASS ERASE script. But, as it happens above, the firmware programming doesn't work, even the mass erase step.

    Until tomorrow I won't be able to do new tests, so what do you think about the failing of the programming script. Is it an electrical problem on lines? Or is it the script? Vcc and GND is ok, I have 3.3Vdc stable, and the length of the tracks are not long enough to have a large impedance that could produce electrical interferences.

    My program script is:

    MODE 5xx COM7
    VERBOSE
    MASS_ERASE
    RX_DATA_BLOCK my_firmware.txt

    Removing the last line, it works.

    BR,

    Luis

  • Hi Luis,

    It looks like your programming script is missing the RX_PASSWORD command before calling RX_DATA_BLOCK. RX_DATA_BLOCK is a password protected command. So try simply adding the line "RX_PASSWORD" between the MASS_ERASE and RX_DATA_BLOCK lines of your script.

    Regards,
    Katie
  • Hi Katie and Luis.

    Finally I have had success programming via the Olimex Rocket!!!

    After your help, Katie and Luis, I do it. I will summarize the steps for using Rocket BSL with my CC430F5137 design:

    1. With the last firmware that appears in http://processors.wiki.ti.com/index.php/MSP430-BSL the rocket doesn't work with CC430F5137. I have used the firmware that recommends Luis RC, http://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/166/CDC_5F00_UART_5F00_Bridge_5F00_F5509.txt

    1. After viewing the electrical problems in the UARTs lines, I have removed all the 100Ohm resistors from the Rocket. Cause I have shared the UART lines with a RS485 chip, this could be the source of the electricals problems. Removing the 100Ohm impedance in lines, I resolved it.

    2. I have the next connections:

    ROCKET BSL             CC430F5137
    BSL-RST(4)                #RST/NMI/SBWTDIO
    BSL-TEST(7)              TEST/SBWTCK
    BSL-TX(1)                   P1.6/PM_UCA0TXD
    BSL-RX(2)                  P1.5/PM_UCA0RXD
    VCC(6)                        VCC
    GND(5)                        GND

    3. With python tools I haven't been able to program the CC430F5137, I've used BSL-SCRIPTER.txt (http://www.ti.com/lit/zip/slau319).

    4. In my script, for downloading a firmware, I have had to put the Baudrate below or equal to 19200 in the first line after the MODE line. For larger baudrates, it doesn't work. For example, my script was:

    MODE 5xx COM7
    VERBOSE
    CHANGE_BAUD_RATE 19200
    MASS_ERASE
    RX_PASSWORD
    RX_DATA_BLOCK my_fw.txt


    If I don't put the baudrate, BSL-SCRIPTER doesn't run properly.

    I hope this would be a help for anybody with my same problems.

    Thanks a lot, Katie and Luis!

    PD: (My last questions!)

    Could it be possible to use the rocket bsl and CC430 with the python tools? 

    And, how could I increase the baudrate upper than 19200 for programming via UART BSL?

    BR,

    Luis

  • Hi Luis,

    From what I can see, the python script doesn't force a baudrate of "9601" which is what triggers the rocket to generate the entry sequence.

    First of all, install this patch which should fix some problems: https://bugs.launchpad.net/python-msp430-tools/+bug/1258574

    After that, I added the following in start_bsl inside uart.py:

           self.set_TEST(True)     # TEST pin: GND

           time.sleep(0.250)       # give MSP430's oscillator time to stabilize

           time.sleep(0.010)

           self.serial.baudrate = 9601

           time.sleep(0.250)

           self.serial.baudrate = 9600

           self.serial.flushInput()    # clear buffers

    I tried running the script as shown below and it worked:

    > python -m msp430.bsl5.uart -e LEDToggle.txt -p COM19 -v

    Here are both scripts in case you are interested:

    #!/usr/bin/env python
    # -*- coding: utf-8 -*-
    #
    # Copyright (c) 2011 Chris Liechti <cliechti@gmx.net>
    # All Rights Reserved.
    # Simplified BSD License (see LICENSE.txt for full text)
    
    """\
    Simple MSP430 F5xx BSL implementation. The BSL class is abstract, i.e. it
    requires that a bsl() method is implemented, by subclassing it.
    
    The bsl() method is responsible to implement the transport (e.g. serial
    port access, USB HID).
    """
    
    import array
    import struct
    
    # commands for the MSP430 target
    BSL_RX_DATA_BLOCK       = 0x10    # Write to boot loader
    BSL_RX_DATA_BLOCK_FAST  = 0x1b    # Write to boot loader
    BSL_RX_PASSWORD         = 0x11    # Receive password to unlock commands
    BSL_ERASE_SEGMENT       = 0x12    # Erase one segment
    BSL_LOCK_INFO           = 0x13    # Toggle INFO_A lock bit
    BSL_MASS_ERASE          = 0x15    # Erase complete FLASH memory
    BSL_CRC_CHECK           = 0x16    # Run 16 bit CRC check over given area
    BSL_LOAD_PC             = 0x17    # Load PC and start execution
    BSL_TX_DATA_BLOCK       = 0x18    # Read from boot loader
    BSL_VERSION             = 0x19    # Get BSL version
    BSL_BUFFER_SIZE         = 0x1a    # Get BSL buffer size
    
    
    class BSL5Exception(Exception):
        """Errors from the slave"""
    
    class BSL5Timeout(BSL5Exception):
        """got no answer from slave within time"""
    
    class BSL5Error(BSL5Exception):
        """command execution failed"""
    
    BSL5_ERROR_CODES = {
            0x00: 'Operation successful',
            0x01: 'Flash write check failed',
            0x02: 'Flash fail bit set',
            0x03: 'Voltage change during program',
            0x04: 'BSL locked',
            0x05: 'BSL password error',
            0x06: 'Byte write forbidden',
            0x07: 'Unknown command',
            0x08: 'Packet length exceeds buffer size',
    }
    
    
    def three_bytes(address):
        """Convert a 24 bit address to a string with 3 bytes"""
        return '%c%c%c' % ((address & 0xff), (address >> 8) & 0xff, (address >> 16) & 0xff)
    
    
    class BSL5(object):
        """\
        This class implements the core commands of a F5xx BSL.
        """
    
        def check_answer(self, data):
            if data[0] == '\x3b':
                if data[1] == '\0':
                    return # SUCCESS!
                raise BSL5Error(BSL5_ERROR_CODES.get(ord(data[1]), 'unknown error response 0x%02x' % ord(data[1])))
            elif data[0] != '\x3a':
                raise BSL5Error('unknown response 0x%02x' % ord(data[0]))
    
        def BSL_RX_DATA_BLOCK(self, address, data):
            packet = struct.pack('<3s', three_bytes(address)) + array.array('B', data).tostring()
            answer = self.bsl(BSL_RX_DATA_BLOCK, packet, expect=2)
            self.check_answer(answer)
    
        def BSL_RX_DATA_BLOCK_FAST(self, address, data):
            packet = three_bytes(address) + data
            self.bsl_header(BSL_RX_DATA_BLOCK_FAST, packet)
    
        def BSL_TX_DATA_BLOCK(self, address, length):
            packet = struct.pack('<3sH', three_bytes(address), length)
            answer = self.bsl(BSL_TX_DATA_BLOCK, packet, expect=length+1)
            self.check_answer(answer)
            return answer[1:]
    
        def BSL_MASS_ERASE(self):
            answer = self.bsl(BSL_MASS_ERASE, expect=0)
            self.check_answer(answer)
    
        def BSL_ERASE_SEGMENT(self, address):
            answer = self.bsl(BSL_ERASE_SEGMENT, three_bytes(address), expect=2)
            self.check_answer(answer)
    
        def BSL_LOAD_PC(self, address):
            self.bsl_header(BSL_LOAD_PC, three_bytes(address))
    
        def BSL_RX_PASSWORD(self, password):
            answer = self.bsl(BSL_RX_PASSWORD, password, expect=2)
            self.check_answer(answer)
    
        def BSL_VERSION(self):
            """\
            Returns a tuple with
            - BSL vendor information
            - Command interpreter version
            - API version
            - Peripheral interface version
            """
            answer = self.bsl(BSL_VERSION, expect=5)
            self.check_answer(answer)
            return struct.unpack('<BBBBB', answer)[1:]
    
        def BSL_BUFFER_SIZE(self):
            answer = self.bsl(BSL_BUFFER_SIZE, expect=2)
            self.check_answer(answer)
            return struct.unpack('<BH', answer)[1]
    
        def BSL_LOCK_INFO(self):
            answer = self.bsl(BSL_LOCK_INFO, expect=0)
            self.check_answer(answer)
    
        def BSL_CRC_CHECK(self):
            answer = self.bsl(BSL_CRC_CHECK, expect=0)
            self.check_answer(answer)
            return struct.unpack('<BH', answer)[1]
    
        # - - - - - - High level functions - - - - - -
        def detect_buffer_size(self):
            """Auto detect buffer size"""
            try:
                self.buffer_size = self.BSL_BUFFER_SIZE()
            except BSL5Error:
                pass
    
        def __init__(self):
            self.buffer_size = 240
            self.use_fast_mode = False
    
        def memory_read(self, address, length):
            """\
            Read from memory. It creates multiple BSL_TX_DATA_BLOCK commands
            internally when the size is larger than the block size.
            """
            if self.buffer_size is None: raise BSL5Error('block size!?')
            data = bytearray()
            odd = bool(length & 1)
            if odd:
                length += 1
            while length:
                size = min(self.buffer_size, length)
                data.extend(bytes(self.BSL_TX_DATA_BLOCK(address, size)))
                address += size
                length -= size
            if odd and data:
                data.pop()  # remove the additional byte w've added on upload
            return data
    
        def memory_write(self, address, data):
            """\
            Write to memory. It creates multiple BSL_RX_DATA_BLOCK or
            BSL_RX_DATA_BLOCK_FAST commands internally when the size is larger than
            the block size.
            """
            if self.buffer_size is None: raise BSL5Error('block size!?')
            if len(data) & 1:
                data += '\xff'
                #~ self.log.warn('memory_write: Odd length data not supported, padded with 0xff')
            while data:
                block, data = data[:self.buffer_size], data[self.buffer_size:]
                if self.use_fast_mode:
                    self.BSL_RX_DATA_BLOCK_FAST(address, block)
                else:
                    self.BSL_RX_DATA_BLOCK(address, block)
                address += len(block)
    
        def mass_erase(self):
            """Clear all Flash memory."""
            return self.BSL_MASS_ERASE()
    
        def erase(self, address):
            """Erase Flash segment containing the given address."""
            return self.BSL_ERASE_SEGMENT(address)
    
        #~ def main_erase(self):
            #~ """Erase Flash segment containing the given address."""
            #~ # must execute command multiple times to meet cumulative erase time
            #~ # required, see slaa89d, pg. 8
            #~ self.BSL_ERASE(0xff00, 0xa504)
    
        def execute(self, address):
            """Start executing code on the target"""
            return self.BSL_LOAD_PC(address)
    
        def password(self, password):
            """Transmit the BSL password"""
            return self.BSL_RX_PASSWORD(password)
    
        def version(self):
            """\
            Get the BSL version. The 16 bytes of the ROM that contain chip and
            BSL info are returned.
            """
            return self.BSL_VERSION()
    
        def reset(self):
            """\
            Reset the device. BSL is exit.
            XXX currently only suitable for F5xx devices as the WDT module is used.
            """
            # try a write to the watchdog
            try:
                self.BSL_RX_DATA_BLOCK_FAST(0x015c, "\x00\x00")  # XXX set a delay instead of immediate reset
            except BSL5Error:
                # we can't verify the success of the reset...
                pass
    
    
    # ----- test code only below this line -----
    
    if __name__ == '__main__':
        class DummyBSL(BSL5):
            """Test code: show what the BSL command would send"""
            def bsl(self, cmd, message='', expect=None):
                txdata = struct.pack('<cBBB', DATA_FRAME, cmd, len(message), len(message)) + message
                txdata += struct.pack('<H', self.checksum(txdata) ^ 0xffff)   #append checksum
                print repr(txdata), len(txdata)
                print ''.join(['\\x%02x' % ord(x) for x in txdata])
    
        dummy = DummyBSL()
        dummy.BSL_RX_PASSWORD("\xff"*32)
    

    #!/usr/bin/env python
    # -*- coding: utf-8 -*-
    #
    # Copyright (c) 2011 Chris Liechti <cliechti@gmx.net>
    # All Rights Reserved.
    # Simplified BSD License (see LICENSE.txt for full text)
    
    """\
    Simple MSP430 BSL5 implementation using the serial port.
    """
    
    import sys
    from msp430.bsl5 import bsl5
    import serial
    import struct
    import logging
    import time
    
    from optparse import OptionGroup
    import msp430.target
    import msp430.memory
    
    
    # interface specific commands
    # UART
    BSL_CHANGE_BAUD_RATE = 0x52    # Change baud rate
    
    BSL_BAUD_RATE_D1 = {
        9600   : 0x02,
        19200  : 0x03,
        38400  : 0x04,
        57600  : 0x05,
        115200 : 0x06,
    }
    
    # possible answers
    BSL5_UART_ERROR_CODES = {
            0x51: 'Header incorrect',
            0x52: 'Checksum incorrect',
            0x53: 'Packet size zero',
            0x54: 'Packet size exceeds buffer',
            0x55: 'Unknown error',
            0x56: 'Unknown baud rate',
    }
    
    BSL5_ACK = '\x00'
    
    
    def crc_update(crc, byte):
        x = ((crc >> 8) ^ ord(byte)) & 0xff
        x ^= x >> 4
        return ((crc << 8) ^ (x << 12) ^ (x << 5) ^ x) & 0xffff
    
    
    class SerialBSL5(bsl5.BSL5):
        """\
        Implementation of the BSL protocol over the serial port.
        """
    
        def __init__(self):
            bsl5.BSL5.__init__(self)
            self.serial = None
            self.logger = logging.getLogger('BSL')
            self.extra_timeout = None
            self.invertRST = False
            self.invertTEST = False
            self.swapResetTest = False
            self.testOnTX = False
            self.blindWrite = False
            # delay after control line changes
            self.control_delay = 0.05
    
    
        def open(self, port=0, baudrate=9600, ignore_answer=False):
            self.ignore_answer = ignore_answer
            self.logger.info('Opening serial port %r' % port)
            try:
                self.serial = serial.serial_for_url(
                    port,
                    baudrate=baudrate,
                    parity=serial.PARITY_EVEN,
                    stopbits=serial.STOPBITS_ONE,
                    timeout=1,
                )
            except AttributeError:  # old pySerial versions do not have serial_for_url
                self.serial = serial.Serial(
                    port,
                    baudrate=baudrate,
                    parity=serial.PARITY_EVEN,
                    stopbits=serial.STOPBITS_ONE,
                    timeout=1,
                )
    
    
        def __del__(self):
            self.close()
    
    
        def close(self):
            """Close serial port"""
            if self.serial is not None:
                self.logger.info('closing serial port')
                self.serial.close()
                self.serial = None
    
        # interface specific commands
    
        def BSL_CHANGE_BAUD_RATE(self, multiply):
            packet = struct.pack('<B', multiply)
            self.bsl_header(BSL_CHANGE_BAUD_RATE, packet)
    
    
        def bsl_header(self, cmd, message=''):
            """\
            Low level access to the serial communication.
    
            This function sends a command and waits until it receives an answer
            (including timeouts). It will return a string with the data part of
            the answer. In case of a failure read timeout or rejected commands by
            the slave, it will raise an exception.
    
            If the parameter "expect" is not None, "expect" bytes are expected in
            the answer, an exception is raised if the answer length does not match.
            If "expect" is None, the answer is just returned.
    
            Frame format:
            +-----+----+----+-----------+----+----+
            | HDR | LL | LH | D1 ... DN | CL | CH |
            +-----+----+----+-----------+----+----+
            """
            # first synchronize with slave
            self.logger.debug('Command 0x%02x %s' % (cmd, message.encode('hex')))
            # prepare command with checksum
            txdata = struct.pack('<BHB', 0x80, 1+len(message), cmd) + message
            txdata += struct.pack('<H', reduce(crc_update, struct.pack('<B', cmd)+message, 0xffff))   # append checksum
            #~ self.logger.debug('Sending command: %r' % (txdata.encode('hex'),))
            # transmit command
            self.serial.write(txdata)
            # wait for command answer
            if self.blindWrite:
                time.sleep(0.100)
                return
            if self.ignore_answer:
                return
    
            self.logger.debug('Reading answer...')
            if self.extra_timeout is None:
                ans = self.serial.read(1)
            else:
                for timeout in range(self.extra_timeout):
                    ans = self.serial.read(1)
                    if ans:
                        break
            if ans != BSL5_ACK:
                if ans: raise bsl5.BSL5Error('BSL reports error: %s' % BSL5_UART_ERROR_CODES.get(ans, 'unknown error'))
                raise bsl5.BSL5Error('No ACK received (timeout)')
    
        def bsl(self, cmd, message='', expect=None):
            self.bsl_header(cmd, message)
            head = self.serial.read(3)
            if len(head) != 3: raise bsl5.BSL5Timeout('timeout while reading answer (header)')
            pi, length = struct.unpack("<BH", head)
            if pi == 0x80:
                data = self.serial.read(length)
                if len(data) != length: raise bsl5.BSL5Timeout('timeout while reading answer (data)')
                crc_str = self.serial.read(2)
                if len(crc_str) != 2: raise bsl5.BSL5Timeout('timeout while reading answer (CRC)')
                crc = struct.unpack("<H", crc_str)
                crc_expected = reduce(crc_update, data, 0xffff)
                crc_expected = struct.pack('<H', crc_expected)
                if crc_str != crc_expected:
                    raise bsl5.BSLException('CRC error in answer')
                if expect is not None and length != expect:
                    raise bsl5.BSL5Error('expected %d bytes, got %d bytes' % (expect, len(data)))
                return data
            else:
                if pi: raise bsl5.BSL5Error('received bad PI, expected 0x80 (got 0x%02x)' % (pi))
                raise bsl5.BSL5Error('received bad PI, expected 0x80 (got empty response)')
    
    
        def set_RST(self, level=True):
            """\
            Controls RST/NMI pin (0: GND; 1: VCC; unless inverted flag is set)
            """
            # invert signal if configured
            if self.invertRST:
                level = not level
            # set pin level
            if self.swapResetTest:
                self.serial.setRTS(level)
            else:
                self.serial.setDTR(level)
            time.sleep(self.control_delay)
    
    
        def set_TEST(self, level=True):
            """\
            Controls TEST pin (inverted on board: 0: VCC; 1: GND; unless inverted
            flag is set)
            """
            # invert signal if configured
            if self.invertTEST:
                level = not level
            # make TEST signal on TX pin, using break condition.
            if self.testOnTX:
                self.serial.setBreak(level)
            else:
                # set pin level
                if self.swapResetTest:
                    self.serial.setDTR(level)
                else:
                    self.serial.setRTS(level)
            time.sleep(self.control_delay)
    
    
        def set_baudrate(self, baudrate):
            """\
            Change the BSL baud rate on the target and switch the serial port.
            """
            self.logger.info('changing baud rate to %s' % (baudrate,))
            try:
                multiply = BSL_BAUD_RATE_D1[baudrate]
            except:
                raise ValueError('unsupported baud rate %s' % (baudrate,))
            else:
                self.BSL_CHANGE_BAUD_RATE(multiply)
                time.sleep(0.010)
                self.serial.baudrate = baudrate
    
    
        def start_bsl(self):
            """\
            Start the ROM-BSL using the pulse pattern on TEST and RST.
            """
            self.logger.info('ROM-BSL start pulse pattern')
            self.set_RST(True)      # power supply
            self.set_TEST(False)
            time.sleep(0.250)
            self.set_TEST(True)     # power supply
            time.sleep(0.250)       # charge capacitor on boot loader hardware
    
            self.set_RST(False)     # RST  pin: GND
            self.set_TEST(True)     # TEST pin: GND
            self.set_TEST(False)    # TEST pin: Vcc
            self.set_TEST(True)     # TEST pin: GND
            self.set_TEST(False)    # TEST pin: Vcc
            self.set_TEST(True)     # TEST pin: GND
            self.set_TEST(False)    # TEST pin: Vcc
            self.set_RST(True)      # RST  pin: Vcc
            self.set_TEST(True)     # TEST pin: GND
            time.sleep(0.250)       # give MSP430's oscillator time to stabilize
    
            time.sleep(0.010)
            self.serial.baudrate = 9601
            time.sleep(0.250)
            self.serial.baudrate = 9600
                
            self.serial.flushInput()    # clear buffers
    
    
    class SerialBSL5Target(SerialBSL5, msp430.target.Target):
        """Combine the serial BSL backend and the common target code."""
    
        def __init__(self):
            msp430.target.Target.__init__(self)
            SerialBSL5.__init__(self)
            self.patch_in_use = False
    
        def add_extra_options(self):
            group = OptionGroup(self.parser, "Communication settings")
    
            group.add_option("-p", "--port",
                    dest="port",
                    help="Use com-port",
                    default=0)
            group.add_option("--invert-test",
                    dest="invert_test",
                    action="store_true",
                    help="invert RTS line",
                    default=False)
            group.add_option("--invert-reset",
                    dest="invert_reset",
                    action="store_true",
                    help="invert DTR line",
                    default=False)
            group.add_option("--swap-reset-test",
                    dest="swap_reset_test",
                    action="store_true",
                    help="exchenage RST and TEST signals (DTR/RTS)",
                    default=False)
            group.add_option("--test-on-tx",
                    dest="test_on_tx",
                    action="store_true",
                    help="TEST/TCK signal is muxed on TX line",
                    default=False)
    
            self.parser.add_option_group(group)
    
            group = OptionGroup(self.parser, "BSL settings")
    
            group.add_option("--no-start",
                    dest="start_pattern",
                    action="store_false",
                    help="no not use ROM-BSL start pattern on RST+TEST/TCK",
                    default=True)
    
            group.add_option("-s", "--speed",
                    dest="speed",
                    type=int,
                    help="change baud rate (default 9600)",
                    default=None)
    
            group.add_option("--password",
                    dest="password",
                    action="store",
                    help="transmit password before doing anything else, password is given in given (TI-Text/ihex/etc) file",
                    default=None,
                    metavar="FILE")
    
            group.add_option("--ignore-answer",
                    dest="ignore_answer",
                    action="store_true",
                    help="do not wait for answer to BSL commands",
                    default=False)
    
            group.add_option("--control-delay",
                    dest="control_delay",
                    type="float",
                    help="set delay in seconds (float) for BSL start pattern",
                    default=0.01)
    
            self.parser.add_option_group(group)
    
    
        def parse_extra_options(self):
            if self.verbose > 1:   # debug infos
                if hasattr(serial, 'VERSION'):
                    sys.stderr.write("pySerial version: %s\n" % serial.VERSION)
    
    
        def close_connection(self):
            self.close()
    
    
        def open_connection(self):
            self.logger = logging.getLogger('BSL')
            self.open(
                self.options.port,
                ignore_answer = self.options.ignore_answer,
            )
            self.control_delay = self.options.control_delay
    
            if self.options.test_on_tx:
                self.testOnTX = True
    
            if self.options.invert_test:
                self.invertTEST = True
    
            if self.options.invert_reset:
                self.invertRST = True
    
            if self.options.swap_reset_test:
                self.swapResetTest = True
    
            self.set_TEST(True)
            self.set_RST(True)
    
            if self.options.start_pattern:
                self.start_bsl()
    
    
            if self.options.do_mass_erase:
                self.logger.info("Mass erase...")
                try:
                    self.BSL_RX_PASSWORD('\xff'*30 + '\0'*2)
                except bsl5.BSL5Error:
                    pass # it will fail - that is our intention to trigger the erase
                time.sleep(1)
                #~ self.extra_timeout = 6
                #~ self.mass_erase()
                #~ self.extra_timeout = None
                self.BSL_RX_PASSWORD('\xff'*32)
                # remove mass_erase from action list so that it is not done
                # twice
                self.remove_action(self.mass_erase)
            else:
                if self.options.password is not None:
                    password = msp430.memory.load(self.options.password).get_range(0xffe0, 0xffff)
                    self.logger.info("Transmitting password: %s" % (password.encode('hex'),))
                    self.BSL_RX_PASSWORD(password)
    
            if self.options.speed is not None:
                try:
                    self.set_baudrate(self.options.speed)
                except bsl5.BSLError:
                    raise bsl5.BSLError("--speed option not supported by BSL on target")
    
            # configure the buffer
            #~ self.detect_buffer_size()
    
    
        # override reset method: use control line
        def reset(self):
            #~ time.sleep(0.25)
            #~ self.set_RST(True)      # power supply
            #~ self.set_TEST(True)     # power supply
            #~ time.sleep(0.1)
            #~ self.patch_in_use = False
            self.set_RST(False)
            #~ time.sleep(0.5)
            #~ SerialBSL.reset(self)
            #~ self.set_RST(True)
            #~ time.sleep(0.250)       # give MSP430's oscillator time to stabilize
    
    
    def main():
        # run the main application
        bsl_target = SerialBSL5Target()
        bsl_target.main()
    
    if __name__ == '__main__':
        main()
    

    Regarding your second question, I'm not really sure why the faster baudrate doesn't work, but do you happen to have any traces of the UART TX/RX? Is the MSP430 BSL acting incorrectly, the scripter, or the rocket?

    Regards,

    Luis R

  • Luis,  

    Regarding your second question:

    luis.lopez said:
    And, how could I increase the baudrate upper than 19200 for programming via UART BSL?

    I was able to replicate the problem and it seems to be caused by the Rocket board. When I was running tests, I saw that the MSP430 was returning the correct data via UART (by using a bus analyzer connected to BSL_TX and BSL_RX), but the scripter was getting incorrect data via USB (using VERBOSE).

    After some debugging, the problem seems to be caused by the following lines in USCI_A0_ISR:

    bDataSendCompleted_event[0] = FALSE;
    USBCDC_sendData((BYTE*)&UCA0RXBUF, 1, CDC0_INTFNUM);
    while (bDataSendCompleted_event == FALSE){};

     

    Instead, I implemented a quick circular buffer and sent the data in the main loop. There are probably some better options (i.e. using DMA) but this seems to get the job done.

    I'm attaching an updated version of the source files and the Rocket image:

    /*
     * main.c
     *
     * Main function of MSP430-BSL. Based on MSP430 USB-Example (CDC/HID Driver)
     *
     * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/ 
     * 
     * 
     *  Redistribution and use in source and binary forms, with or without 
     *  modification, are permitted provided that the following conditions 
     *  are met:
     *
     *    Redistributions of source code must retain the above copyright 
     *    notice, this list of conditions and the following disclaimer.
     *
     *    Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the 
     *    documentation and/or other materials provided with the   
     *    distribution.
     *
     *    Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
     *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
     *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
     *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
     *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
     *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
     *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
     *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     *
     */
    
    #include <MSP430.h>
    #include "USB_API/USB_Common/device.h"
    #include "USB_API/USB_Common/types.h"      // Basic Type declarations
    #include "USB_API/USB_Common/usb.h"        // USB-specific functions
    #include "USB_config/descriptors.h"
    #include "USB_API/USB_CDC_API/UsbCdc.h"
    #include "usb/usbConstructs.h"
    
    #include "main.h"
    #include "initMCU.h"
    #include "timer.h"
    
    #include <intrinsics.h>
    #include <string.h>
    
    enum active_peripherals active_peripheral = I2C;
    
    #if (!defined (UART_BASED) && !defined(I2C_BASED))
    #error "Define a valid interface"
    #endif
    
    #include "i2c.h"
    #include "uart.h"
    
    #ifdef I2C_BASED
    #include "BSL_Comm.h"
    BYTE dataBuffer[300];  // buffer for data receiving
    volatile BYTE bDataSendCompleted_event[CDC_NUM_INTERFACES] = {FALSE};
    volatile BYTE bDataReceiveCompleted_event[CDC_NUM_INTERFACES] = {FALSE};  // data receive completed event
    unsigned char UART_FSM(BYTE* dataBuffer);
    #endif
    
    //------------------------------------------------------------------------------
    VOID BlinkLed(VOID)
    {
        //static BYTE nCount = 0;
    
        //if(nCount++ > 100)
        //{ 
        //    nCount = 0;
          //  TogglePin(1,0);// Toggle LED P1.0
        //}  
    }
    
    /*----------------------------------------------------------------------------+
    | Main Routine                                                                |
    +----------------------------------------------------------------------------*/
    VOID main(VOID)
    {
    #ifdef I2C_BASED
        BYTE ret;
        WORD bytes_sent, bytes_received;
        int16_t sendDataLength = 0;
        unsigned int BSLCommandLength = 0;
        int16_t requireSlaveAnswer = 1;
    #endif
        
        Init_StartUp();			//initialize device
        ConfigUSB();			//configure USB
        Delay(3000000);                     // !!! Do not remove this delay !!!
        //Init_TimerA2();
        TogglePin(1,0);
        TogglePin(1,1);
        __delay_cycles(5000000);
        TogglePin(1,0);
        TogglePin(1,1);
        __delay_cycles(5000000);
        TogglePin(1,0);
        TogglePin(1,1);
        __delay_cycles(5000000);
        TogglePin(1,0);
        TogglePin(1,1);
        __delay_cycles(5000000);
        __enable_interrupt();               // enable global interrupts
    #ifdef UART_BASED
        while(1);
    #elif defined (I2C_BASED)
        while(1)
        {
            if(active_peripheral == UART)
            {
                //Check the USB state and directly main loop accordingly
                switch (USB_connectionState())
                {
                    case ST_USB_DISCONNECTED:
                        // __bis_SR_register(LPM3_bits + GIE);                                 //Enter LPM3 w/ interrupts enabled
                        _NOP();                                                             //For Debugger
                        break;
    
                    case ST_USB_CONNECTED_NO_ENUM:
                        break;
    
                    case ST_ENUM_ACTIVE:
                        //__bis_SR_register(LPM0_bits + GIE);                                 //Enter LPM0 (can't do LPM3 when active)
                        //_NOP();                                                             //For Debugger
    
                        ret = USBCDC_intfStatus(CDC0_INTFNUM, &bytes_sent,  &bytes_received);
                        if (ret & kUSBCDC_dataWaiting)
                        {
                            //_NOP(); // Send data received from USB to UART
                            USBCDC_receiveData(dataBuffer, 1, CDC0_INTFNUM);
                            while(UCA0STAT & UCBUSY);
                            UCA0TXBUF = dataBuffer[0];
                        }
                        
                        UARTtoCDC_serviceBuff();
                        
    //                    if(UCA0IFG & UCRXIFG)
    //                    {
    //                        _NOP(); // Send data received from UART to USB
    //                        bDataSendCompleted_event[0] = FALSE;
    //                        ret = USBCDC_sendData((BYTE*)&UCA0RXBUF, 1, CDC0_INTFNUM);
    //                        while (bDataSendCompleted_event == FALSE){};
    //                        UCA0IFG &= ~UCRXIFG;
    //                    }
    
                        break;
    
                    case ST_ENUM_SUSPENDED:
                        // P1OUT &= ~BIT0;                                                     //When suspended, turn off LED
                        // __bis_SR_register(LPM3_bits + GIE);                                 //Enter LPM3 w/ interrupts
                        _NOP();
                        break;
    
                    case ST_ENUM_IN_PROGRESS:
                        break;
    
                    case ST_NOENUM_SUSPENDED:
                        // P1OUT &= ~BIT0;
                        //__bis_SR_register(LPM3_bits + GIE);
                        _NOP();
                        break;
    
                    case ST_ERROR:
                        _NOP();
                        break;
    
                    default:;
                }          
            }
            else if(active_peripheral == I2C)
            {
                //Check the USB state and directly main loop accordingly
                switch (USB_connectionState())
                {
                    case ST_USB_DISCONNECTED:
                        // __bis_SR_register(LPM3_bits + GIE);                                 //Enter LPM3 w/ interrupts enabled
                        _NOP();                                                             //For Debugger
                        break;
    
                    case ST_USB_CONNECTED_NO_ENUM:
                        break;
    
                    case ST_ENUM_ACTIVE:
                        //__bis_SR_register(LPM0_bits + GIE);                                 //Enter LPM0 (can't do LPM3 when active)
                        //_NOP();                                                             //For Debugger
    
                        ret = USBCDC_intfStatus(CDC0_INTFNUM, &bytes_sent,  &bytes_received);
                        if (ret & kUSBCDC_dataWaiting)
                        {
                            BSLCommandLength = UART_FSM(dataBuffer);
                        }
                        if (BSLCommandLength > 0)
                        {
                            // Special command to just get data
                            if (BSLCommandLength == 0x01)
                            {
                                // If response is OK, request response from Slave
                                sendDataLength = i2cReceiveMessage(dataBuffer);
                                if ((requireSlaveAnswer < 0) || (sendDataLength < 0))
                                {
                                    // If there was an error, report to PC
                                    sendDataLength = 1;
                                    dataBuffer[0] = 0x55;   // Temporary error code
                                }
                            }
                            else
                            {
                                requireSlaveAnswer = i2cSendMessage(dataBuffer, BSLCommandLength);
                                i2cStopSending();
                                __delay_cycles(10000);
    
                                if (requireSlaveAnswer == 0x00)
                                {
                                    sendDataLength = 0; // Don't send response to PC
                                }
                                else if(requireSlaveAnswer > 0)
                                {
                                // If response is OK, request response from Slave
                                    sendDataLength = i2cReceiveMessage(dataBuffer);
                                }
                        
                                if ((requireSlaveAnswer < 0) || (sendDataLength < 0))
                                {
                                    // If there was an error, report to PC
                                    sendDataLength = 1;
                                    dataBuffer[0] = 0x55;   // Temporary error code
                                }
                                BSLCommandLength = 0;
                            }
                        }
                        
                        if (sendDataLength > 0)
                        {
                            //send data back to PC
                            bDataSendCompleted_event[0] = FALSE;
    			ret = USBCDC_sendData((BYTE*)&dataBuffer, sendDataLength, CDC0_INTFNUM);
    			while (bDataSendCompleted_event == FALSE){};
    /*
    			do
                            {
                                ret = USBCDC_intfStatus(CDC0_INTERFACE_NUMBER, &bytes_sent,  &bytes_received);
    			}
    			while (ret & kUSBCDC_waitingForSend);
    */
    			sendDataLength = 0;
                            __no_operation();
                        }
    
                        break;
    
                    case ST_ENUM_SUSPENDED:
                        // P1OUT &= ~BIT0;                                                     //When suspended, turn off LED
                        // __bis_SR_register(LPM3_bits + GIE);                                 //Enter LPM3 w/ interrupts
                        _NOP();
                        break;
    
                    case ST_ENUM_IN_PROGRESS:
                        break;
    
                    case ST_NOENUM_SUSPENDED:
                        // P1OUT &= ~BIT0;
                        //__bis_SR_register(LPM3_bits + GIE);
                        _NOP();
                        break;
    
                    case ST_ERROR:
                        _NOP();
                        break;
    
                    default:;
                }
            }
        }
    #endif
    
    } //main()
    
    //------------------------------------------------------------------------------
    #pragma vector = UNMI_VECTOR
    __interrupt VOID UNMI_ISR(VOID)
    {
        switch (__even_in_range(SYSUNIV, SYSUNIV_BUSIFG))
        {
        case SYSUNIV_NONE:
          __no_operation();
          break;
        case SYSUNIV_NMIIFG:
          __no_operation();
          break;
        case SYSUNIV_OFIFG:
          UCSCTL7 &= ~(DCOFFG+0+0+0); // Clear OSC flaut Flags fault flags
          SFRIFG1 &= ~OFIFG;          // Clear OFIFG fault flag
          break;
        case SYSUNIV_ACCVIFG:
          __no_operation();
          break;
        case SYSUNIV_BUSIFG:
          SYSBERRIV = 0;            // clear bus error flag
          USB_disable();            // Disable
        }
    }
    
    
    //------------------------------------------------------------------------------
    //End of file.
    //------------------------------------------------------------------------------
    

    /*
     * uart.c
     *
     * Implementation of UART Bridge.
     *
     * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/ 
     * 
     * 
     *  Redistribution and use in source and binary forms, with or without 
     *  modification, are permitted provided that the following conditions 
     *  are met:
     *
     *    Redistributions of source code must retain the above copyright 
     *    notice, this list of conditions and the following disclaimer.
     *
     *    Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the 
     *    documentation and/or other materials provided with the   
     *    distribution.
     *
     *    Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
     *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
     *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
     *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
     *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
     *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
     *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
     *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     *
     */
    
    #include <MSP430.h>
    #include <descriptors.h>
    
    #include "USB_API/USB_Common/types.h"
    #include "main.h"
    #include "USB_API/USB_Common/types.h"
    #include "USB_API/USB_Common/defMSP430USB.h"
    #include "USB_API/USB_Common/usb.h"            // USB-specific Data Structures
    #include "USB_API/USB_CDC_API/UsbCdc.h"
    #include "uart.h"
    #include "usb/usbConstructs.h"
    #include <stdint.h>
    
    #include <string.h>
    //function pointers
    extern VOID *(*USB_RX_memcpy)(VOID * dest, const VOID * source, size_t count);
    extern VOID *(*USB_TX_memcpy)(VOID * dest, const VOID * source, size_t count);
    
    //------------------------------------------------------------------------------
    // Global Variables                                                            
    //------------------------------------------------------------------------------
    extern __no_init tEDB __data16 tInputEndPointDescriptorBlock[];
    extern __no_init tEDB __data16 tOutputEndPointDescriptorBlock[];
    
    //------------------------------------------------------------------------------
    
    // List of standard baudrates
    const struct _BaudrateList{
        BYTE ucaBR0,  ucaBR1, ucaMCTL;
    }BaudrateList[] = {                                   // CLK 20MHz
            {0x00,    0x00,   0x00},
            {0x1A,    0x41,   UCBRS_5},                   // 1.2 kb/s
            {0x8D,    0x20,   UCBRS_3},                   // 2.4 kb/s
            {0x46,    0x10,   UCBRS_5},                   // 4.8 kb/s
            {0x82,    0x00,   0x30 + UCOS16},             // 9.6 kb/s
            {0x41,    0x00,   (UCBRF_2+UCOS16)},          // 19.2 kb/s
            {0x20,    0x00,   (UCBRF_9+UCOS16)},          // 38.4 kb/s
            {0x15,    0x00,   (UCBRF_11+UCOS16)},         // 57.6 kb/s
            {0x0A,    0x00,   (UCBRF_14+UCOS16)},         // 115.2 kbit/s
            {0x05,    0x00,   (UCBRF_7+UCOS16)},          // 230.4 kbit/s
            {0x02,    0x00,   (UCBRS_6+UCBRF_10+UCOS16)}, // 460.8 kbit/s
            {0x15,    0x00,   (UCBRS_6)}                  // 921.6 kbit/s
    };
    
    // Baudrate indexes
    enum baud{  BAUD_ERROR, BAUD_1200, BAUD_2400, BAUD_4800, BAUD_9600, BAUD_19200,
        BAUD_38400, BAUD_57600, BAUD_115200, BAUD_230400, BAUD_460800, BAUD_921600};
    
    // Macro gets number of UART channels
    #ifdef UART0_INTFNUM
        #ifdef UART1_INTFNUM
            #define UART_NUM_INTERFACES 2
        #else
            #define UART_NUM_INTERFACES 1
        #endif
    #else
        #ifdef UART1_INTFNUM
            #define UART_NUM_INTERFACES 1
        #endif
    #endif
    
    // Rx/Tx Buffers
    #if ( UART_NUM_INTERFACES )
    static struct _UartBridge
    {
        // indicates which buffer is used by host to receive/transmit data
        BYTE inpCurrentBufferXY;
        BYTE outpCurrentBufferXY;
    
        BYTE txInProgress;
        UINT rxBufferOffset;
    
        BYTE txBuffer[TX_BUFFER_SIZE];
        BYTE rxBuffer[RX_BUFFER_SIZE];
    }UartBridge[UART_NUM_INTERFACES];
    #endif
    
    //Local functions prototypes
    VOID SetupDmaForUart0(VOID);
    VOID SetupDmaForUart1(VOID);
    
    BYTE InitUart(ULONG lBaudrate)
    {
          BYTE baudIndex;
    
        #ifdef __MSP430F550x
          //SelectPin(3,3);                         // Assign P3.3 to UCA0TXD and..
          //SelectPin(3,4);                         // P3.4 to UCA0RXD
          
          SelectPin(4,4);                         // Assign P4.4 to UCA0TXD and..
          //SetPinOut(4,4);
          SelectPin(4,5);                         // P4.5 to UCA0RXD
          //SetPinOut(4,5);
    
          PJDIR |= (RESET_PIN | TEST_PIN);
    
    #ifdef JTAG_RELEASE      
          PJDIR = BIT2+BIT1;
          PJOUT = BIT2+BIT1;
    #endif
          
          
          //Simple port mapping 
          __disable_interrupt();                    // Disable Interrupts before altering Port Mapping registers
          PMAPKEYID = PMAPKEY;
          P4MAP4 = PM_UCA0TXD;
          P4MAP5 = PM_UCA0RXD;
          PMAPKEYID = 0;
          __enable_interrupt();
          
        #endif 
        #ifdef __MSP430F563x_F663x
          SelectPin(2,0);                         // Assign P2.0 to UCA0TXD and..
          SelectPin(2,1);                         // P2.1 to UCA0RXD
        #endif 
          
    
          // configure USCI_A0 UART
          UCA0CTL1 |= UCSWRST;                    // **Put state machine in reset**
          UCA0CTL1 |= UCSSEL__SMCLK;              // SMCLK
          UCA0CTL0 = UCPEN+UCPAR;
    
          switch(lBaudrate)
          { 
              #if (RX_BUFFER_SIZE > (1200*SYS_DELAY/1000/8))
                case 1200:  baudIndex = BAUD_1200;  break;
              #endif
              #if (RX_BUFFER_SIZE > (2400*SYS_DELAY/1000/8))
                case 2400:  baudIndex = BAUD_2400;  break;
              #endif
              #if(RX_BUFFER_SIZE > (4800*SYS_DELAY/1000/8))
                case 4800:  baudIndex = BAUD_4800;  break;
              #endif            
                case 4801:
                   __disable_interrupt();
                   USB_disable();
                   Delay(100000);
                 ((void(*)(void))0x1000)();  // Call #0x1000, enter BSL
                 break;      
    
                case 4802:
                P1OUT |= BIT0;
                  // JTAG 20 work around
                  // start, all high
                  PJOUT = RESET_PIN+TEST_PIN;
                  Delay(INVOKE_DELAY);
                  Delay(INVOKE_DELAY);
                  Delay(INVOKE_DELAY);
                 
                  //Step 1
                  //RESET LOW
                  //TEST LOW
                  PJOUT = 0;
                  Delay(INVOKE_DELAY);
                    
                  //Step 2
                  //RESET LOW
                  //TEST HIGH
                  PJOUT = TEST_PIN;
                  Delay(INVOKE_DELAY);
                  
                  //Step 3
                  //RESET LOW
                  //TEST LOW
                  PJOUT = 0;
                  Delay(INVOKE_DELAY);
    
                  //Step 4
                  //RESET LOW
                  //TEST HIGH          
                  PJOUT = TEST_PIN;
                  Delay(INVOKE_DELAY);
                  
                  //Step 5
                  //RESET LOW
                  //TEST LOW             
                  PJOUT = 0;
                  Delay(INVOKE_DELAY);
                  
                  //Step 6
                  //RESET HIGH
                  //TEST LOW             
                  PJOUT = RESET_PIN;
                  Delay(INVOKE_DELAY);
                  Delay(INVOKE_DELAY);
                  Delay(INVOKE_DELAY);
    
                  baudIndex = BAUD_9600; 
                break;
              #if(RX_BUFFER_SIZE > (9600*SYS_DELAY/1000/8))
                case 9600:  baudIndex = BAUD_9600;  break;
              #endif
                case 9601:
                P1OUT |= BIT1;
                  // invoke BSL, classic
                  //Start: all high
                  PJOUT = RESET_PIN+TEST_PIN+TCK_PIN;
                  Delay(INVOKE_DELAY);
                  Delay(INVOKE_DELAY);
                  Delay(INVOKE_DELAY);
                 
                  //Step 1
                  //RESET LOW
                  //TEST LOW
                  //TCK HIGHT
                  PJOUT = TCK_PIN;
                  Delay(INVOKE_DELAY);
                    
                  //Step 2
                  //RESET LOW
                  //TEST HIGH
                  //TCK LOW
                  PJOUT = TEST_PIN;
                  Delay(INVOKE_DELAY);
                  
                  //Step 3
                  //RESET LOW
                  //TEST LOW
                  //TCK HIGH
                  PJOUT = TCK_PIN;
                  Delay(INVOKE_DELAY);
                  //Delay(20);
    
                  //Step 4
                  //RESET LOW
                  //TEST HIGH
                  //TCK LOW              
                  PJOUT = TEST_PIN;
                  Delay(INVOKE_DELAY);
                  
                  //Step 5
                  //RESET HIGH
                  //TEST HIGH
                  //TCK LOW              
                  PJOUT = TEST_PIN + RESET_PIN;
                  Delay(INVOKE_DELAY);
                  
                  //Step 6
                  //RESET HIGH
                  //TEST LOW
                  //TCK HIGH              
                  PJOUT = TCK_PIN + RESET_PIN;
                  Delay(INVOKE_DELAY);
                  Delay(INVOKE_DELAY);
                  Delay(INVOKE_DELAY);
    
                  baudIndex = BAUD_9600; 
                break;
                /* reserved for future devices invoke sequence
                case 9602: newInvoke(2); break;
                case 9603: newInvoke(3); break;
                case 9604: newInvoke(4); break;
                case 9605: newInvoke(5); break;
                case 9606: newInvoke(6); break;
                case 9607: newInvoke(7); break;
                case 9608: newInvoke(8); break;
                case 9609: newInvoke(9); break;
                case 9610: newInvoke(10); break;
                case 9611: newInvoke(11); break;
                case 9612: newInvoke(12); break;
                case 9613: newInvoke(13); break;
                case 9614: newInvoke(14); break;
                case 9615: newInvoke(15); break;
                case 9616: newInvoke(16); break;
                case 9617: newInvoke(17); break;
                case 9618: newInvoke(18); break;
                */
              #if(RX_BUFFER_SIZE > (19200*SYS_DELAY/1000/8))
                case 19200: baudIndex = BAUD_19200; break;
              #endif
              #if(RX_BUFFER_SIZE > (38400*SYS_DELAY/1000/8))
                case 38400: baudIndex = BAUD_38400; break;
              #endif
              #if(RX_BUFFER_SIZE > (57600*SYS_DELAY/1000/8))
                case 57600: baudIndex = BAUD_57600; break;
              #endif
              #if(RX_BUFFER_SIZE > (115200*SYS_DELAY/1000/8))
                case 115200:baudIndex = BAUD_115200; break;
              #endif
              #if(RX_BUFFER_SIZE > (230400*SYS_DELAY/1000/8))
                case 230400:baudIndex = BAUD_230400; break;
              #endif
              #if(RX_BUFFER_SIZE > (460800*SYS_DELAY/1000/8))            
                case 460800:baudIndex = BAUD_460800; break;
              #endif
              #if(RX_BUFFER_SIZE > (921600*SYS_DELAY/1000/8))   
                case 921600:baudIndex = BAUD_921600; break;
              #endif
                default:    baudIndex = BAUD_ERROR; break;
          }            
    
          if(baudIndex != BAUD_ERROR)
          {
              UCA0BR0 = BaudrateList[baudIndex].ucaBR0;
              UCA0BR1 = BaudrateList[baudIndex].ucaBR1;
              UCA0MCTL = BaudrateList[baudIndex].ucaMCTL;
          }
          
          //UCA0STAT |= 0x80;                   // Enable internal loopback
    
          UCA0CTL1 &= ~UCSWRST;                 // **Initialize USCI state machine**
          //UCA0IE |= UCRXIE;// + UCTXIE;       // Enable USCI_A0 Rx/Tx interrupt
    
          // SetupDmaForUart0();
          
          UCA0IE |= UCRXIE;
    
          return baudIndex;
    }
    
    #define BUFFER_SIZE 20
    uint8_t UARTtoCDC_CircularBuffer[BUFFER_SIZE];
    uint8_t UARTtoCDC_RXPtr =0;
    uint8_t UARTtoCDC_TXPtr =0;
    
    #pragma vector=USCI_A0_VECTOR
    __interrupt void USCI_A0_ISR(void)
    {
        extern volatile BYTE bDataSendCompleted_event[];
        switch(__even_in_range(UCA0IV,4))
        {
                case 0:break;                         // Vector 0 - no interrupt
                case 2:                               // Vector 2 - RXIFG
                    _NOP(); // Send data received from UART to USB
                    UARTtoCDC_CircularBuffer[UARTtoCDC_RXPtr++] = UCA0RXBUF;
                    if (UARTtoCDC_RXPtr == BUFFER_SIZE)
                    {
                        UARTtoCDC_RXPtr = 0;
                    }
                      
                      
                   // bDataSendCompleted_event[0] = FALSE;
                    //USBCDC_sendData((BYTE*)&UCA0RXBUF, 1, CDC0_INTFNUM);
                    //cdcSendDataInBackground((BYTE*)&UCA0RXBUF, 1, CDC0_INTFNUM, 0);
                    //while (bDataSendCompleted_event[0] == FALSE){};
                    UCA0IFG &= ~UCRXIFG;
                    break;
                case 4:				  // Vector 4 - TXIFG
                    __no_operation();                 // used for debugging  
                    break;                             
                default: break;
        }
    }
    
    void UARTtoCDC_serviceBuff(void)
    {
        if (UARTtoCDC_TXPtr != UARTtoCDC_RXPtr)
        {
            while (cdcSendDataWaitTilDone((BYTE*)&UARTtoCDC_CircularBuffer[UARTtoCDC_TXPtr], 1, CDC0_INTFNUM, 100000) != 0)
              ;
            UARTtoCDC_TXPtr++;
            if (UARTtoCDC_TXPtr == BUFFER_SIZE)
            {
              UARTtoCDC_TXPtr = 0;
            }
        }
    }
    
    #ifdef UART0_INTFNUM
    //------------------------------------------------------------------------------
    BYTE InitUart0(ULONG lBaudrate)
    {
          BYTE baudIndex;
    
        #ifdef __MSP430F550x
          //SelectPin(3,3);                         // Assign P3.3 to UCA0TXD and..
          //SelectPin(3,4);                         // P3.4 to UCA0RXD
          
          SelectPin(4,4);                         // Assign P4.4 to UCA0TXD and..
          //SetPinOut(4,4);
          SelectPin(4,5);                         // P4.5 to UCA0RXD
          //SetPinOut(4,5);
    
    #ifdef JTAG_RELEASE      
          PJDIR = BIT2+BIT1;
          PJOUT = BIT2+BIT1;
    #endif
          
          
          //Simple port mapping 
          __disable_interrupt();                    // Disable Interrupts before altering Port Mapping registers
          PMAPKEYID = PMAPKEY;
          P4MAP4 = PM_UCA0TXD;
          P4MAP5 = PM_UCA0RXD;
          PMAPKEYID = 0;
          __enable_interrupt();
          
        #endif 
        #ifdef __MSP430F563x_F663x
          SelectPin(2,0);                         // Assign P2.0 to UCA0TXD and..
          SelectPin(2,1);                         // P2.1 to UCA0RXD
        #endif 
          
    
          // configure USCI_A0 UART
          UCA0CTL1 |= UCSWRST;                    // **Put state machine in reset**
          UCA0CTL1 |= UCSSEL__SMCLK;              // SMCLK
          UCA0CTL0 = UCPEN+UCPAR;
    
          switch(lBaudrate)
          { 
              #if (RX_BUFFER_SIZE > (1200*SYS_DELAY/1000/8))
                case 1200:  baudIndex = BAUD_1200;  break;
              #endif
              #if (RX_BUFFER_SIZE > (2400*SYS_DELAY/1000/8))
                case 2400:  baudIndex = BAUD_2400;  break;
              #endif
              #if(RX_BUFFER_SIZE > (4800*SYS_DELAY/1000/8))
                case 4800:  baudIndex = BAUD_4800;  break;
              #endif            
                case 4801:
                   __disable_interrupt();
                   USB_disable();
                   Delay(100000);
                 ((void(*)(void))0x1000)();  // Call #0x1000, enter BSL
                 break;      
    
                case 4802:
                P1OUT |= BIT0;
                  // JTAG 20 work around
                  // start, all high
                  PJOUT = RESET_PIN+TEST_PIN;
                  Delay(INVOKE_DELAY);
                  Delay(INVOKE_DELAY);
                  Delay(INVOKE_DELAY);
                 
                  //Step 1
                  //RESET LOW
                  //TEST LOW
                  PJOUT = 0;
                  Delay(INVOKE_DELAY);
                    
                  //Step 2
                  //RESET LOW
                  //TEST HIGH
                  PJOUT = TEST_PIN;
                  Delay(INVOKE_DELAY);
                  
                  //Step 3
                  //RESET LOW
                  //TEST LOW
                  PJOUT = 0;
                  Delay(INVOKE_DELAY);
    
                  //Step 4
                  //RESET LOW
                  //TEST HIGH          
                  PJOUT = TEST_PIN;
                  Delay(INVOKE_DELAY);
                  
                  //Step 5
                  //RESET LOW
                  //TEST LOW             
                  PJOUT = 0;
                  Delay(INVOKE_DELAY);
                  
                  //Step 6
                  //RESET HIGH
                  //TEST LOW             
                  PJOUT = RESET_PIN;
                  Delay(INVOKE_DELAY);
                  Delay(INVOKE_DELAY);
                  Delay(INVOKE_DELAY);
    
                  baudIndex = BAUD_9600; 
                break;
              #if(RX_BUFFER_SIZE > (9600*SYS_DELAY/1000/8))
                case 9600:  baudIndex = BAUD_9600;  break;
              #endif
                case 9601:
                P1OUT |= BIT1;
                  // invoke BSL, classic
                  //Start: all high
                  PJOUT = RESET_PIN+TEST_PIN+TCK_PIN;
                  Delay(INVOKE_DELAY);
                  Delay(INVOKE_DELAY);
                  Delay(INVOKE_DELAY);
                 
                  //Step 1
                  //RESET LOW
                  //TEST LOW
                  //TCK HIGHT
                  PJOUT = TCK_PIN;
                  Delay(INVOKE_DELAY);
                    
                  //Step 2
                  //RESET LOW
                  //TEST HIGH
                  //TCK LOW
                  PJOUT = TEST_PIN;
                  Delay(INVOKE_DELAY);
                  
                  //Step 3
                  //RESET LOW
                  //TEST LOW
                  //TCK HIGH
                  PJOUT = TCK_PIN;
                  Delay(20);
    
                  //Step 4
                  //RESET LOW
                  //TEST HIGH
                  //TCK LOW              
                  PJOUT = TEST_PIN;
                  Delay(INVOKE_DELAY);
                  
                  //Step 5
                  //RESET HIGH
                  //TEST HIGH
                  //TCK LOW              
                  PJOUT = TEST_PIN + RESET_PIN;
                  Delay(INVOKE_DELAY);
                  
                  //Step 6
                  //RESET HIGH
                  //TEST LOW
                  //TCK HIGH              
                  PJOUT = TCK_PIN + RESET_PIN;
                  Delay(INVOKE_DELAY);
                  Delay(INVOKE_DELAY);
                  Delay(INVOKE_DELAY);
    
                  baudIndex = BAUD_9600; 
                break;
                /* reserved for future devices invoke sequence
                case 9602: newInvoke(2); break;
                case 9603: newInvoke(3); break;
                case 9604: newInvoke(4); break;
                case 9605: newInvoke(5); break;
                case 9606: newInvoke(6); break;
                case 9607: newInvoke(7); break;
                case 9608: newInvoke(8); break;
                case 9609: newInvoke(9); break;
                case 9610: newInvoke(10); break;
                case 9611: newInvoke(11); break;
                case 9612: newInvoke(12); break;
                case 9613: newInvoke(13); break;
                case 9614: newInvoke(14); break;
                case 9615: newInvoke(15); break;
                case 9616: newInvoke(16); break;
                case 9617: newInvoke(17); break;
                case 9618: newInvoke(18); break;
                */
              #if(RX_BUFFER_SIZE > (19200*SYS_DELAY/1000/8))
                case 19200: baudIndex = BAUD_19200; break;
              #endif
              #if(RX_BUFFER_SIZE > (38400*SYS_DELAY/1000/8))
                case 38400: baudIndex = BAUD_38400; break;
              #endif
              #if(RX_BUFFER_SIZE > (57600*SYS_DELAY/1000/8))
                case 57600: baudIndex = BAUD_57600; break;
              #endif
              #if(RX_BUFFER_SIZE > (115200*SYS_DELAY/1000/8))
                case 115200:baudIndex = BAUD_115200; break;
              #endif
              #if(RX_BUFFER_SIZE > (230400*SYS_DELAY/1000/8))
                case 230400:baudIndex = BAUD_230400; break;
              #endif
              #if(RX_BUFFER_SIZE > (460800*SYS_DELAY/1000/8))            
                case 460800:baudIndex = BAUD_460800; break;
              #endif
              #if(RX_BUFFER_SIZE > (921600*SYS_DELAY/1000/8))   
                case 921600:baudIndex = BAUD_921600; break;
              #endif
                default:    baudIndex = BAUD_ERROR; break;
          }            
    
          if(baudIndex != BAUD_ERROR)
          {
              UCA0BR0 = BaudrateList[baudIndex].ucaBR0;
              UCA0BR1 = BaudrateList[baudIndex].ucaBR1;
              UCA0MCTL = BaudrateList[baudIndex].ucaMCTL;
          }
          
          //UCA0STAT |= 0x80;                   // Enable internal loopback
    
          UCA0CTL1 &= ~UCSWRST;                 // **Initialize USCI state machine**
          //UCA0IE |= UCRXIE;// + UCTXIE;       // Enable USCI_A0 Rx/Tx interrupt
    
          SetupDmaForUart0();
    
          return baudIndex;
    }
    
    void newInvoke( BYTE invokeParam )
    {
    // TBD for new devices
    }
    
    //------------------------------------------------------------------------------
    #pragma vector=USCI_A0_VECTOR
    __interrupt void USCI_A0_ISR(void)
    {
        switch(__even_in_range(UCA0IV,4))
        {
                case 0:break;                         // Vector 0 - no interrupt
                case 2:break;                         // Vector 2 - RXIFG
                case 4:				  // Vector 4 - TXIFG
                    __no_operation();                 // used for debugging  
                    break;                             
                default: break;
        }
    }
    
    
    //------------------------------------------------------------------------------
    VOID SetupDmaForUart0(VOID)
    {        
            // configure DMA2
            DMACTL4 |= ROUNDROBIN;// + DMARMWDIS + ENNMI;
            
    	DMACTL1 |= DMA2TSEL__USCIA0RX;            // triger on USCIA0 receive
    	__data16_write_addr((unsigned short) &DMA2SA,(unsigned long) &UCA0RXBUF);
    	                                          // Source block address
    	__data16_write_addr((unsigned short) &DMA2DA,// Destination single address
                                (unsigned long) UartBridge[UART0_INTFNUM].rxBuffer);
    	DMA2SZ = RX_BUFFER_SIZE;           	  // Block size
    	DMA2CTL = DMADT_4 + DMADSTINCR_3 + DMALEVEL +
    			DMASBDB + DMAEN + DMAIE;  // Rpt, inc dst, enable
            
            // configure DMA1
            DMACTL0 |= DMA1TSEL__USCIA0TX;            // triger on USCIA0 transmit
            __data16_write_addr((unsigned short) &DMA1SA,// Source block address
                                (unsigned long) UartBridge[UART0_INTFNUM].txBuffer);
            __data16_write_addr((unsigned short) &DMA1DA,(unsigned long) &UCA0TXBUF);
                                                        // Destination single address  
            DMA1CTL = DMADT_0 + DMASRCINCR_3 + DMALEVEL +
                                        DMASBDB + DMAIE;	// inc src, int
    }
    #endif
    
    #ifdef UART1_INTFNUM
    //------------------------------------------------------------------------------
    BYTE InitUart1(ULONG lBaudrate)
    {
            BYTE baudIndex;
            
        #ifdef __MSP430F550x
          SelectPin(4,4);                         // Assign P4.4 to UCA0TXD and..
          SelectPin(4,5);                         // P4.5 to UCA0RXD
        #endif 
        #ifdef __MSP430F563x_F663x
    	SelectPin(8,2);                       // Assign P8.2 to UCA1TXD and..
            SelectPin(8,3);                       // P8.3 to UCA1RXD
        #endif 
            
    	// configure USCI_A1 UART
    	UCA1CTL1 |= UCSWRST;                  // **Put state machine in reset**
    	UCA1CTL1 = UCSSEL__SMCLK;             // SMCLK
    
            switch(lBaudrate)
            { 
              #if (RX_BUFFER_SIZE > (1200*SYS_DELAY/1000/8))
                case 1200:  baudIndex = BAUD_1200;  break;
              #endif
              #if (RX_BUFFER_SIZE > (2400*SYS_DELAY/1000/8))
                case 2400:  baudIndex = BAUD_2400;  break;
              #endif
              #if(RX_BUFFER_SIZE > (4800*SYS_DELAY/1000/8))
                case 4800:  baudIndex = BAUD_4800;  break;
              #endif            
              #if(RX_BUFFER_SIZE > (9600*SYS_DELAY/1000/8))
                case 9600:  baudIndex = BAUD_9600;  break;
              #endif
              #if(RX_BUFFER_SIZE > (19200*SYS_DELAY/1000/8))
                case 19200: baudIndex = BAUD_19200; break;
              #endif
              #if(RX_BUFFER_SIZE > (38400*SYS_DELAY/1000/8))
                case 38400: baudIndex = BAUD_38400; break;
              #endif
              #if(RX_BUFFER_SIZE > (57600*SYS_DELAY/1000/8))
                case 57600: baudIndex = BAUD_57600; break;
              #endif
              #if(RX_BUFFER_SIZE > (115200*SYS_DELAY/1000/8))
                case 115200:baudIndex = BAUD_115200; break;
              #endif
              #if(RX_BUFFER_SIZE > (230400*SYS_DELAY/1000/8))
                case 230400:baudIndex = BAUD_230400; break;
              #endif
              #if(RX_BUFFER_SIZE > (460800*SYS_DELAY/1000/8))            
                case 460800:baudIndex = BAUD_460800; break;
              #endif
              //#if(RX_BUFFER_SIZE > (921600*SYS_DELAY/1000/8))   
                //case 921600:baudIndex = BAUD_921600; break;
              //#endif
              default:    baudIndex = BAUD_ERROR; break;
            }            
            
            if(baudIndex != BAUD_ERROR)
            {
                UCA1BR0 = BaudrateList[baudIndex].ucaBR0;
                UCA1BR1 = BaudrateList[baudIndex].ucaBR1;
                UCA1MCTL = BaudrateList[baudIndex].ucaMCTL;
            }       
            
            //UCA1STAT |= 0x80;                 // Enable internal loopback
            
    	UCA1CTL1 &= ~UCSWRST;               // **Initialize USCI state machine**
    	//UCA1IE |= UCRXIE + UCTXIE;        // Enable USCI_A1 Rx/Tx interrupt    
    
            SetupDmaForUart1();
    
            return baudIndex;
    }
    
    /*
    //------------------------------------------------------------------------------
    #pragma vector=USCI_A1_VECTOR
    __interrupt void USCI_A1_ISR(void)
    {
    	//BYTE tmp = 0x00;
    	switch(__even_in_range(UCA1IV,4))
    	{
    		case 0:break;                     // Vector 0 - no interrupt
    		case 2:                           // Vector 2 - RXIFG
                        __no_operation();             // used for debugging
    		    break;
    		case 4:				  // Vector 4 - TXIFG
                        __no_operation();             // used for debugging
    		    break;                             
    		default: break;
            }
    }
    */
    
    //------------------------------------------------------------------------------
    VOID SetupDmaForUart1(VOID)
    {        
            // configure DMA4
            DMACTL4 |= ROUNDROBIN;// + DMARMWDIS + ENNMI;
            
    	DMACTL2 |= DMA4TSEL__USCIA1RX;                   // triger on USCIA1 receive
    	__data16_write_addr((unsigned short) &DMA4SA,(unsigned long) &UCA1RXBUF);
    	                                          // Source block address
    	__data16_write_addr((unsigned short) &DMA4DA,// Destination single address
                                (unsigned long) UartBridge[UART1_INTFNUM].rxBuffer);
    	DMA4SZ = RX_BUFFER_SIZE;           	  // Block size
    	DMA4CTL = DMADT_4 + DMADSTINCR_3 + DMALEVEL +
    			DMASBDB + DMAEN + DMAIE;  // Rpt, inc dst, enable
            
            // configure DMA5
            DMACTL2 |= DMA5TSEL__USCIA1TX;        // triger on USCIA1 transmit
            __data16_write_addr((unsigned short) &DMA5SA,// Source block address
                                (unsigned long) UartBridge[UART1_INTFNUM].txBuffer);
            __data16_write_addr((unsigned short) &DMA5DA,(unsigned long) &UCA1TXBUF);
                                                        // Destination single address  
            DMA5CTL = DMADT_0 + DMASRCINCR_3 + DMALEVEL +
                                        DMASBDB + DMAIE;	// inc src, int
    }
    #endif
    
    //------------------------------------------------------------------------------
    // DMA Interrupt Service Routine
    //------------------------------------------------------------------------------
    #pragma vector=DMA_VECTOR
    __interrupt void DMA_ISR(void)
    {
      switch(__even_in_range(DMAIV,16))
      {
        case 0: break;
        case 2: break;                      // DMA0IFG = DMA Channel 0
        case 4:                             // DMA1IFG = DMA Channel 1
          #ifdef UART0_INTFNUM
                UartBridge[UART0_INTFNUM].txInProgress = FALSE;
                CdcToUart(CDC0_INTFNUM, UART0_INTFNUM);
          #endif
        	    break;
        case 6:                             // DMA2IFG = DMA Channel 2
          #ifdef UART0_INTFNUM
                UartToCdc(UART0_INTFNUM, CDC0_INTFNUM); 
          #endif
                break;                      
        case 8:                             // DMA3IFG = DMA Channel 3
    //      #ifdef UART0_INTFNUM
    //            UartBridge[UART0_INTFNUM].txInProgress = FALSE;
    //            CdcToUart(CDC0_INTFNUM, UART0_INTFNUM);
    //      #endif
        	    break;
        case 10:                     	// DMA4IFG = DMA Channel 4
          #ifdef UART1_INTFNUM
                UartToCdc(UART1_INTFNUM, CDC1_INTFNUM);
          #endif
                break;
        case 12:                    	// DMA5IFG = DMA Channel 5
          #ifdef UART1_INTFNUM
                UartBridge[UART1_INTFNUM].txInProgress = FALSE;
                CdcToUart(CDC1_INTFNUM, UART1_INTFNUM);
          #endif
              break;
        case 14: break;                    	// DMA6IFG = DMA Channel 6
        case 16: break;                    	// DMA7IFG = DMA Channel 7
        default: break;
      }
    }
    
    #if ( UART_NUM_INTERFACES )
    //------------------------------------------------------------------------------
    // Transfers data from the UART buffer to USB_CDC
    //------------------------------------------------------------------------------
    BYTE UartToCdc(BYTE uartNum, BYTE cdcNum)
    {
        BYTE nTmp;
        UINT nCount, size;
        PBYTE pPacket;
        PBYTE pEP1, pEP2;
        PBYTE pCT1, pCT2;
        BYTE edbIndex = stUsbHandle[cdcNum].edb_Index;
                
        // do not access USB memory if suspended (PLL off). It may produce BUS_ERROR
        if ((bFunctionSuspended) ||
            (bEnumerationStatus != ENUMERATION_COMPLETE))
            return FALSE;
        
        if (UartBridge[uartNum].inpCurrentBufferXY == X_BUFFER) //get current buffer
        {   // X_BUFFER is the active EP buffer
            pEP1 = (PBYTE)stUsbHandle[cdcNum].iep_X_Buffer;
            pCT1 = &tInputEndPointDescriptorBlock[edbIndex].bEPBCTX;
            // second EP buffer
            pEP2 = (PBYTE)stUsbHandle[cdcNum].iep_Y_Buffer;
            pCT2 = &tInputEndPointDescriptorBlock[edbIndex].bEPBCTY;
        }
        else
        {  
            // Y_BUFFER is the active EP buffer
            pEP1 = (PBYTE)stUsbHandle[cdcNum].iep_Y_Buffer;
            pCT1 = &tInputEndPointDescriptorBlock[edbIndex].bEPBCTY;
            // second EP buffer
            pEP2 = (PBYTE)stUsbHandle[cdcNum].iep_X_Buffer;
            pCT2 = &tInputEndPointDescriptorBlock[edbIndex].bEPBCTX;
        }
    
        // get DMA counter
        #ifdef UART0_INTFNUM
        if(uartNum == UART0_INTFNUM)
            nCount = RX_BUFFER_SIZE - DMA2SZ;
        #endif
    
        #ifdef UART1_INTFNUM
        if(uartNum == UART1_INTFNUM)
          nCount = RX_BUFFER_SIZE - DMA4SZ;
        #endif
        
        if(UartBridge[uartNum].rxBufferOffset >= RX_BUFFER_SIZE)
            UartBridge[uartNum].rxBufferOffset = 0;
               
        if(UartBridge[uartNum].rxBufferOffset > nCount)
            nCount = RX_BUFFER_SIZE;
            
        nTmp = *pCT1;
        if(nTmp & EPBCNT_NAK)
        {
            size = nCount - UartBridge[uartNum].rxBufferOffset;
            if(size)
            {   
                TogglePin(1,1); // LED2 = RX blink
                // get packet pointer
                pPacket = UartBridge[uartNum].rxBuffer + UartBridge[uartNum].rxBufferOffset;
                
                if(size > (MAX_PACKET_SIZE-1))                // check packet size
                    size = (MAX_PACKET_SIZE-1);
                UartBridge[uartNum].rxBufferOffset += size;  // update offset
    
                
                USB_RX_memcpy(pEP1, pPacket, size); // copy data into EP X or Y buffer
                *pCT1 = (BYTE)size;
                
                // switch current buffer
                UartBridge[uartNum].inpCurrentBufferXY = (UartBridge[uartNum].inpCurrentBufferXY+1) &0x01;
            }
        }
    
        nTmp = *pCT2;
        if(nTmp & EPBCNT_NAK)
        {
            size = nCount - UartBridge[uartNum].rxBufferOffset;
            if(size)
            {   
                // get packet pointer
                pPacket = UartBridge[uartNum].rxBuffer + UartBridge[uartNum].rxBufferOffset; 
                  
                if(size > (MAX_PACKET_SIZE-1))                // check packet size
                    size = (MAX_PACKET_SIZE-1);
                UartBridge[uartNum].rxBufferOffset += size;  // update offset
                
                
                USB_RX_memcpy(pEP2, pPacket, size); // copy data into EP X or Y buffer
                *pCT2 = (BYTE)size;
    
                //switch current buffer
                UartBridge[uartNum].inpCurrentBufferXY = (UartBridge[uartNum].inpCurrentBufferXY+1) &0x01;
            }  
        }
        
        
        return FALSE;
    }
    
    //------------------------------------------------------------------------------
    // Transfers data from the USB_CDC buffer to UART
    //------------------------------------------------------------------------------
    BYTE CdcToUart(BYTE cdcNum, BYTE uartNum)
    {
        BYTE nCount;
        PBYTE pEP, pCT;
        BYTE edbIndex = stUsbHandle[cdcNum].edb_Index;
        
                
        // Is transmit in progress?
        if(UartBridge[uartNum].txInProgress)
          return FALSE;
            
        // do not access USB memory if suspended (PLL off). It may produce BUS_ERROR
        if ((bFunctionSuspended) ||
            (bEnumerationStatus != ENUMERATION_COMPLETE))
            return FALSE;
        
        // No data to transfer...
        if (!((tOutputEndPointDescriptorBlock[edbIndex].bEPBCTX |
               tOutputEndPointDescriptorBlock[edbIndex].bEPBCTY) & EPBCNT_NAK))
            return FALSE;
    
        if (UartBridge[uartNum].outpCurrentBufferXY == X_BUFFER)//get current buffer
        {
            //this is the active EP buffer
            pEP = (PBYTE)stUsbHandle[cdcNum].oep_X_Buffer;
            // how many byte we can get from endpoint buffer
            pCT = &tOutputEndPointDescriptorBlock[edbIndex].bEPBCTX;
        }
        else
        {
            //this is the active EP buffer
            pEP = (PBYTE)stUsbHandle[cdcNum].oep_Y_Buffer;
            // how many byte we can get from endpoint buffer
            pCT = &tOutputEndPointDescriptorBlock[edbIndex].bEPBCTY;
        }
    
        nCount = *pCT;
        if(nCount & EPBCNT_NAK)
        {
            nCount &= ~EPBCNT_NAK;  // clear NAK bit
            if(nCount)
            {   
                // copy data from EP X or Y buffer
                USB_TX_memcpy(UartBridge[uartNum].txBuffer, pEP, nCount); 
    
                // configure DMA
                
                #ifdef UART0_INTFNUM
                if(uartNum == UART0_INTFNUM)
                {
                  DMA1SZ = nCount;	// set size
                  DMA1CTL |=  DMAEN;  // enable
                }
                #endif
    
                #ifdef UART1_INTFNUM
                if(uartNum == UART1_INTFNUM)
                {
                  DMA5SZ = nCount;	// set size
                  DMA5CTL |=  DMAEN;  // enable
                }
                #endif
                
                // set tx status
                UartBridge[uartNum].txInProgress = TRUE; 
            }
            else
                UartBridge[uartNum].txInProgress = FALSE; 
    
            //clear NAK, EP ready to receive data
            *pCT = 0x00;
            
            //switch current buffer
            UartBridge[uartNum].outpCurrentBufferXY  = (UartBridge[uartNum].outpCurrentBufferXY+1) &0x01;
        }
        
        TogglePin(1,0); // LED1 = TX blink
        
        return FALSE;
    }
    #endif
    
    //==============================================================================
    // End of file	 uart.c
    //==============================================================================
    

    uart.h

    @A000
    82 02 01 02 80 1C C0 1C 00 1D 40 1D 80 1D C0 1D
    A1 21 00 00 00 00 07 00 FF 00 D6 C2 00 00 21 20
    00 00 00 00 07 00 FF 00 7E C8 00 00 21 22 FF FF
    00 00 00 00 CF 00 C8 C8 00 00 00 01 01 00 00 00
    00 00 FF 00 B4 C7 00 00 02 01 00 00 FF 00 00 00
    F7 00 DA C3 00 00 80 08 00 00 00 00 01 00 FF 00
    20 C8 00 00 80 06 FF 01 FF FF FF FF D0 00 FC C7
    00 00 80 06 FF 02 FF FF FF FF D0 00 D8 C7 00 00
    80 06 FF 03 FF FF FF FF D0 00 5C C1 00 00 81 0A
    00 00 FF FF 01 00 F3 00 02 C7 00 00 80 00 00 00
    00 00 02 00 FF 00 92 C5 00 00 81 00 00 00 FF 00
    02 00 F7 00 36 C7 00 00 82 00 00 00 FF 00 02 00
    F7 00 14 BD 00 00 00 05 FF 00 00 00 00 00 DF 00
    E8 C6 00 00 00 09 FF 00 00 00 00 00 DF 00 AC C6
    00 00 00 03 FF 00 00 00 00 00 DF 00 A2 C7 00 00
    02 03 FF 00 FF 00 00 00 D7 00 1C C3 00 00 01 0B
    FF 00 FF 00 00 00 D7 00 3E C8 00 00 FF FF FF FF
    FF FF FF FF 00 00 4C C8 00 00 12 01 00 02 02 00
    00 08 47 20 0B 03 00 01 01 02 03 01 09 02 43 00
    02 01 04 80 32 09 04 00 00 01 02 02 01 05 05 24
    00 10 01 05 24 01 00 01 04 24 02 02 05 24 06 00
    01 07 05 81 03 40 00 FF 09 04 01 00 02 0A 00 00
    00 07 05 02 02 40 00 FF 07 05 82 02 40 00 FF 04
    03 09 04 24 03 54 00 65 00 78 00 61 00 73 00 20
    00 49 00 6E 00 73 00 74 00 72 00 75 00 6D 00 65
    00 6E 00 74 00 73 00 22 03 4D 00 53 00 50 00 20
    00 42 00 53 00 4C 00 20 00 55 00 53 00 42 00 20
    00 54 00 6F 00 6F 00 6C 00 04 03 30 00 16 03 4D
    00 53 00 50 00 34 00 33 00 30 00 20 00 55 00 53
    00 42 00 22 03 4D 00 53 00 50 00 20 00 42 00 53
    00 4C 00 20 00 55 00 53 00 42 00 20 00 54 00 6F
    00 6F 00 6C 00 00 00 00 1A 41 0A 8D 20 06 46 10
    0A 82 00 31 41 00 21 20 00 91 15 00 B1 0A 00 E1
    05 00 71 02 00 AD 15 00 0C 
    @A21A
    01 
    @A21C
    31 40 00 34 3C 40 02 24 3D 40 9F 02 B0 13 0E C8
    3C 40 00 24 3D 40 1A A2 3E 40 01 00 B0 13 D0 C8
    B0 13 1C AD B0 13 C0 C8 1F 15 1F 42 FE 05 E0 0F
    74 3C 73 3C 04 3C 71 3C 70 3C 05 3C 60 3C F2 40
    05 00 44 25 6A 3C C2 93 43 25 17 20 1F 42 10 24
    DF 42 EC 05 00 00 92 53 10 24 1F 42 10 24 CF 93
    FF FF 03 24 E2 D2 E0 05 58 3C D2 43 43 25 B2 40
    03 00 12 24 82 43 14 24 50 3C B2 53 12 24 82 93
    12 24 10 24 1F 42 10 24 DF 42 EC 05 00 00 92 53
    10 24 92 93 12 24 41 20 82 93 14 24 3E 24 E2 D2
    E0 05 3B 3C 82 93 14 24 22 20 1F 42 10 24 DF 42
    EC 05 00 00 92 53 10 24 1F 42 10 24 5E 4F FE FF
    4E 4E 1F 42 10 24 5F 4F FF FF 4F 4F 3F F0 FF 00
    8F 10 0F DE 82 4F 14 24 82 93 14 24 02 20 E2 D2
    E0 05 1F 42 14 24 2F 53 82 4F 12 24 16 3C 1F 42
    10 24 DF 42 EC 05 00 00 E2 43 44 25 0E 3C 82 93
    0E 24 09 24 1F 42 0C 24 E2 4F EE 05 92 53 0C 24
    B2 53 0E 24 02 3C E2 42 44 25 1E 17 00 13 0C 12
    0F 12 1F 42 9A 01 E0 0F 04 3C 05 3C 06 3C 0A 3C
    0B 3C 03 43 0D 3C 03 43 0B 3C 92 C3 6E 01 A2 C3
    02 01 06 3C 03 43 04 3C 82 43 98 01 B0 13 4A C6
    3F 41 3C 41 00 13 00 13 0F 12 1F 42 DE 05 E0 0F
    15 3C 01 3C 12 3C 03 43 5F 42 87 26 4F 4F DF 42
    CC 05 73 26 D2 53 87 26 F2 90 14 00 87 26 02 20
    C2 43 87 26 D2 C3 DD 05 01 3C 03 43 3F 41 00 13
    0F 12 1F 42 0E 05 E0 0F 08 3C 07 3C 06 3C 05 3C
    04 3C 03 3C 02 3C 01 3C 00 3C 3F 41 00 13 5F 15
    4A 43 E2 B2 3E 09 05 28 B0 13 5C C3 4A 4C E2 C2
    3E 09 1F 42 32 09 3F F0 3F 00 E0 0F 84 3C 1E 3C
    82 3C 81 3C 1D 3C 23 3C 2B 3C 7D 3C 7C 3C 31 3C
    33 3C 35 3C 3D 3C 46 3C 76 3C 75 3C 4E 3C 73 3C
    72 3C 54 3C 70 3C 6F 3C 6E 3C 6D 3C 6C 3C 6B 3C
    55 3C 69 3C 68 3C 67 3C 66 3C 65 3C 03 43 63 3C
    92 B3 1E 24 60 28 B0 13 B8 C8 4A 4C 5C 3C B0 13
    4C C4 A2 B3 1E 24 57 28 B0 13 68 C7 4A 4C 53 3C
    B0 13 90 C2 A2 B2 1E 24 4E 28 B0 13 86 C8 4A 4C
    4A 3C B0 13 1C C7 47 3C B0 13 0A C1 44 3C B0 13
    DC AE B2 B2 1E 24 3F 28 B0 13 B4 C8 4A 4C 3B 3C
    B0 13 80 C4 B2 B0 10 00 1E 24 35 28 B0 13 B0 C8
    4A 4C 31 3C B0 13 50 C7 B2 B0 20 00 1E 24 03 28
    B0 13 A8 C8 4A 4C 5A 43 26 3C F2 40 80 00 21 09
    F2 40 80 00 23 09 B0 13 5C C3 1D 3C 4C 43 B0 13
    D0 AA 0A 12 C1 4C 00 00 3A 41 15 3C 4C 43 B0 13
    7C C7 0C 93 09 20 B2 B0 40 00 1E 24 0C 28 4C 43
    B0 13 B8 C5 4A 4C 07 3C 4C 43 B0 13 64 B0 0A 12
    C1 4C 00 00 3A 41 4A 93 04 24 B1 C0 D0 00 0C 00
    03 43 5A 17 00 13 0A 12 F2 D0 10 00 2B 02 F2 D0
    20 00 2B 02 B2 D0 06 00 24 03 32 C2 03 43 B2 40
    52 2D C0 01 F2 40 15 00 E4 01 F2 40 14 00 E5 01
    82 43 C0 01 03 43 32 D2 D2 D3 C0 05 F2 D0 80 00
    C0 05 F2 40 C0 00 C1 05 0D 83 1C 20 3C 80 B0 04
    32 24 3C 80 B0 04 31 24 3C 80 60 09 30 24 1C 83
    31 24 1C 83 3F 24 3C 80 BE 12 B2 24 1C 83 B2 24
    3C 80 7F 25 27 25 3C 80 00 4B 27 25 3C 80 00 4B
    27 25 34 3D 1D 83 04 20 3C 80 00 C2 24 25 2E 3D
    2D 83 04 20 3C 80 00 84 20 25 28 3D 2D 82 04 20
    3C 80 00 08 1D 25 22 3D 3D 80 07 00 1F 21 3C 80
    00 10 19 25 1B 3D 5A 43 1A 3D 6A 43 18 3D 7A 40
    03 00 15 3D 32 C2 03 43 B0 13 4A C6 3E 40 A0 86
    1F 43 3E 53 3F 63 0D 4E 0D DF 0D 93 FA 23 B0 13
    00 10 05 3D D2 D3 02 02 B2 40 06 00 22 03 3E 40
    E8 03 0F 43 3E 53 3F 63 0D 4E 0D DF 0D 93 FA 23
    3E 40 E8 03 0F 43 3E 53 3F 63 0D 4E 0D DF 0D 93
    FA 23 3E 40 E8 03 0F 43 3E 53 3F 63 0D 4E 0D DF
    0D 93 FA 23 82 43 22 03 3E 40 E8 03 0F 43 3E 53
    3F 63 0D 4E 0D DF 0D 93 FA 23 A2 42 22 03 3E 40
    E8 03 0F 43 3E 53 3F 63 0D 4E 0D DF 0D 93 FA 23
    82 43 22 03 3E 40 E8 03 0F 43 3E 53 3F 63 0D 4E
    0D DF 0D 93 FA 23 A2 42 22 03 3E 40 E8 03 0F 43
    3E 53 3F 63 0D 4E 0D DF 0D 93 FA 23 82 43 22 03
    3E 40 E8 03 0F 43 3E 53 3F 63 0D 4E 0D DF 0D 93
    FA 23 A2 43 22 03 3E 40 E8 03 0F 43 3E 53 3F 63
    0D 4E 0D DF 0D 93 FA 23 3E 40 E8 03 0F 43 3E 53
    3F 63 0D 4E 0D DF 0D 93 FA 23 3E 40 E8 03 0F 43
    3E 53 3F 63 0D 4E 0D DF 0D 93 FA 23 6A 42 8F 3C
    6A 42 8D 3C E2 D3 02 02 B2 40 0E 00 22 03 3E 40
    E8 03 0F 43 3E 53 3F 63 0D 4E 0D DF 0D 93 FA 23
    3E 40 E8 03 0F 43 3E 53 3F 63 0D 4E 0D DF 0D 93
    FA 23 3E 40 E8 03 0F 43 3E 53 3F 63 0D 4E 0D DF
    0D 93 FA 23 B2 42 22 03 3E 40 E8 03 0F 43 3E 53
    3F 63 0D 4E 0D DF 0D 93 FA 23 A2 42 22 03 3E 40
    E8 03 0F 43 3E 53 3F 63 0D 4E 0D DF 0D 93 FA 23
    B2 42 22 03 3E 40 E8 03 0F 43 3E 53 3F 63 0D 4E
    0D DF 0D 93 FA 23 A2 42 22 03 3E 40 E8 03 0F 43
    3E 53 3F 63 0D 4E 0D DF 0D 93 FA 23 B2 40 06 00
    22 03 3E 40 E8 03 0F 43 3E 53 3F 63 0D 4E 0D DF
    0D 93 FA 23 B2 40 0A 00 22 03 3E 40 E8 03 0F 43
    3E 53 3F 63 0D 4E 0D DF 0D 93 FA 23 3E 40 E8 03
    0F 43 3E 53 3F 63 0D 4E 0D DF 0D 93 FA 23 3E 40
    E8 03 0F 43 3E 53 3F 63 0D 4E 0D DF 0D 93 FA 23
    6A 42 15 3C 7A 40 05 00 12 3C 7A 40 06 00 0F 3C
    7A 40 07 00 0C 3C 7A 42 0A 3C 7A 40 09 00 07 3C
    7A 40 0A 00 04 3C 7A 40 0B 00 01 3C 4A 43 4A 93
    15 24 4A 4A 0F 4A 41 18 0F 5A D2 4F F5 A1 C6 05
    4A 4A 0F 4A 41 18 0F 5A D2 4F F6 A1 C7 05 4A 4A
    0F 4A 41 18 0F 5A D2 4F F7 A1 C8 05 D2 C3 C0 05
    D2 D3 DC 05 4C 4A 3A 41 10 01 3B 15 4A 4E 4F 4A
    5F 0E 5B 4F 02 A0 0D 93 02 24 0C 93 03 20 7C 40
    07 00 46 3D 08 42 38 F2 32 C2 03 43 C2 93 9D 26
    03 20 D2 93 9E 26 03 24 02 D8 7C 42 39 3D 4F 4A
    5F 0E 8F 93 32 24 05 24 03 43 02 D8 7C 40 03 00
    2F 3D 4F 4A 5F 0E 8F 4D 36 24 4F 4A 5F 0E 8F 4D
    38 24 4F 4A 5F 0E 8F 4C 32 24 4F 4A 5F 0E CF 93
    40 24 73 24 4E 4A 4F 4A 5F 0E 1D 4F 3A 24 4F 4A
    5F 0E 1C 4F 34 24 B0 13 62 BB 4F 4A 5F 0E 8F 93
    38 24 0F 20 4F 4A 5F 0E 8F 43 32 24 B2 B0 00 01
    1E 24 03 28 4C 4A B0 13 6C C8 02 D8 7C 40 05 00
    FF 3C 4F 4A 5F 0E 4E 4B 5E 0A 3E 50 8A 23 8F 9E
    3A 24 10 20 4F 4B 5F 0A 3F 50 8E 23 4E 4A 5E 0E
    8E 4F 3A 24 4F 4A 5F 0E 4E 4A 5E 0E 9E 4F 0A A0
    34 24 0F 3C 4F 4B 5F 0A 3F 50 8A 23 4E 4A 5E 0E
    8E 4F 3A 24 4F 4A 5F 0E 4E 4A 5E 0E 9E 4F 08 A0
    34 24 4F 4A 5F 0E 1F 4F 3A 24 6E 4F 4E 93 11 34
    7E C0 80 00 4F 4A 5F 0E CF 4E 40 24 4E 4A 4F 4A
    5F 0E 1D 4F 3A 24 4F 4A 5F 0E 1C 4F 34 24 B0 13
    62 BB 4F 4A 5F 0E 8F 93 38 24 0F 20 4F 4A 5F 0E
    8F 43 32 24 B2 B0 00 01 1E 24 03 28 4C 4A B0 13
    6C C8 02 D8 7C 40 05 00 AB 3C 4E 43 4F 4A 5F 0E
    CF 93 41 24 25 20 4F 4B 5F 0A CF 93 8A 23 44 34
    4F 4A 5F 0E 4E 4A 5E 0E 9E 4F 08 A0 34 24 4F 4B
    5F 0A 3F 50 8A 23 4E 4A 5E 0E 8E 4F 3A 24 4F 4A
    5F 0E 4E 4A 5E 0E 9E 4F 0A A0 3E 24 4B 4B 5B 0A
    3B 50 8E 23 4F 4A 5F 0E 8F 4B 3C 24 5E 43 24 3C
    4F 4B 5F 0A CF 93 8E 23 1F 34 4F 4A 5F 0E 4E 4A
    5E 0E 9E 4F 0A A0 34 24 4F 4B 5F 0A 3F 50 8E 23
    4E 4A 5E 0E 8E 4F 3A 24 4F 4A 5F 0E 4E 4A 5E 0E
    9E 4F 08 A0 3E 24 4B 4B 5B 0A 3B 50 8A 23 4F 4A
    5F 0E 8F 4B 3C 24 5E 43 4E 93 44 24 4F 4A 5F 0E
    1F 4F 3A 24 6E 4F 05 3C 4F 4A 5F 0E 1F 4F 3A 24
    6E 4F 4E 93 F9 27 4E 93 35 34 7E C0 80 00 4F 4A
    5F 0E CF 4E 40 24 4E 4A 4F 4A 5F 0E 1D 4F 3A 24
    4F 4A 5F 0E 1C 4F 34 24 B0 13 62 BB 4F 4A 5F 0E
    1F 4F 3C 24 6E 4F 4F 4A 5F 0E 8F 93 38 24 1A 24
    4E 93 18 34 7E C0 80 00 4F 4A 5F 0E CF 4E 40 24
    4E 4A 4F 4A 5F 0E 1D 4F 3C 24 4F 4A 5F 0E 1C 4F
    3E 24 B0 13 62 BB 4F 4A 5F 0E 4B 4A 5B 0E 9B 4F
    3C 24 3A 24 4F 4A 5F 0E 8F 93 38 24 0F 20 4F 4A
    5F 0E 8F 43 32 24 B2 B0 00 01 1E 24 03 28 4C 4A
    B0 13 6C C8 02 D8 7C 40 05 00 02 3C 02 D8 6C 42
    38 17 10 01 5B 15 4A 4C 4B 43 4F 4A 5F 0E 56 4F
    02 A0 4F 4A 0F 5F 07 4F 5F 06 0F 57 8F 93 2A 24
    49 20 4F 4A 0F 5F 07 4F 5F 06 0F 57 CF 93 2F 24
    3F 20 4F 4A 0F 5F 07 4F 5F 06 0F 57 DF 43 2F 24
    4F 4A 0F 5F 07 4F 5F 06 0F 57 FF 90 40 00 30 24
    21 20 4F 4A 0F 5F 07 4F 5F 06 0F 57 CF 93 2E 24
    05 20 46 46 56 0A C6 43 CA 23 04 3C 46 46 56 0A
    C6 43 CE 23 4F 4A 0F 5F 07 4F 5F 06 0F 57 5E 4F
    2E 24 5E 53 5E F3 4F 4A 0F 5F 07 4F 5F 06 0F 57
    CF 4E 2E 24 4F 4A 0F 5F 07 4F 5F 06 0F 57 8F 43
    28 24 C2 93 1E 24 04 34 4C 4A B0 13 58 C8 4B 4C
    4C 4B CC 3C 4F 4A 0F 5F 07 4F 5F 06 0F 57 CF 43
    2F 24 4F 4A 0F 5F 07 4F 5F 06 0F 57 CF 93 2E 24
    11 20 4F 4A 5F 0E 1C 4F 0C A0 49 46 59 0A 39 50
    CA 23 4F 4A 5F 0E 17 4F 0E A0 46 46 56 0A 36 50
    CE 23 10 3C 4F 4A 5F 0E 1C 4F 0E A0 49 46 59 0A
    39 50 CE 23 4F 4A 5F 0E 17 4F 0C A0 46 46 56 0A
    36 50 CA 23 4F 4A 0F 5F 0E 4F 5F 06 0F 5E BF 90
    41 00 2A 24 03 28 78 40 40 00 07 3C 4F 4A 0F 5F
    0E 4F 5F 06 0F 5E 58 4F 2A 24 6E 49 4E 93 85 34
    4E 48 4F 4A 0F 5F 0D 4F 5F 06 0F 5D 1D 4F 2C 24
    80 13 04 24 C9 48 00 00 4F 4A 0F 5F 0E 4F 5F 06
    0F 5E 5E 4F 2E 24 5E 53 5E F3 4F 4A 0F 5F 0D 4F
    5F 06 0F 5D CF 4E 2E 24 4F 4A 0F 5F 0E 4F 5F 06
    0F 5E 48 48 8F 88 2A 24 4F 4A 0F 5F 0E 4F 5F 06
    0F 5E 48 48 8F 58 2C 24 4F 4A 0F 5F 0E 4F 5F 06
    0F 5E CF 48 30 24 6E 46 4F 4A 0F 5F 0D 4F 5F 06
    0F 5D 8F 93 2A 24 49 24 4E 93 47 34 4F 4A 0F 5F
    0E 4F 5F 06 0F 5E BF 90 41 00 2A 24 03 28 78 40
    40 00 07 3C 4F 4A 0F 5F 0E 4F 5F 06 0F 5E 58 4F
    2A 24 4E 48 4F 4A 0F 5F 0D 4F 5F 06 0F 5D 1D 4F
    2C 24 0C 47 80 13 04 24 C6 48 00 00 4F 4A 0F 5F
    07 4F 5F 06 0F 57 5E 4F 2E 24 5E 53 5E F3 4F 4A
    0F 5F 07 4F 5F 06 0F 57 CF 4E 2E 24 4F 4A 0F 5F
    07 4F 5F 06 0F 57 48 48 8F 88 2A 24 4F 4A 0F 5F
    07 4F 5F 06 0F 57 48 48 8F 58 2C 24 4A 4A 0A 5A
    0F 4A 5A 06 0A 5F CA 48 30 24 4C 4B 56 17 10 01
    3B 15 21 82 0B 43 0A 43 18 43 B0 13 28 C6 B0 13
    DE C5 3E 40 C0 C6 3F 40 2D 00 3E 53 3F 63 0D 4E
    0D DF 0D 93 FA 23 D2 E3 02 02 E2 E3 02 02 3F 40
    CE 12 3E 40 13 00 3F 53 3E 63 FD 2F D2 E3 02 02
    E2 E3 02 02 3F 40 CE 12 3E 40 13 00 3F 53 3E 63
    FD 2F D2 E3 02 02 E2 E3 02 02 3F 40 CE 12 3E 40
    13 00 3F 53 3E 63 FD 2F D2 E3 02 02 E2 E3 02 02
    3F 40 CE 12 3E 40 13 00 3F 53 3E 63 FD 2F 03 43
    32 D2 01 3C 03 43 C2 93 00 24 2F 20 B0 13 CC BA
    7C 80 80 00 F7 27 5C 83 F6 27 5C 83 F4 27 5C 83
    07 24 5C 83 1C 24 6C 83 1E 24 5C 83 1A 24 EB 3F
    0E 41 0D 41 2D 53 4C 43 B0 13 38 B8 6C B2 0C 28
    4E 43 1D 43 3C 40 45 25 B0 13 26 A8 D2 B3 CA 05
    FD 2F D2 42 45 25 CE 05 B0 13 14 C4 D4 3F 03 43
    D2 3F 03 43 D0 3F 03 43 CE 3F D2 93 00 24 CB 23
    B0 13 CC BA 7C 80 80 00 0D 24 5C 83 C4 27 5C 83
    C2 27 5C 83 09 24 5C 83 54 24 6C 83 56 24 5C 83
    52 24 B9 3F 03 43 B7 3F 0E 41 0D 41 2D 53 4C 43
    B0 13 38 B8 6C B2 05 28 3C 40 45 25 B0 13 A2 B6
    4A 4C 0A 93 31 24 1A 93 0E 20 3C 40 45 25 B0 13
    34 BA 0B 4C 08 93 02 38 0B 93 26 34 1B 43 F2 40
    55 00 45 25 21 3C 0D 4A 3C 40 45 25 B0 13 04 C0
    08 4C B0 13 96 C8 00 3C 3F 40 03 0D 3F 53 FE 2F
    08 93 02 20 0B 43 07 3C 18 93 05 38 3C 40 45 25
    B0 13 34 BA 0B 4C 08 93 02 38 0B 93 04 34 1B 43
    F2 40 55 00 45 25 0A 43 1B 93 75 3B C2 43 71 26
    4E 43 0D 4B 3C 40 45 25 B0 13 86 BC 0B 43 03 43
    6A 3F 03 43 68 3F 03 43 66 3F 03 43 64 3F 03 43
    0A 12 B2 40 28 96 00 09 C2 43 9E 26 C2 43 9D 26
    C2 43 9F 26 C2 43 89 26 C2 43 8A 26 C2 43 3C 09
    B2 43 16 24 B2 43 18 24 C2 43 9C 26 C2 43 3F 09
    F2 40 80 00 21 09 F2 40 80 00 23 09 F2 40 8C 00
    20 09 F2 40 8C 00 22 09 F2 40 05 00 2F 09 F2 40
    07 00 2E 09 0D 43 86 3C 0F 4D 5F 0E 5E 4F 02 A0
    4F 4E 5F 0A FF 40 94 00 C8 23 0F 4D 5F 0E 1F 4F
    0C A0 3F 50 00 E4 5F 0B 4C 4E 5C 0A CC 4F C9 23
    0F 4D 5F 0E 1F 4F 0E A0 3F 50 00 E4 5F 0B 4A 4E
    5A 0A CA 4F CD 23 4F 4E 5F 0A FF 40 80 00 CA 23
    4F 4E 5F 0A FF 40 80 00 CE 23 4F 4E 5F 0A FF 40
    40 00 CF 23 4F 4E 5F 0A FF 40 94 00 88 23 0F 4D
    5F 0E 1F 4F 08 A0 3F 50 00 E4 5F 0B 4A 4E 5A 0A
    CA 4F 89 23 0F 4D 5F 0E 1F 4F 0A A0 3F 50 00 E4
    5F 0B 4A 4E 5A 0A CA 4F 8D 23 4F 4E 5F 0A CF 43
    8A 23 4F 4E 5F 0A CF 43 8E 23 4F 4E 5F 0A FF 40
    40 00 8F 23 0F 4D 5F 0E EF 93 03 A0 2A 20 4F 4E
    5F 0A FF 40 94 00 C0 23 0F 4D 5F 0E 1F 4F 04 A0
    3F 50 00 E4 5F 0B 4A 4E 5A 0A CA 4F C1 23 0F 4D
    5F 0E 1F 4F 06 A0 3F 50 00 E4 5F 0B 4A 4E 5A 0A
    CA 4F C5 23 4F 4E 5F 0A FF 40 80 00 C2 23 4F 4E
    5F 0A FF 40 80 00 C6 23 4E 4E 5E 0A FE 40 40 00
    C7 23 1D 53 1D 93 78 3B B0 13 CC C6 F2 40 40 00
    3C 09 C2 43 3E 09 F2 40 C4 00 3D 09 B2 40 00 96
    00 09 4C 43 3A 41 10 01 3B 15 4A 4C 4B 43 4F 4A
    5F 0E 5E 4F 02 A0 4F 4A 5F 0E 8F 93 38 24 06 20
    4A 4A 5A 0E 8A 43 32 24 4C 4B A0 3C 4F 4E 5F 0A
    4D 4E 5D 0A 5D 4D 8A 23 5D DF 8E 23 7D B0 80 00
    02 20 4C 4B 93 3C 4F 4A 5F 0E CF 93 41 24 1C 20
    4F 4A 5F 0E 1C 4F 08 A0 4F 4E 5F 0A 3F 50 8A 23
    4D 4A 5D 0E 8D 4F 3A 24 4F 4A 5F 0E 4D 4A 5D 0E
    9D 4F 0A A0 3E 24 4E 4E 5E 0A 3E 50 8E 23 4F 4A
    5F 0E 8F 4E 3C 24 1B 3C 4F 4A 5F 0E 1C 4F 0A A0
    4F 4E 5F 0A 3F 50 8E 23 4D 4A 5D 0E 8D 4F 3A 24
    4F 4A 5F 0E 4D 4A 5D 0E 9D 4F 08 A0 3E 24 4E 4E
    5E 0A 3E 50 8A 23 4F 4A 5F 0E 8F 4E 3C 24 4F 4A
    5F 0E 1F 4F 3A 24 6E 4F 4E 93 31 34 7E C0 80 00
    4F 4A 5F 0E CF 4E 40 24 4E 4A 4F 4A 5F 0E 1D 4F
    3A 24 B0 13 62 BB 4F 4A 5F 0E 1F 4F 3C 24 6E 4F
    4F 4A 5F 0E 8F 93 38 24 1A 24 4E 93 18 34 7E C0
    80 00 4F 4A 5F 0E CF 4E 40 24 4E 4A 4F 4A 5F 0E
    1D 4F 3C 24 4F 4A 5F 0E 1C 4F 3E 24 B0 13 62 BB
    4F 4A 5F 0E 4E 4A 5E 0E 9E 4F 3C 24 3A 24 4F 4A
    5F 0E 8F 93 38 24 19 20 4F 4A 5F 0E 8F 43 32 24
    B2 B0 00 01 1E 24 04 28 4C 4A B0 13 6C C8 4B 4C
    4F 4A 5F 0E CF 93 40 24 08 24 B2 B0 40 00 1E 24
    04 28 4C 4A B0 13 B8 C5 4B 4C 4C 4B 38 17 10 01
    0E 4C 0F 4D 0F 83 1C 20 3E 80 B0 04 40 24 3E 80
    B0 04 41 24 3E 80 60 09 42 24 1E 83 44 24 1E 83
    46 24 3E 80 BE 12 47 24 1E 83 49 24 3E 80 7F 25
    4A 24 3E 80 00 4B 4B 24 3E 80 00 4B 4C 24 7F 3C
    1F 83 09 20 3E 80 A0 86 5A 24 1E 83 60 24 3E 80
    5F 3B 45 24 74 3C 2F 83 04 20 3E 80 00 84 43 24
    6E 3C 3F 80 03 00 06 20 3E 80 80 1A 58 24 1E 83
    5E 24 65 3C 1F 83 04 20 3E 80 00 08 38 24 5F 3C
    3F 80 07 00 5C 20 3E 80 00 10 35 24 58 3C C2 43
    00 24 80 00 02 A5 C2 43 00 24 80 00 02 A5 C2 43
    00 24 80 00 02 A5 C2 43 00 24 80 00 02 A5 C2 43
    00 24 80 00 02 A5 C2 43 00 24 80 00 02 A5 C2 43
    00 24 80 00 02 A5 C2 43 00 24 80 00 02 A5 C2 43
    00 24 80 00 02 A5 C2 43 00 24 80 00 02 A5 C2 43
    00 24 80 00 02 A5 C2 43 00 24 80 00 02 A5 C2 43
    00 24 80 00 02 A5 C2 43 00 24 80 00 02 A5 D2 43
    00 24 0E 4C 0F 4D 7C 40 48 00 80 00 E6 B4 D2 43
    00 24 0E 4C 0F 4D 7C 40 48 00 80 00 E6 B4 D2 43
    00 24 0E 4C 0F 4D 7C 40 48 00 80 00 E6 B4 D2 43
    00 24 0E 4C 0F 4D 7C 40 48 00 80 00 E6 B4 4C 43
    10 01 B2 D0 06 00 24 03 3E 40 E8 03 0F 43 3E 53
    3F 63 0D 4E 0D DF 0D 93 FA 23 B2 40 0E 00 22 03
    3E 40 E8 03 0F 43 3E 53 3F 63 0D 4E 0D DF 0D 93
    FA 23 3E 40 E8 03 0F 43 3E 53 3F 63 0D 4E 0D DF
    0D 93 FA 23 A2 42 22 03 3E 40 E8 03 0F 43 3E 53
    3F 63 0D 4E 0D DF 0D 93 FA 23 3E 40 E8 03 0F 43
    3E 53 3F 63 0D 4E 0D DF 0D 93 FA 23 B2 40 06 00
    22 03 3E 40 E8 03 0F 43 3E 53 3F 63 0D 4E 0D DF
    0D 93 FA 23 3E 40 E8 03 0F 43 3E 53 3F 63 0D 4E
    0D DF 0D 93 FA 23 3E 40 E8 03 0F 43 3E 53 3F 63
    0D 4E 0D DF 0D 93 FA 23 3E 40 E8 03 0F 43 3E 53
    3F 63 0D 4E 0D DF 0D 93 FA 23 A2 43 22 03 3E 40
    E8 03 0F 43 3E 53 3F 63 0D 4E 0D DF 0D 93 FA 23
    3E 40 E8 03 0F 43 3E 53 3F 63 0D 4E 0D DF 0D 93
    FA 23 3E 40 E8 03 0F 43 3E 53 3F 63 0D 4E 0D DF
    0D 93 FA 23 10 01 0A 12 0E 43 0A 42 3A F0 40 00
    32 C0 40 00 3F 40 00 10 3C 90 81 3E 03 28 5D 03
    1E 43 05 3C 0C 5C 03 3C 3F 50 00 10 5D 03 3D 90
    01 02 FA 2F 82 43 60 01 B2 F0 00 FC 64 01 3D 53
    0F DD 82 4F 64 01 3C 90 77 02 03 2C 82 43 62 01
    33 3C 3C 90 E2 04 04 2C B2 40 10 00 62 01 2C 3C
    3C 90 C4 09 04 2C B2 40 20 00 62 01 25 3C 3C 90
    88 13 04 2C B2 40 30 00 62 01 1E 3C 3C 90 10 27
    04 2C B2 40 40 00 62 01 17 3C 3C 90 20 4E 04 2C
    B2 40 50 00 62 01 10 3C 3C 90 40 9C 04 2C B2 40
    60 00 62 01 09 3C B2 40 70 00 62 01 05 3C B2 F0
    F4 FF 6E 01 A2 C3 02 01 A2 B3 02 01 F8 2F 1E 93
    09 20 1F 42 68 01 3F F0 88 FF 3F D0 33 00 82 4F
    68 01 08 3C 1F 42 68 01 3F F0 88 FF 3F D0 44 00
    82 4F 68 01 02 DA 3A 41 10 01 1B 15 4B 4C 5A 43
    32 C2 03 43 B2 40 52 2D C0 01 F2 40 17 00 E4 01
    F2 40 18 00 E5 01 82 43 C0 01 03 43 32 D2 D2 43
    E0 05 F2 40 0F 00 E1 05 F2 40 81 00 E0 05 1F 83
    06 20 3E 80 A0 86 17 24 1E 83 0A 24 2B 3C 3F 80
    05 00 28 20 3E 80 80 1A 1F 24 1E 83 12 24 22 3C
    F2 E0 03 00 02 02 B0 13 0E B3 D2 D3 02 02 F2 40
    C8 00 E6 05 18 3C D2 D3 02 02 F2 40 C8 00 E6 05
    12 3C F2 E0 03 00 02 02 B0 13 0E B3 E2 D3 02 02
    F2 40 32 00 E6 05 07 3C E2 D3 02 02 F2 40 32 00
    E6 05 01 3C 5A 43 C2 43 E7 05 4B 4B 82 4B F2 05
    F2 D0 30 00 2B 02 D2 C3 E0 05 B2 40 43 24 10 24
    F2 B0 10 00 EA 05 0C 28 F2 C0 10 00 2B 02 F2 C0
    10 00 23 02 F2 D0 10 00 25 02 F2 D0 30 00 2B 02
    C2 43 44 25 4C 4A 1A 17 10 01 1B 15 F2 40 A5 00
    21 01 1E 42 2E 01 B2 F0 88 CC 2E 01 1D 42 24 01
    1A 42 26 01 82 43 2C 01 4F 4C 3F D0 00 44 82 4F
    24 01 B2 B0 10 00 2C 01 FC 2B B2 C0 10 00 2C 01
    B2 B0 20 00 2C 01 12 28 B2 C0 10 00 2C 01 82 4D
    24 01 B2 B0 10 00 2C 01 FC 2B B2 F0 88 FF 2C 01
    82 4E 2E 01 C2 43 21 01 1C 43 3B 3C 4F 4C 3F F0
    FF 00 8F 10 82 DF 24 01 B2 B0 10 00 2C 01 FC 2B
    B2 C0 10 00 2C 01 C2 4C 20 01 4F 4C 4C 4C 3C F0
    FF 00 8C 10 0F DC 3F D0 00 44 82 4F 26 01 92 B3
    2C 01 FD 2B 92 C3 2C 01 B2 F0 07 03 26 01 3A F0
    F8 FC 82 DA 26 01 B2 F0 07 03 24 01 3D F0 F8 FC
    82 DD 24 01 92 B3 2C 01 04 2C B2 B0 10 00 2C 01
    F9 2B B2 F0 88 FF 2C 01 82 4E 2E 01 C2 43 21 01
    0C 43 1A 17 10 01 0A 12 0A 4C 0C 43 5E 42 42 24
    4E 83 07 24 5E 83 1C 24 6E 83 36 24 6E 83 4C 24
    55 3C 4E 43 1D 43 0C 4A B0 13 26 A8 FA 90 80 00
    00 00 05 20 82 43 02 24 D2 43 42 24 07 3C FA 90
    A0 00 00 00 03 20 F2 40 05 00 42 24 0C 43 41 3C
    C2 43 72 26 4E 43 2D 43 0C 4A 1C 53 B0 13 26 A8
    C2 93 72 26 FD 27 5E 4A 01 00 4E 4E 5F 4A 02 00
    4F 4F 3F F0 FF 00 8F 10 0F DE 82 4F 02 24 F2 40
    03 00 42 24 0C 43 25 3C C2 43 72 26 4E 43 1D 42
    02 24 2D 53 3A 50 03 00 0C 4A B0 13 26 A8 C2 93
    72 26 FD 27 4C 43 B0 13 28 BE C2 43 42 24 1C 42
    02 24 3C 50 05 00 0D 3C 4E 43 1D 43 0C 4A B0 13
    26 A8 6C 4A 4C 4C C2 43 42 24 03 3C C2 43 42 24
    0C 43 3A 41 10 01 0A 12 21 82 5A 43 81 43 00 00
    4A 4A FA 40 03 00 A1 26 5A 53 0F 41 0E 41 2E 53
    4D 43 7C 42 B0 13 AC C1 C1 93 02 00 0B 20 E2 42
    A1 26 4A 4A CA 43 A1 26 5A 53 4A 4A CA 43 A1 26
    5A 53 41 3C 4E 43 0F 3C 7F 50 37 00 4A 4A CA 4F
    A1 26 5A 53 4A 4A CA 43 A1 26 5A 53 5E 53 2F 41
    1F 53 81 4F 00 00 5E 91 02 00 28 2C 7E 92 26 2C
    2F 41 6F 4F 43 19 4F 10 7F 90 0A 00 07 2C 7F 50
    30 00 4A 4A CA 4F A1 26 5A 53 06 3C 7F 50 37 00
    4A 4A CA 4F A1 26 5A 53 4A 4A CA 43 A1 26 5A 53
    2F 41 6F 4F 7F F0 0F 00 7F 90 0A 00 CD 2F 7F 50
    30 00 4A 4A CA 4F A1 26 5A 53 CC 3F 41 18 4E 5E
    6E 53 C2 4E A1 26 21 52 3A 41 10 01 5B 15 0A 4E
    4F 43 8D 43 00 00 8A 43 00 00 4B 4C 5B 0E 5E 4B
    02 A0 0B 42 3B F2 32 C2 03 43 48 4C 08 58 09 48
    58 06 08 59 88 93 2A 24 11 24 5F D3 48 4C 08 58
    09 48 58 06 08 59 18 48 28 24 49 4C 09 59 06 49
    59 06 09 56 18 89 2A 24 8D 48 00 00 4D 4C 5D 0E
    8D 93 32 24 0C 24 6F D3 4E 4C 5E 0E 1E 4E 36 24
    4C 4C 5C 0E 1E 8C 38 24 8A 4E 00 00 13 3C C2 93
    9D 26 10 20 4D 4E 5D 0A 5D 4D 8E 23 7D F0 80 00
    4E 4E 5E 0A 5E 4E 8A 23 7E F0 80 00 4E DD 4E 93
    01 24 6F D2 C2 93 9D 26 03 20 D2 93 9E 26 01 24
    7F 42 02 DB 03 43 4C 4F 56 17 10 01 3B 15 4A 43
    3B 40 80 23 3C 40 10 A0 02 3C 3C 50 06 00 6E 4C
    1C 53 6F 4C 1C 53 7E 93 02 20 7F 93 08 24 F2 90
    C0 00 80 23 04 24 F2 90 40 00 80 23 07 20 3C 50
    FE FF D2 B3 3E 09 24 28 4C 4A 35 3C 5E 92 80 23
    1C 20 5F 92 81 23 19 20 7D 40 C0 00 7E 40 20 00
    6F 43 0B 3C 4F 4F 08 4B 08 5F E8 9C 00 00 01 20
    4D DE 1C 53 40 19 4E 10 5F 53 7F 92 F3 2B 6D FC
    6D 9C CB 23 3C 50 F8 FF DC 3F 3C 50 0C 00 C7 3F
    18 4C 0A 00 19 4C 0C 00 B0 13 CC C8 38 90 E8 C6
    09 20 39 90 00 00 06 20 C2 93 3F 09 03 24 B0 13
    AC C8 4A 4C 4C 4A 38 17 10 01 3B 15 F2 40 A5 00
    21 01 1F 42 2E 01 B2 F0 88 CC 2E 01 1E 42 24 01
    1D 42 26 01 B2 F0 CC FF 2C 01 4A 4C 4B 4C 3B F0
    FF 00 8B 10 0A DB 3A D0 00 44 82 4A 24 01 4B 4C
    4A 4C 3A F0 FF 00 8A 10 0B DA 3B D0 00 44 82 4B
    26 01 B2 B0 10 00 2C 01 FC 2B 92 B3 2C 01 F9 2B
    B2 F0 EE FF 2C 01 C2 4C 20 01 B2 F0 07 03 26 01
    3D F0 F8 FC 82 DD 26 01 B2 F0 07 03 24 01 3E F0
    F8 FC 82 DE 24 01 92 B3 2C 01 04 2C B2 B0 10 00
    2C 01 F9 2B B2 F0 88 FF 2C 01 82 4F 2E 01 C2 43
    21 01 0C 43 38 17 10 01 0A 12 F2 C0 10 00 E0 05
    D2 D3 FC 05 82 4C 10 24 92 43 12 24 C2 43 43 25
    D2 43 44 25 E2 D3 E0 05 3C 40 40 42 3D 40 0F 00
    D2 93 44 25 0A 20 0E 4C 0F 4D 0C 4E 0D 4F 3C 53
    3D 63 0A 4E 0A DF 0A 93 F3 23 0F 4C 0F DD 0F 93
    04 24 F2 90 05 00 44 25 13 20 B0 13 96 C8 3C 40
    40 42 3D 40 0F 00 E2 B2 E0 05 0A 28 0E 4C 0F 4D
    0C 4E 0D 4F 3C 53 3D 63 0A 4E 0A DF 0A 93 F3 23
    E2 93 44 25 0A 20 82 93 14 24 05 24 1C 42 14 24
    3C 50 06 00 03 3C 2C 42 01 3C 3C 43 3A 41 10 01
    B2 B2 08 09 03 2C 7C 40 80 00 10 01 B2 B2 08 09
    06 28 A2 B3 02 09 03 2C 7C 40 81 00 10 01 B2 B2
    08 09 0C 28 A2 B3 02 09 09 28 D2 93 9E 26 06 20
    D2 93 9D 26 03 24 7C 40 83 00 10 01 B2 B2 08 09
    0C 28 A2 B3 02 09 09 28 D2 93 9E 26 06 24 D2 93
    9D 26 03 20 7C 40 87 00 10 01 B2 B2 08 09 0C 28
    A2 B3 02 09 09 28 D2 93 9E 26 06 20 D2 93 9D 26
    03 20 7C 40 84 00 10 01 B2 B2 08 09 09 28 A2 B3
    02 09 06 28 D2 93 9E 26 03 24 7C 40 82 00 10 01
    7C 40 86 00 10 01 3B 15 08 4C 09 4D 4A 4E 4F 4A
    5F 0E 5F 4F 40 24 4F 4F 4B 4A 5B 0E 1F 9B 38 24
    05 2C 4F 4A 5F 0E 5B 4F 40 24 04 3C 4F 4A 5F 0E
    5B 4F 38 24 4E 4B 0D 48 4F 4A 5F 0E 1C 4F 32 24
    80 13 08 24 4F 4A 5F 0E 4B 4B 8F 8B 38 24 4F 4A
    5F 0E 4B 4B 8F 5B 32 24 4F 4A 5F 0E 5B 9F 40 24
    11 20 4F 4A 5F 0E 5E 4F 41 24 5E 53 5E F3 4F 4A
    5F 0E CF 4E 41 24 4A 4A 5A 0E CA 43 40 24 C9 43
    00 00 0A 3C 4F 4A 5F 0E CF 8B 40 24 4B 4B 08 5B
    4A 4A 5A 0E 8A 48 34 24 38 17 10 01 1B 15 4F 43
    4E 4C 5E 0E 5E 4E 02 A0 0D 42 3D F2 32 C2 03 43
    C2 93 9D 26 03 20 D2 93 9E 26 03 24 02 DD 4C 43
    32 3C 4A 4C 5A 0E CA 93 40 24 14 24 4F 4C 5F 0E
    5F 4F 40 24 4B 4C 5B 0E 1B 4B 3C 24 CB 93 00 00
    20 34 4C 4C 5C 0E 1B 4C 3C 24 6E 4B 7E F0 7F 00
    4F 5E 17 3C 4B 4E 5B 0A CB 93 8A 23 06 34 4F 4E
    5F 0A 5F 4F 8A 23 7F F0 7F 00 4B 4E 5B 0A CB 93
    8E 23 07 34 4E 4E 5E 0A 5E 4E 8E 23 7E F0 7F 00
    4F 5E 02 DD 4C 4F 1A 17 10 01 3B 15 4F 4E 5F 0E
    5A 4F 02 A0 0D 93 03 20 7C 40 07 00 3B 3C 0F 42
    3F F2 32 C2 03 43 C2 93 9D 26 03 20 D2 93 9E 26
    03 24 02 DF 7C 42 2E 3C 4B 4E 0B 5B 08 4B 5B 06
    0B 58 8B 93 2A 24 05 24 03 43 02 DF 7C 40 03 00
    21 3C 4B 4E 0B 5B 08 4B 5B 06 0B 58 8B 4D 28 24
    4B 4E 0B 5B 08 4B 5B 06 0B 58 8B 4D 2A 24 4E 4E
    0E 5E 0B 4E 5E 06 0E 5B 8E 4C 2C 24 1E 43 5A 53
    5A 83 02 30 CA 18 0E 5E 5A 53 C2 DE 30 09 03 43
    02 DF 5C 43 38 17 10 01 5F 42 84 23 7F F0 0F 00
    4F 93 1C 20 C2 93 84 23 06 34 5E 42 20 09 7E F2
    C2 4E 8C 26 05 3C 5E 42 22 09 7E F2 C2 4E 8C 26
    5E 42 8C 26 42 19 4E 10 C2 4E 8C 26 B0 13 A2 C8
    A2 43 16 24 3C 40 8C 26 80 00 8C C6 7F 53 7F 90
    07 00 12 2C C2 93 84 23 08 34 4F 4F 5F 0A 5E 4F
    C8 23 7E F2 C2 4E 8C 26 07 3C 4F 4F 5F 0A 5E 4F
    88 23 7E F2 C2 4E 8C 26 5E 42 8C 26 42 19 4E 10
    C2 4E 8C 26 B0 13 A2 C8 A2 43 16 24 3C 40 8C 26
    80 00 8C C6 21 82 81 43 02 00 B2 B2 08 09 02 2C
    5C 43 3A 3C 92 B3 02 09 06 28 B2 B0 00 01 10 09
    02 28 4C 43 31 3C B2 40 28 96 00 09 3C 40 00 C0
    B0 13 E4 C4 B2 40 17 01 12 09 B2 40 00 03 10 09
    82 43 14 09 81 43 00 00 04 3C 2F 41 1F 53 81 4F
    00 00 B1 90 E8 03 00 00 F8 2B 1F 41 02 00 0E 4F
    1E 53 81 4E 02 00 3F 90 0B 00 05 28 B2 40 00 96
    00 09 5C 43 09 3C 82 93 14 09 E2 23 92 D3 02 09
    B2 40 00 96 00 09 4C 43 21 52 10 01 1B 15 4F 4C
    5F 0E 5E 4F 02 A0 0F 42 3F F2 32 C2 03 43 C2 93
    9D 26 04 24 03 43 02 DF 7C 42 2C 3C 4D 4C 5D 0E
    8D 93 32 24 25 20 4D 4E 5D 0A 5D 4D 8A 23 7D F0
    80 00 4A 4E 5A 0A 5A 4A 8E 23 7A F0 80 00 4D EA
    4D 93 0A 24 4B 4C 5B 0E 5D 4B 41 24 5D 53 5D F3
    4B 4C 5B 0E CB 4D 41 24 4B 4E 5B 0A CB 43 8A 23
    4E 4E 5E 0A CE 43 8E 23 4C 4C 5C 0E CC 43 40 24
    02 DF 4C 43 1A 17 10 01 3B 15 58 42 94 26 48 48
    5A 42 95 26 4A 4A 0B 43 4B EA 0B EA 8B 10 3A F0
    FF 00 8A 10 5C 42 96 26 4C 4C 0D 43 0D 4C 0C 43
    5E 42 97 26 4E 4E 0F 43 3E F0 FF 00 8E 10 0F 4E
    0E 43 0E DC 0F DD 0E DA 0F DB 0E D8 82 4E 20 24
    82 4F 22 24 D2 42 98 26 25 24 D2 42 99 26 26 24
    D2 42 9A 26 24 24 1C 42 20 24 1D 42 22 24 B0 13
    CC B1 4C 93 04 20 82 43 20 24 82 43 22 24 38 17
    10 01 5B 15 21 82 46 4E 0A 43 0B 43 4E 46 B0 13
    86 BC 5C 83 06 24 6C 83 14 24 6C 82 15 24 5C 83
    0E 24 18 41 14 00 19 41 16 00 0E 41 0D 41 2D 53
    4C 46 B0 13 38 B8 7C B2 09 28 6C 43 1B 3C 6C 43
    19 3C 7C 40 03 00 16 3C 6C 42 14 3C 5C B3 11 28
    0F 48 0F D9 0F 93 E9 27 0E 4A 0F 4B 0A 4E 0B 4F
    1A 53 0B 63 0F 99 E1 2B 02 20 0E 98 DE 2B 5C 43
    01 3C 4C 43 21 52 56 17 10 01 B2 93 16 24 31 24
    B2 90 09 00 16 24 07 28 7E 42 B2 50 F8 FF 16 24
    D2 43 9C 26 17 3C B2 92 16 24 07 2C 5E 42 16 24
    B2 43 16 24 C2 43 9C 26 0D 3C 7E 42 D2 93 8B 26
    05 20 82 43 16 24 D2 43 9C 26 04 3C B2 43 16 24
    C2 43 9C 26 4F 43 08 3C 1D 42 1A 24 4F 4F EF 4D
    78 23 92 53 1A 24 5F 53 4F 9E F6 2B C2 4E 21 09
    10 01 C2 43 9C 26 10 01 D2 C3 FC 05 F2 F0 D5 00
    FD 05 F2 D0 22 00 FC 05 82 4C 0C 24 82 4D 0E 24
    F2 40 03 00 44 25 F2 D0 12 00 E0 05 F2 90 03 00
    44 25 FC 27 E2 92 44 25 0C 20 82 4C 0C 24 1F 42
    0C 24 FF 90 1B 00 03 00 02 20 0C 43 10 01 1C 43
    10 01 F2 90 05 00 44 25 02 20 3C 43 10 01 3C 43
    10 01 0A 12 21 83 0A 42 3A F2 32 C2 03 43 B2 40
    28 96 00 09 B2 40 80 00 04 09 B2 40 40 08 08 09
    81 43 00 00 04 3C 2F 41 1F 53 81 4F 00 00 B1 90
    A0 0F 00 00 F8 2B B2 40 40 0A 08 09 B2 40 00 96
    00 09 82 43 1E 24 B0 13 72 B7 B0 13 48 C2 03 43
    02 DA 4C 43 21 53 3A 41 10 01 5E 42 23 09 7E F0
    7F 00 4E 4E 82 9E 18 24 1D 28 4F 43 09 3C 4F 4F
    1D 42 1C 24 DD 4F 70 23 00 00 92 53 1C 24 5F 53
    4F 9E F5 2B 4E 4E 82 8E 18 24 82 93 18 24 05 24
    B0 13 A2 C8 E2 43 9C 26 10 01 B0 13 9C C8 C2 43
    9C 26 10 01 B0 13 9C C8 C2 43 9C 26 10 01 F2 D0
    10 00 3C 09 C2 43 21 09 E2 93 9C 26 1E 20 B0 13
    B6 C0 C2 93 9C 26 1B 20 F2 90 20 00 81 23 17 20
    1F 42 84 23 0F 83 0B 24 1F 83 09 24 1F 83 09 24
    1F 83 07 24 1F 83 07 24 1F 83 05 24 10 01 80 00
    A4 BE 80 00 D6 C8 80 00 D4 C8 F2 D2 22 09 10 01
    0A 12 5A 42 82 23 B0 13 A2 C8 7A 90 03 00 0A 20
    5F 42 A1 26 4F 4F 82 4F 16 24 3C 40 A1 26 B0 13
    8C C6 14 3C 0C 43 04 3C 5F 4C 6F A1 4F 4F 0C 5F
    4E 4A 4A 4E 7A 53 4E 93 F7 23 5F 4C 6F A1 4F 4F
    82 4F 16 24 3C 50 6F A1 B0 13 8C C6 3A 41 10 01
    1B 15 3B 40 08 1A 09 3C CB 9C 00 00 01 20 7D 53
    5A 4B 01 00 4A 4A 0B 5A 2B 53 3B 90 FF 1A 08 2C
    CB 9C 00 00 02 20 4D 93 03 24 FB 93 00 00 EC 23
    CB 9C 00 00 07 20 DE 4B 01 00 00 00 2B 53 8F 4B
    00 00 04 3C CE 43 00 00 8F 43 00 00 1A 17 10 01
    1B 15 4B 4C 0C 43 7B F0 03 00 1A 42 20 01 3A F0
    03 00 07 3C 1A 53 0C 12 C1 4A 00 00 3C 41 B0 13
    C6 B5 4B 4B 0B 9A 02 24 0C 93 03 24 4B 4B 0B 9A
    0B 2C 4B 4B 0A 9B EE 2B 3A 53 0C 12 C1 4A 00 00
    3C 41 B0 13 96 B9 ED 3F 1A 17 10 01 B2 40 04 C6
    04 24 B2 40 00 00 06 24 B2 40 04 C6 08 24 B2 40
    00 00 0A 24 B2 F0 E0 FF 00 05 92 42 00 05 00 05
    B2 40 C0 1F 10 05 92 D3 08 05 B2 40 42 C5 04 24
    B2 40 00 00 06 24 B2 40 42 C5 08 24 B2 40 00 00
    0A 24 10 01 21 83 81 43 00 00 04 3C 2F 41 1F 53
    81 4F 00 00 B1 90 D0 07 00 00 F8 2B B2 B2 08 09
    12 2C B2 40 28 96 00 09 C2 43 9E 26 C2 43 9D 26
    82 43 02 09 B2 C0 00 01 10 09 B2 F0 FB EB 08 09
    B2 40 00 96 00 09 21 53 10 01 D2 42 24 24 92 26
    D2 42 26 24 91 26 D2 42 25 24 90 26 1E 42 20 24
    1F 42 22 24 8F 10 4E 4F 0F 43 C2 4E 8F 26 1E 42
    22 24 C2 4E 8E 26 D2 42 21 24 8D 26 D2 42 20 24
    8C 26 B2 40 07 00 16 24 3C 40 8C 26 80 00 8C C6
    82 93 82 23 1A 20 5F 42 84 23 7F F0 0F 00 4F 93
    02 20 80 00 30 C8 7F 53 7F 90 07 00 10 2C C2 93
    84 23 05 34 4F 4F 5F 0A FF D2 C8 23 04 3C 4F 4F
    5F 0A FF D2 88 23 80 00 30 C8 B0 13 62 C8 10 01
    4C 43 F2 D0 10 00 3C 09 03 3C F2 F0 FA 00 3E 09
    C2 93 80 23 03 34 D2 D3 3C 09 02 3C D2 C3 3C 09
    C2 43 9C 26 4F 43 04 3C 4F 4F CF 43 8C 26 5F 53
    7F 92 FA 2B B0 13 E8 B8 D2 B3 3E 09 E6 2F 10 01
    82 43 02 02 82 43 0A 02 B2 40 FF F0 06 02 B2 40
    00 0F 04 02 82 43 22 02 82 43 2A 02 B2 43 26 02
    82 43 42 02 82 43 4A 02 B2 43 46 02 B2 40 F9 FF
    24 03 82 43 22 03 F2 D0 03 00 04 02 10 01 5F 42
    84 23 7F F0 0F 00 4F 93 02 20 80 00 30 C8 7F 53
    7F 90 07 00 10 2C C2 93 84 23 06 34 4F 4F 5F 0A
    FF F0 D7 00 C8 23 05 3C 4F 4F 5F 0A FF F0 D7 00
    88 23 B0 13 30 C8 10 01 D2 92 87 26 88 26 17 24
    13 12 30 12 A0 86 4E 43 1D 43 5C 42 88 26 4C 4C
    3C 50 73 26 B0 13 1E BF 21 52 4C 93 F1 23 D2 53
    88 26 F2 90 14 00 88 26 02 20 C2 43 88 26 10 01
    21 83 81 43 00 00 04 3C 2F 41 1F 53 81 4F 00 00
    B1 90 D0 07 00 00 F8 2B B2 40 28 96 00 09 B2 D0
    00 04 08 09 B2 F0 F9 FF 08 09 B2 40 00 96 00 09
    21 53 10 01 D2 43 9D 26 B2 40 28 96 00 09 F2 D0
    10 00 3C 09 F2 C0 40 00 3E 09 B2 C0 00 01 10 09
    B2 D0 00 01 6C 01 F2 40 20 00 3D 09 B2 40 00 96
    00 09 4C 43 10 01 F2 D0 0C 00 4A 02 1F 42 66 01
    3F F0 8F FF 3F D0 20 00 82 4F 66 01 1F 42 68 01
    3F F0 FF F8 3F D0 00 02 82 4F 68 01 3D 40 62 02
    3C 40 20 4E 80 00 02 B4 1F 42 6C 01 3F F0 00 C0
    0F 9C 05 24 B2 F0 FF 3F 6C 01 82 DC 6C 01 B2 C0
    00 01 6C 01 05 3C B2 F0 F4 FF 6E 01 A2 C3 02 01
    A2 B3 02 01 F8 2F 10 01 4C 43 B2 B2 08 09 01 28
    5C D3 D2 93 9E 26 02 20 7C D0 20 00 A2 B3 02 09
    02 28 7C D0 40 00 D2 93 9D 26 02 20 7C D2 10 01
    7C D0 10 00 10 01 0E 93 11 24 82 4C 16 05 82 4D
    12 05 82 4E 1A 05 B2 D0 10 00 10 05 92 D3 10 05
    B2 B2 10 05 FD 2B B2 C0 10 00 10 05 10 01 B2 40
    28 96 00 09 A2 D3 02 09 B2 D0 00 04 08 09 B2 40
    00 96 00 09 03 43 03 43 03 43 03 43 03 43 03 43
    03 43 4C 43 10 01 F2 B0 40 00 33 A1 02 28 D2 43
    8C 26 D2 93 9F 26 02 20 E2 D3 8C 26 B0 13 A2 C8
    A2 43 16 24 3C 40 8C 26 80 00 8C C6 0A 12 4A 4C
    4C 4A B0 13 F8 BB 4C 93 02 20 5C 43 08 3C 4A 4A
    CA 93 A0 26 03 20 4A 4A DA 43 A0 26 5C 43 3A 41
    10 01 B0 13 5E C0 3C 40 7E 01 B0 13 8E C8 B0 13
    14 C5 5C B3 08 28 B0 13 A0 BD 4C 93 04 20 B0 13
    DC AE B0 13 6A C5 10 01 0A 12 21 83 0A 43 09 3C
    0F 4D 0F 5A E1 4F 00 00 0F 4C 0F 5A EF 41 00 00
    1A 53 0A 9E F5 2B 21 53 3A 41 10 01 B2 40 80 5A
    5C 01 32 C2 03 43 B0 13 9C C3 7C 40 03 00 B0 13
    FC C1 B0 13 B2 C4 03 43 32 D2 80 00 6C C6 B2 40
    28 96 00 09 82 43 02 09 B2 C0 00 01 10 09 B2 40
    00 96 00 09 C2 43 9E 26 C2 43 9D 26 4C 43 10 01
    32 C2 03 43 B2 40 52 2D C0 01 A2 43 C2 01 F2 40
    17 00 E4 01 F2 40 18 00 E5 01 82 43 C0 01 10 01
    82 4C 1A 24 1F 42 86 23 82 9F 16 24 05 28 82 4F
    16 24 C2 43 8B 26 02 3C D2 43 8B 26 80 00 96 BF
    B0 13 9C C8 D2 42 82 23 89 26 B0 13 30 C8 D2 93
    89 26 03 20 D2 43 9E 26 10 01 C2 43 9E 26 10 01
    3E 40 0A 00 0D 43 3C 40 28 24 B0 13 EA C7 3E 40
    10 00 0D 43 3C 40 32 24 80 00 EA C7 B0 13 9C C8
    B2 90 80 00 82 23 05 2C D2 42 82 23 3F 09 80 00
    30 C8 80 00 62 C8 B0 13 A2 C8 A2 43 16 24 C2 43
    8C 26 D2 42 8A 26 8D 26 3C 40 8C 26 80 00 8C C6
    F2 D0 10 00 3C 09 C2 43 23 09 D2 93 9C 26 02 20
    80 00 96 BF F2 D2 20 09 10 01 B0 13 A2 C8 A2 43
    16 24 C2 43 8C 26 D2 42 8A 26 8D 26 3C 40 8C 26
    80 00 8C C6 B0 13 A0 BD F2 F0 9F 00 3E 09 F2 40
    C4 00 3D 09 C2 43 9D 26 4C 43 10 01 B0 13 A0 BD
    4C 93 04 20 B0 13 DC AE B0 13 6A C5 5C 43 10 01
    4C 4C 5C 0E 8C 93 32 24 02 24 5C 43 01 3C 4C 43
    4C 4C 10 01 82 4C 1C 24 92 42 86 23 18 24 E2 43
    9C 26 80 00 A2 C8 92 93 82 23 04 20 D2 43 9F 26
    80 00 30 C8 80 00 62 C8 92 93 82 23 04 20 C2 43
    9F 26 80 00 30 C8 80 00 62 C8 0F 4C 04 3C FF 4D
    00 00 1F 53 3E 53 0E 93 FA 23 10 01 B0 13 A2 C8
    B2 40 43 00 16 24 3C 40 2C A1 80 00 8C C6 0F 4C
    04 3C CF 4D 00 00 1F 53 3E 53 0E 93 FA 23 10 01
    B0 13 A2 C8 B2 40 12 00 16 24 3C 40 1A A1 80 00
    8C C6 0F 4C 0F 5D 03 3C CC 43 00 00 1C 53 0C 9F
    FB 23 10 01 B0 13 A2 C8 92 43 16 24 3C 40 89 26
    80 00 8C C6 B2 43 16 24 C2 43 9C 26 C2 43 21 09
    10 01 B0 13 9C C8 D2 42 84 23 8A 26 80 00 30 C8
    D2 B3 3E 09 02 2C B0 13 62 C8 10 01 4C 4C DC 43
    71 26 4C 43 10 01 F2 D2 20 09 F2 D2 22 09 10 01
    4C 4C DC 43 72 26 4C 43 10 01 B2 D0 00 01 6C 01
    10 01 3C 40 94 26 80 00 90 C7 B0 13 76 C8 5C 43
    10 01 82 4C 1E 24 4C 43 10 01 E2 D2 E0 05 10 01
    F2 D2 22 09 10 01 C2 43 23 09 10 01 5C 43 10 01
    5C 43 10 01 5C 43 10 01 5C 43 10 01 5C 43 10 01
    80 00 C4 C8 80 00 BC C8 FF 3F 03 43 80 00 30 C8
    19 15 10 01 80 00 C6 C7 10 01 10 01 
    @FFD8
    72 A3 
    @FFE4
    AC A3 CA A3 
    @FFEE
    44 A2 74 A3 
    @FFFA
    3A A3 
    @FFFE
    1C A2 
    q
    

     

    Note that this is a temporary workaround, but I'll work with the tools team to get this firmware updated.

     

    Regards,

    Luis R

     

     

  • Hi Luis!

    Regarding the first post:

    Changing uart.py and bsl5.py, the msp430 python tools works now programming CC430 via Rocket msp430-bsl, but it has an odd performance. I mean that it works properly only when I execute the commands after a few moments behind resetting BSL rocket. If I connect the rocket BSL to my CC430f5137 circuit and pass more than a second, the python command doesn't runs: my circuit runs normally and never puts in BSL mode. I think that it could be any wait function or something like that. In addition, when I program the new firmware succesfully, my circuit never go out from BSL mode, even with parameter -r. This means that Rocket BSL maintain the reset line low.

    This test has been done under Windows. Under linux, my python 2.7 don't recognize several lines of the files patched and makes impossible the running of msp430 python tools, so I haven't  been able to program CC430f5137 under Linux. I think that the problem would be in the port selection, because it is different depending on OS.  I have the problem that I don't know anything about the python coding.

    With referent to second post, your firmware has enabled baudrates upper than 19200, although in BSL-SCRIPT I don't notice the new baudrates: it continues being slow. With python tool yes I notice it: is faster than bsl-scripter. Configuring baudrate at 57600 bps, with a 24KB firmware BSL-Script needs 26 seconds. On python tools, the programming takes below 10 seconds.

    With both tools, after programming, the circuit isn't reset: I must power off and then power on the circuit for start the firmware.

    Thanks again, Luis.

    BR,

    Luis

**Attention** This is a public forum