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.

CCS/MSP430F5529: Software access to bootloader

Part Number: MSP430F5529
Other Parts Discussed in Thread: MSP430F5659, MSP-TS430PN80USB

Tool/software: Code Composer Studio

I've been reliably triggering this device's bootloader via software for a long time without problems.

I've just done a minor board respin, but don't think I've changed anything significant in terms of the bootloader.

However, when I instruct the device (new board) to trigger the bootloader, it dismounts from USB, but instead of then mounting as a HID device ready for new firmware, it remounts as a CDC device.

The software is the same. An old board still performs correctly. A hardware triggered bootload still works on the new board.

Any ideas what I could have done to make the software bootloader command fail?

  • Alex,

    Are you changing the PC to 0x1000 to jump to the BSL?
    When SW jumping to the BSL, is USB already connected?
    Did you make changes to the USB circuitry from your board spin?
    How are you interacting with the USB BSL on the host side? Is it through the BSLscripter?
  • JH, yes, my software disconnects the USB, stops interrupts and then makes the jump to 0x1000, USB is connected. I use the TI firmware updater example to upload the new firmware. The new board should be identical as far as USB, power etc. are concerned, I've been checking the schematics and can't see anything that has changed. The process has worked fine for 6 years, I've never seen this fault before. Legacy boards were processor rev. C, the new ones rev. K, I've checked the errata for anything to do with this symptom. Hardware bootloader (PUR high at power up) still works on the new boards. The code is identical. I'm puzzled.
  • Alex,

    Would you be able to desolder an old rev MCU and replace it with a new rev on a legacy board (or do the opposite i.e. old MCU rev on new PCB)? This would tell you a lot about what the issue is and would limit the possible culprits.

  • I did consider this as a last resort. I have my original Dev board somewhere, featuring ZIF socket, I will try both processors in that. The errata lists some BSL fixes, surely TI wouldn't have broken this function?
  • OK, I've just tried bare chips in the ZIF socket of my MSP-FET430U64 dev board. 

    Rev.C and Rev.E chips work correctly.

    The Rev.K  parts on my new build DO NOT work correctly.

    The virgin chip comes up as a HID device which I can load firmware into. However a software BSL call (PC to 0x1000) fails, the part simply restarts as a CDC device. Physically pulling PUR to Vcc during power up does access the bootloader.

    I have a batch of dud units. Suggestions? How to get TI assistance on this?

  • My assembly house has confirmed the parts source as Farnell, Order Code 1866822.
  • Alex,

    Since the newer devices entered USB BSL correctly via the HW invocation, and they seem to be working fine otherwise, this leads me to believe this is a SW issue and not a HW issue. Looking from the revisions you are dealing with, a lot of USB and BSL fixes have been implemented. It could be an incompatibility with the version of the USB BSL on the newest chips versus your normal SW.

    A few things I would try:

    • Before entering BSL via SW entry, make sure to reset peripherals the USB BSL uses to a reset state (Timer B, USB,etc.).
      • These peripherals need to be reset to default states before SW entry. this is due to the fact that the BSL was built on the assumption that you just went through a Reset and the  peripherals it uses are in default states. This is not the case when doing SW entry as the registers are kept in the last set state instead of default. The BSL User Guide was updated recently to include all the peripherals it uses, so these adjustments can be made.
    • Make a simple bare program that just enters USB from SW entry after a certain timeout or button push.
      • This would be used as a test to make sure the simplest SW is working correctly.
    • Update BSL tot he newest version
      • We periodically make updates to the BSL that may have not made it to the newest revision of the chip yet. Updating the BSL could fix some issues that have already been worked around.

  • Jace, as I'm currently working on Smartfusion & PIC, and coded the MSP430 over six years ago, can you direct me to some app notes as guidance for:
    resetting peripherals the USB BSL uses to a reset state
    updating the BSL
    I didn't really want to make changes to the code at this late stage, on a tried and validated product.
  • I'm looking at MSP430BSL_1_00_12_00.zip and the only BSL images for the 5529 part appear to be i2c or uart bootloaders. Don't I need a USB BSL image?
  • Alex,

    for the BSL Image, within the zip, navigate to 5xx_6xx_Released_BSL_Images -> MSP430F552x_550x_Family -> USB BSL. This folder contains the latest BSL image as well as the previous one for those devices. You can check the BSL FLASH User Guide (http://www.ti.com/lit/slau319 ) to see which version is loaded into each revision of the chip you have.

    We do not have any app notes specifically for what you are asking. The relevant information is contained within the BSL FLASH User Guide mentioned above. You could see some value in general BSL updates from the following app notes though.
    Creating a Custom Flash-Based Bootloader (http://www.ti.com/lit/slaa450 )
    Starting a USB Design Using MSP430 MCUs (http;//www.ti.com/lit/slaa457 )

    Another option I didn't present above is you could potentially downgrade the USB BSL version in the newest revision chips to the same image used in your alder revisions. However, this is not recommended as you could potentially see conflicts due to silicon changes within the USB peripherals between the different revisions. Its something you could try though.
  • My mistake, I was looking in MSP430F522x, I'm going number-blind! I am feeling somewhat overwhelmed at the moment, I've two other jobs requiring urgent attention and now I've got to hack around my TI processor.
  • Jace, I've gone back to square 1, demo app "C1_LedOnOff" (where my app began) on the MSP-FET430U64 tool. I've added the USB BSL access code from slau3190.pdf page 28.

    On a Rev.K part, this code works and I can trigger the bootloader succesfully.

    This points the finger at Timer B, because the demo app only uses Timer A, whereas my code uses Timer B as the main Tick timer.

    Therefore advice please - what exactly do I need to do to reset Timer B to a condition in which it will not upset the Bootloader? Simply stopping the timer didn't work.

  • I've tried setting TB0CTL, TB0CCTL0 and TB0CCR0 (the only timer registers I modify) back to datasheet defaults of zero, prior to calling the bootloader. My code still bounces straight back to CDC mode.
  • Hello Alex,

    You should reset TimerB registers to their default come up from reset state indicated within the User Guide for the device. It is also recommended to disable the GIE bit as interrupts can disturb the BSL as well. Additionally, for USB BSL devices, it is recommended to disconnecting the USB Stack as well. More information about this can be found in section 3.8.1 within the Flash BSL User Guide (www.ti.com/lit/slau319 )
  • As stated in my last post, I've done all of this, timer registers restored to datasheet default values, and suggested code fragment from the BSL app note to disable interrupts and disconnect USB. It still exhibits the fault. What has changed in the bootloader so my code no longer works? What other resources does the BSL need?

  • "TI thinks resolved" at the head of this thread - what does this mean? This is as yet in no respect resolved.
  • Alex,

    I outlined what the BSL needs in my last reply. Namely it needs TimerB and the USB stack disconnected if it was already used before being called. Also, disabling the GIE is advised as interrupts could interrupt the BSL process. Other than that, the only thing I can think could be an issue is the VCORE settings. The USB BSL changes the clock speed to 8MHz and should change the VCORE level to level one. Of course, it may assume the VCORE is at standard reset level of 0. There shouldn't be an issue if you are at a higher level of VCORE and clock, but it is something to test out. RAM is cleared when going to BSL so that shouldn't be an issue.

    One debug effort that can be done is to comment out sections of your code and try to go to SW BSL to see what settings are affecting your entry. As you stated, TimerB is suspect so if there is any way you can not use/setup TimerB in your project  (temporarily) and see if the problem persists. this could give us some clue as to what is causing the issue.

    The "TI Thinks Resolved" was pressed earlier in our conversation as I had thought I had gotten a solution to you. If you look at that particular reply, you can reject this notion. Obviously the issue is not resolved yet and I am still working with you to try to resolve it.

  • I am using the full code fragment from the BSL document;

    __disable_interrupt();
    USBKEYPID = 0x9628; // Unlock USB configuration registers
    USBCNF &= ~PUR_EN; // Set PUR pin to hi-Z, logically disconnect from host
    USBPWRCTL &= ~VBOFFIE; // Disable VUSBoff interrupt
    USBKEYPID = 0x9600; // Lock USB configuration register
    __delay_cycles(500000);
    ((void (*)())0x1000)(); // Call BSL

    and additionally resetting Timer B to reset condition, no joy. I was going to switch to Timer D, but of course this isn't present in my part. That only leaves Timer A. I'm using an 8MHz clock and Vcore level 3. I'm still hacking around in the hope of a breakthrough.

  • I've tried all the fixes I can think of without rebuilding my application from scratch, no joy. It has been solid for six years through various revisions (certainly C and E) only to break on rev K. I don't have the skills or resources to analyse what has been broken. If I send the main body of my application can somebody at TI run it on the dev tool and help me to find out what has changed?
  • Alex,

    Unfortunately, we cannot offer that kind of service at this time. We can continue to help you debug and offer suggestions of where to look for the issue.

    Can you re-check the errata differences between the revisions you were using versus new revision in regards to what your application uses? There has to be a connection between a bug fix that changes how your application behaves which is affecting the BSL SW entry.

    Two other tests that could be done is the following. Read out the BSL binary for the older revision and program it into the newer revision part with your normal application. And then do the opposite (new BSL revision code into older revision device). This should give some insight if the issue was a silicon fix or a BSL fix that is causing the issue.
  • Jace, designer support is a key factor in my choice of supplier, I had thought to evolve the design towards the MSP430F5659 to give more memory, in the absence of an MSP432 USB part. However, given that you no longer have field engineers, and I'm left to figure out my own problems caused by a TI chip revision, I'm not so sure. I'll carry on with the diagnosis but a bit more proactive help from TI would have been nice.

  • I've dumped out the full register set for both the simple 'LED ON/LED OFF' demo, and my code, immediately prior to accessing the bootloader. I've added a routine to set some critical registers in my code back to the values that work in the simple code, especially timers & interrupts.
    Still no joy. How can I get assistance in diagnosing this?
  • The "TI Thinks Resolved" was pressed earlier in our conversation as I had thought I had gotten a solution to you. If you look at that particular reply, you can reject this notion. Obviously the issue is not resolved yet and I am still working with you to try to resolve itI can't find the 'reject' option anywhere in these posts. 

  • Alex,

    I saw that you were able to look at register differences and make the changes and the issue is not resolved. Have you tried the BSL firmware swap I suggested earlier? This would be a helpful debugging point.
  • I'm going to need some pointers on that, it is delving deeper into the Msp430 entrails than I really wanted to.

  • Alex,

    the Custom BSL app note (http://www.ti.com/lit/450) goes intot he most detail here, and the accompanying SW download contains the latest and previous BSL binary image. I would test the newest Binary image on the newer rev device in case there is a bug fix pushed that fixes your issue. you could then try the newest image on an older rev device. this one may fail though due to code and revision incompatibility. you could then read the image off an older rev that you have and place it on the newest rev part. This should work, but also has a possibility of failing due to the big revision jump you are making. you can read out the BSL image with or ID (CCS/IAR), but the Elprotronic Lite FET-PRO 430 maybe an easier tool to do so with.

    Like I said before, the app note above goes into great length on how to program a BSL into the BSL memory area, but the easiest way is just to combine the binaries of the BSL image with your SW. This works as they are both in different memory spaces. You will have to enable the binary output within CCS/IAR manually though (TI-TXT output). You can then splice in the BSL binary image and use the Elprotronic tool again to load the combined binary image. You do need to make sure the correct options are done so you can load the BSL memory area.
  • An update on this problem. Comparing behaviour of the development board running a basic code example and my board with my code, led me to study once again the schematics in detail. My board is derived from the dev board (MSP-TS430PN80USB) but I have optimised the 3V3 decoupling. Increasing this on my board from 10uF to 47uF fixes the bootloader problem.

    Scoping the USB supply and MSP-regulated 3V3, I can see the internal regulator interrupting the supply during the switch from CDC to HID device. With 10uF, this dips by 1V5, with 47uF by less than 800mV - for a glitch of about 500uS. This was obviously enough to crash out of the bootloader. 

    I can see this behaviour of Rev.K silicon. I can see no 3V3 glitch on the earlier silicon.

    Can you explain this?

**Attention** This is a public forum