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.

MSP USB BSL - Labview

Hello,

I want to upgrade the firmware through USB by using Labview but have a problem.

- I can communicate with MSP430 with HID connection.

- I can enter USB BSL and catch the correct PID/VID

It seems possible to send command to USB BSL with Labview but I always receive "unknown command" message. At that time I only want to set the communication between MSP430 and PC so I send the "TX BSL Version" command with the following format "0x3F 01 19".

I probably misunderstood something with the BSL protocol, even if it is simple:(

Hope someone can help me:)

  • Hi Argail,

    USB BSL is a little bit different than the other Flash-based BSLs in other devices. In particular, the USB BSL that is loaded in the BSL area of flash, supports only a greatly limited set of commands because the USB stack takes up much of the 2kB of BSL flash. Therefore, what is in the USB BSL flash area by default is a limited BSL that can only write to device RAM and only supports the commands RX PASSWORD, RX DATA BLOCK FAST, and SET PC (this is why you got an unknown command response). You use this limited BSL to load an image of a larger, full-featured BSL into RAM, and then start executing this BSL from RAM to get access to all other commands and do the device programming.

    A good resource for this is the BSL User's Guide www.ti.com/lit/pdf/slau319 see the note below table 3-5 about USB BSL. The section at the end in chapter 5, Differences between devices and bootstrap loader versions, also makes mention of this.

    The zip file www.ti.com/lit/zip/slau319 contains the BSL Scripter software (slau319/BSL_Files/BSL Scripter). You can look at Demo Scripts/5529_Application_Download/script.txt to see an example of the sequence of commands used to first load the RAM based BSL (also provided in the same folder) and then to start that RAM based BSL and use it to load the rest of your code into flash. You could modify it to simply try TX_BSL_VERSION right after the second MODE 5xx USB, which is where the code is entering the RAM USB BSL.  If you want to see in more detail what is happening byte-by-byte, you can add the command "VERBOSE" to the top of script.txt so that you can observe the bytes going back and forth between the PC and the device, and run the BSL_scripter.exe calling this script.

    As a note, the BSL Scripter Source code is also included in the SLAU319 zip file, which can also be a useful resource to look at.

    Hope this helps,

    -Katie

  • Excellent!

    Thank you for those clear explanation, I haven't read the "life insurance's like" foot page note;)

    I think I have all information now.

  • OK, I can program the MSP through Labview! but  still have a "problem":

    Is it possible to reset the device from BSL, so the normal code can run and the device being enumerated with the custom PID?

    I want to fully test functionality after having the device programmed.

    - I've tried to load the reset vector inside the PC but doesn't do the job:(

    - I'm imagining writing a special handler inside the programmed code to , place this line at a specified address and call this address with the BSL command, is it looking weird? I'll try with PMMSWBOR too, which seems more adequate.

    Update: I can't place code in a specific memory

    - .c file:

     #pragma CODE_SECTION(forceReset, "mysegment")

    void forceReset(void)
    {
    PMMCTL0=PMMPW+PMMSWBOR;
    }

    - linker memory:

    MYSEGMENT : origin = 0x4400, length = 0x0080
    FLASH : origin = 0x4480, length = 0xBB00
    FLASH2 : origin = 0x10000,length = 0x14400

    - linker sections:

    mysegment : {} > MYSEGMENT

    All compiler optimizations are disabled, code and data model set to small, but there is nothing in the .txt compiled file

  • Hi Argail,

    Argail said:
    OK, I can program the MSP through Labview!

    Awesome!

    Argail said:

    I want to fully test functionality after having the device programmed.

    - I've tried to load the reset vector inside the PC but doesn't do the job:(

    - I'm imagining writing a special handler inside the programmed code to , place this line at a specified address and call this address with the BSL command, is it looking weird? I'll try with PMMSWBOR too, which seems more adequate.

    Actually, you don't even need to put code in your project to reset the part. You can simply have the BSL write directly into the PMMCTL0 register with the value for setting the PMMPW + PMMSWBOR bits.

    You can find the address of the PMMCTL0 register, by looking at the device datasheet: www.ti.com/lit/gpn/msp430f5529 p. 37 you can see Table 20 PMM Registers Base Address: 0120h. And since PMMCTL0 has offset 00h (it's the first register), this means the PMMCTL0 register is at address 0x0120. We need to set this register to = PMMPW + PMMSWBOR, which is 0xA504 if you check the PMMCTL0 register bits in the user's guide www.ti.com/lit/pdf/slau208

    So you can make your own TI-txt file like this:

    @0120
    04 A5
    q

    You can just make this in a text editor and save it. Now have your BSL Scripter or Labview BSL program this file as the last step of your program. It should cause a software BOR reset and your code should reset.

    I don't know how you implemented your Labview BSL host - you could also just hardcode it with a command to write 0xA504 into address 0x0120 instead of having to make a file.

    Hope this helps,

    -Katie

  • That's very clever! and perfectly works:)

    Thanks a lot, you're great.

**Attention** This is a public forum