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.

MSP430F55x with USB and bootloader

Other Parts Discussed in Thread: MSP430F5529, MSP430F5527, MSP430FR5969

Hi all,

I am experiencing some design with the MSP430F5529.

For my design, I would like to program the MSP directly from the USB module (not from JTAG).
I have seen some designs (for example, page 59 of SLA278C) with a mechanical button from VUSB to PUR pin (through a 100R resistor). Is this hardware configuration mandatory to access the BSL from USB ? Or can I just put a 100R resistor from VUSB to PUR without button to enable programming through USB ?

Has anyone experienced the MSP430F55xx programming through USB ?

Thanks for your answers.

Regards,
Vincent.

  • Vincent,

    I think if you don't have a button you won't be able to boot in "normal" mode. In other words when you program your MCU you will need to restart it to run your new firmware code but your controller will keep going to BSL mode. This is why you would need a switch, so you can connect PUR pin to VBUS only when you want to program it.

    Mario

  • Hi Vincent,

    The MSP430F552x devices (with integrated USB module) by default come with the USB BSL (Boot-Strap Loader). The BSL on MSP430 can be used to either program the MSP430 memory for the first time or for subsequent firmware upgrades.

     USB BSL on the MSP430F552x devices can be invoked by any one of the three possible ways:

    1. Resetting an empty (non-programmed) device will invoke the BSL automatically when the USB voltages (VBUS, VUSB) are present.
    2. If the device already has application firmware present in the flash, then pressing the USB BSL switch (between the VUSB to PUR pin, through a 100R resistor) and connecting the USB cable to the PC/host (that is resetting the device) will invoke the BSL
    3. User firmware in the device calling the BSL

     The BSL switch is required in cases where the device is programmed with the user firmware and the user firmware is corrupted and doesn’t function properly. In this situation, the USB BSL switch can be used to invoke USB BSL to get the device into BSL mode and do a firmware upgrade.

     So in the case where a device with firmware already programmed into it has to be re-programmed, the USB BSL switch has to be present and pressing this enables PUR pin to be pulled high (to Vusb 3.3V) and the device detects this as a valid BSL invoke during reset.

    Hope this helps!

    Regards,

    Bhargavi

  • Bhargavi,

    How do you invoke USB BSL using firmware? I would like to be able to jump to BSL and do upgrade and then jump back. Is there a bit I can set/clear ? Any documentation explaining that?

    Thanks

    Mario

  • Perfect answer Bhargavi, thanks a lot !

    Just one more question : do you know what's the purpose of R11 on page 59 of http://focus.ti.com/lit/ug/slau278c/slau278c.pdf ?
    The 1Mohm resistor from ground to DP sounds like a pull-down resistor, but one some other designs this resistor was not present, so I'm wondering ...

    Any idea ?

    Regards.

  • Hi Vincent,

    The 1Mohm R11 resistor in the schematic is a pull-down resistor that is required keep the PUR pin from floating on reset and when the device is checking if a valid BSL invoke has occurred. By not populating the 1Mohm resistor, there are chances that the device may come up in BSL mode, even though its not invoked. So its strongly recommended that the pull-down R (R11) is populated.

    Regards,

    Bhargavi

  • ok I see, then why connecting the pull-down resistor to PUR AND DP, and not only PUR ?

  • Hi Mario,

    When protected, the BSL memory cannot be read/jumped to from a location external to BSL memory. This is done in order to make the BSL more secure against erase, and to also prevent erroneous BSL execution. However, if the entire BSL memory space were protected in this way, it would also mean that application code could not call the BSL in any way, such as an intentional BSL startup or using certain public BSL functions. The Z-Area is a special section of memory designed to accommodate these conflicting requirements.

    The Z-Area is a section of BSL memory, between addresses 0x1000 and 0x100F, which can be jumped to and read from external application code. It functions as a gateway since it can then jump into any location within the BSL memory. The default TI BSL uses this area for jumps to the start of the BSL, and for jumps into external public functions.

    Regards,

    Bhargavi

     

     

  • So if I were to start USB BSL from my application code how would I do that?

    And how would I get back to my application code?

    Since BSL responds to certain commands there would have to be a command that would allow me to jump to my application code.

    When I worked with ARM processor it had a bit in one of the registers that if cleared and processor was rebooted would jump to BSL. Then after downloading firmware I set the same bit and rebooted and I was back to my application code.

    I can't find any info on "Z-area" in the datasheet, if you have any documents that could help I'd appreciate it.

     

    Thanks

    Mario

     

  • Hi Mario,

    You should be able use JMP instruction to jump to the Z area (section of BSL memory between addresses 0x1000 and 0x100F) to enter the USB BSL from application code. Applying the exit sequence (on TEST and RESET pins - in non-USB BSL applications) is the cleanest way to exit the BSL mode. This resets the device (clear RAM memory and peripheral registers) and the device starts execution from the address present at the 0xFFFE memory location.

    There is no single bit/register modification that allows entering and exiting BSL mode. "Z-area" is a more BSL specific term and is not present in the device datasheet. There are plans to release  "Custom BSL" documentation and this document would include "Z-area"  definition.

    Regards,

    Bhargavi

  • Hi Bhargavi,

    Could you please give me some brief indication on when the "Custom BSL" doc is planned to be released?

    Thanks and regards

    Tomas

  • Thomas,
    its already on the web http://focus.ti.com/general/docs/litabsmultiplefilelist.tsp?literatureNumber=slaa450

    Regards,
    Thomas Mitnacht

     

  • I am using the MSP430F5529 for a product.  I tried entering the Z-Area by a couple of methods from my application code.  I haven't been able to get it to work.  I have tried it with and with out the JTAG adapter attached with no luck.  With the JTAG adapter attached the Program Counter changes to 0XFFFE after I set the Program Counter to 0x1000.

    Thanks,

     Paul

  • Hi Paul,

    Could you attach section of your code where you try to enter the Z-Area? Also, could you check if the BSL on the device you are working with, is not erased (for e.g. while trying to program a custom BSL or something?). In the meanwhile, I shall check if we have example code that shows how to enter the Z-area from application code.

    Regards,

    Bhargavi

  • Bhargavi said:

    Hi Paul,

    Could you attach section of your code where you try to enter the Z-Area? Also, could you check if the BSL on the device you are working with, is not erased (for e.g. while trying to program a custom BSL or something?). In the meanwhile, I shall check if we have example code that shows how to enter the Z-area from application code.

    Regards,

    Bhargavi

     

    Here is the code you requested. 

    void CMD_UpgradeSoftware(void)
    {

        typedef void (* __data16 functionpointer)(void);
        pointerint vect;

        const functionpointer bsloader = (functionpointer)(0x1000);

        //send the interrupt vector.
        for(vect = 0xFFE0;vect <= 0xFFFF; vect++)
        {
            SendByte(*((uint8_t *)vect));
        }

        //Send Line end
        SendTermination();

        //send OK
        SendOK();

        //flush the TX buffer interrupts are going down soon
        FlushTXBuffer();

        //wait for the buffer to flush.
        Wait(1);

        //disable interrupts
        _DINT();

        // Latest attempt to get BSL running.
        SYSBSLC &= ~(SYSBSLPE | SYSBSLOFF);

        //last attempt to run BSL
        asm("MOV.W #0x1000,PC");

        //2nd attempt to get BSL running.
        //bsloader();

        //1st attempt to get BSL running.
        //execute the UpgradeShell
        //((functionpointer)(0x1000))();
    }

  • Hi Paul,

    Here are the code lines used to jump to BSL mode from Application C code. You could try using this:

    #define BSL_IMAGE_ADDR            0x1000

     // Jump to BSL mode

    ((void (*)())BSL_IMAGE_ADDR)();

    On executing the above instruction the BSL mode is invoked.

    Regards,

    Bhargavi

  • Isn't the BSL area treated as vacant memory space after BSL exited on the 5xx devices?

    I just read something like that in the vacant memory section of the users guide.

  • Jens-Michael Gross said:

    Isn't the BSL area treated as vacant memory space after BSL exited on the 5xx devices?

    I just read something like that in the vacant memory section of the users guide.

    I found the problem with the BSL.  I was using an X430F5529 REV A   part.  I used an Elprotronic Flash Pro430 to download the BSL on REV A and REV C part and found significant changes in the BSL memory content.  I found executing address 0x1000 on a REV C part works but not on a REV A part.  I then copied the BSL from a REV C  to a REV A part and found it worked perfectly after that.  In my code I did disconnect and disable the USB interface before making the call to the BSL.  I don't know if that is strictly required but probably a good idea.

    -Paul 

  • Hi,

              I m doing project  on 'single chip pulse oximeter' using MSP430FG437.  So i need technical support on this project from u.Can you help me?

     

     Regards

    Srinivasan

  • Hi Bhargavi,

        Thanks for the explanation.

    I would be using USB BSL for one of my product based on msp430F5527.I would like to know the invoking & implementation procedure for usb bsl.

     I have downloaded  "Firmwaredownloader.exe" from the ti web. and want bring my mcu bsl mode by sensing a key press.I want to know....

    1) Do i require all that USB API , Stack etc... to be included in my firmware code only for USB BSL purpose ?

    2) If i simply code and compile a project file as below: [ Assuming that device ia already programmed thru JTAG mode for the code below.]

    #include <MSP430F5527.h>

    void main()

    {

               //initialize device port

                                  while(1)

                                 {

                                             if(setBslFlag == 1)

                                            {

                                                 //disable interrupt

                                                ((void (*)())0x1000)(); //jump to BSL start address

                                            }

                                             if(keyPressDetected)

                                                      setBslFlag = 1;

                                  }

    }

                  and  upload this file thru' TI's update firmware GUI after connecting my device to PC thru USB Cable.

    Are the above steps sufficient for updating device firmware thru' BSL Mode ?

    Regards,

    Ars

  • Hi all,

    I was able to get the jump into to the Z-Area working.  My problem turned out to be a buggy version of the BSL loaded on pre-production devices.  I fixed the problem by loading a good production version of the BSL into the pre-production devices.  The production devices work great.

    There are two ways to enter the BSL. 

    1). Jump instruction into the Z-area described by the user guide.

    2). Erase the interrupt vectors in flash and reset.

    Thanks,

    Paul

     

    void Upgrade(void)
    {

        typedef void (* __data16 functionpointer)(void);

        const functionpointer bsloader = (functionpointer)(0x1000);

        USB_disconnect();
        USB_disable();

        /* wait for the buffer to flush. */
        Wait(1);

        /* disable interrupts */
        _DINT();

        /* jump to bootstrap loader. */
        bsloader();

    }

  • Hi Bhargavi
    Is there any sample C codes from on ULP advice for MSP430F5529?I need c codes for MSP430F5529LP Like ULP advice codes written for MSP430FR5969(inefficient,efficient,most efficient) LP.Is there any ULP advice case Study for MSP430F5529?
    Thanks in advance
    Beeresh

**Attention** This is a public forum