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.

MSP430F5529: Device Firmware Upgrade thru' TI's Factory USB BSL on Receiving a string from communication on USB from my pc application s/w

Part Number: MSP430F5529
Other Parts Discussed in Thread: MSP430WARE, MSPWARE

Hello ,

I am facing .."USB device not recognized" error on my PC when I try to do firmware upgrade from within my mcu firmware( SOFTWARE METHOD ).My implementation & idea as follows :

a. We use 24 MHz X2 crystal.

b. My MCU application code uses USB to communicate to our PC application as a normal function.To initiate F/W upgrade, PC application will send a string on usb communication.

c. upon receiving the string( let's say "USBBSL") MCU application will disconnect usb and jump to USB BSL location at 0x1000 . i am using TI's USB API.

     if( Received string == "USBBSL")

      { 

             USB_reset();

             USB_disconnect();

             __disable_interrupt();

             ((void (*)())0x1000)();

     }

d. after executing the above i get the error . and  TI 's  "MSP430 USB Firmware Upgrade Example " GUI  shows "No device connected" 

e. My assumption is that after executing code as in (c) ....MCU should go to TI's Factory USB BSL area and wait for TI's F/W upgrade example GUI to get the device detected.I am following SLAA452C doc.  

Please note by H/W method i.e  by holding PUR pin high by a jumper.. &..connecting USB to the MSP device , I was successfully able to do F/W upgrade.

Please can any one has a solution or point out which is missing in my process.....pls

Thanks & Regards,

Ars

  • Hi Ars,

    I will look into this and get back to you shortly.

  • Hi Ars,

    I copied your code into my USB HID project running on an MSP430F5529.

    When I execute the same instructions you use, I am using the python firmware upgrader GUI to connect to the BSL.

    You can find this in MSP430Ware, in the usblib430\Host_USB_Software\Python_Firmware_Upgrader.

    Try this GUI and see if you have the same issue.

  • Hi Dennis,

    Thanks for the Reply.

    Dennis Lehman said:

    Hi Ars,

    I copied your code into my USB HID project running on an MSP430F5529.

    My USB application uses CDC class...and i have this subjected issue after i jump to usb bsl area

    As i mentioned, i also used TI's Firmware upgrader GUI only.

    Thanks & Regards,

    Ars

  • Hi Dennis / TI USB or USB Boot loader expert Team,

    Any update on solution  to my case above ......

    This matter is very urgent for my project.

    I am getting "USB device not recognized" error........ and as a result not able to find any TI device connected when i try jumping usb bsl area.

    Please look into this !!

    Regards,

    Ars

  • Hello Ars,

    Sorry - I have been out of office and was thinking someone from the community might jump in to help you.

    I will dig back into this on Monday.

  • Dennis Lehman said:

    Hello Ars,

    Sorry - I have been out of office and was thinking someone from the community might jump in to help you.

    I will dig back into this on Monday.

    Hi dennis/TI Team,

    can you update any solution for the issue i have raised.

    please understand the urgency of matter.

    rgds,

    Ars

  • Hi Ars,

    Yes, I understand.  I have reached out to our USB guru to help out with this issue.  He will respond shortly.

  • Ars,

    Please refer to the MSP430 Flash Devices Bootload users guide.

    See section 3.8.1.

    You may need to disconnect the USB stack and clear the TimerB peripheral if it is being used by your application.  Also, if you have any other peripherals that can cause an interrupt, you should disable these as well.

    For example

    __disable_interrupt();

    Before jump to BSL application.

  • Hi Dennis,

    Thanks for the reply !

    Dennis Lehman said:

    You may need to disconnect the USB stack and clear the TimerB peripheral if it is being used by your application.  Also, if you have any other peripherals that can cause an interrupt, you should disable these as well.

    For example

    __disable_interrupt();

    Before jump to BSL application.

    Please see my original post...i think  i was following the same.Anyway , Now i added few more and tried. but no success.

    Once received a string from usb application of mine ( CDC class used ) Before jumping to BSL location (0x1000)  i am doing ..in code :

    __disable_interrupt(); // Global Interrupt Disable 
    
    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
    
    USB_disconnect(); // USB disconnect
    TB0CCR0 = 0; // Timer B_0 Disable TB0CCR2 = 0; TB0CCTL2 = 0; TB0CTL = 0; TA0CCTL0 = 0; // Timer A_0 Disable TA1CCTL0 = 0; // Timer A 1 Disable UCA0CTL1 |= UCSWRST; UCA0IE = 0x00; // UART Interrupt Disable UCA1CTL1 |= UCSWRST; UCA1IE = 0x00; // UART Interrupt Disable __delay_cycles(800000); // Delay 800ms ((void (*)())0x1000)(); // Call USB BSL

    And after that i open the "MSP430 USB Firmware Upgrade Example" GUI ...expecting a "Found 1 Device"  so that Upgrade Firmware button can be clicked....but No Device Found.

    Instead i am getting " USB Device not Recognized " ERROR.

    Please tell me is it possible the way i have explained to upgrade firmware or not ? Am i missing something ? For my project field upgrade by software method is only possibility.

    Can you or TI USB guru ....please check the same process working ?

    Regds,

    Ars  

  • Hi Ars,

    After some experimentation I started with example project C1_ledOnOff found in the MSPWARE under the USBLIB430/MSP430_USB_SOFTWARE/MSP430_USB_API/examples/CDC_virtualCOMport and stripped everything out except the USB portion and added your code.  See attached code.

    I use the button on P1.1 on the 5529LP to generate and interrupt and set a flag.  In my while() loop I look for that flag and execute your code.

    At the same time I have the MSP430 USB Firmware Upgrade PYTHON GUI running.

    Before I press the button the GUI shows USB VID:PID 2047:0200 not found ( this is the default VID/PID for device in BSL mode)

    After pressing the button on the 5529 LP I do File>rescan and new message says ready...

    So perhaps try using that project and substitute the main.c attached here and see if you duplicate what I have done.

    2425.main.c
    #include <string.h>
    
    #include "driverlib.h"
    
    #include "USB_config/descriptors.h"
    #include "USB_API/USB_Common/device.h"
    #include "USB_API/USB_Common/usb.h"                 // USB-specific functions
    #include "USB_API/USB_CDC_API/UsbCdc.h"
    #include "USB_app/usbConstructs.h"
    
    /*
     * NOTE: Modify hal.h to select a specific evaluation board and customize for
     * your own board.
     */
    #include "hal.h"
    
    bool g_bEnterBSL = false;
    
    /*  
     * ======== main ========
     */
    void main (void)
    {
        WDT_A_hold(WDT_A_BASE); // Stop watchdog timer
    
        // Minumum Vcore setting required for the USB API is PMM_CORE_LEVEL_2 .
        PMM_setVCore(PMM_CORE_LEVEL_2);
        USBHAL_initPorts();           // Config GPIOS for low-power (output low)
    
        // ADDED THIS CODE TO USE P1.1 AS INTERRUPT (BUTTON ON LAUNCHPAD)
        P1DIR &= ~GPIO_PIN1;  //making this an input for the button.
        P1OUT |= GPIO_PIN1;   //must set output = 1 to enable 'pullup'
        P1REN |= GPIO_PIN1;
    
        P1IFG &= GPIO_PIN1;
        P1IE |= GPIO_PIN1;
        P1IES |= GPIO_PIN1;
        P1IFG = 0;
    
        USBHAL_initClocks(8000000);   // Config clocks. MCLK=SMCLK=FLL=8MHz; ACLK=REFO=32kHz
        USB_setup(TRUE, TRUE); // Init USB & events; if a host is present, connect
    
        __enable_interrupt();  // Enable interrupts globally
        
        while (1)
        {
            
            if(g_bEnterBSL == true)
            {
                // ARS CODE
                __disable_interrupt(); // Global Interrupt Disable
    
                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
                USB_disconnect();         // USB disconnect
                TB0CCR0  = 0;          // Timer B_0 Disable
                TB0CCR2  = 0;
                TB0CCTL2 = 0;
                TB0CTL   = 0;
                TA0CCTL0 = 0;           // Timer A_0 Disable
                TA1CCTL0 = 0;           // Timer A 1 Disable
                UCA0CTL1 |= UCSWRST;
                UCA0IE = 0x00;          // UART Interrupt Disable
                UCA1CTL1 |= UCSWRST;
                UCA1IE = 0x00;          // UART Interrupt Disable
                __delay_cycles(800000); // Delay 800ms
                ((void (*)())0x1000)(); // Call USB BSL
    
            }
    
            // Check the USB state and directly main loop accordingly
            switch (USB_getConnectionState())
            {
                // This case is executed while your device is enumerated on the
                // USB host
                case ST_ENUM_ACTIVE:
                case ST_PHYS_DISCONNECTED:
                case ST_ENUM_SUSPENDED:
                case ST_PHYS_CONNECTED_NOENUM_SUSP:
                case ST_ENUM_IN_PROGRESS:
                default:;
            }
    
        }
    }
    
    // ===============  PORT_1_ISR == FOR DEBUGGING
    #pragma vector=PORT1_VECTOR
    __interrupt void PORT1_ISR (void)
    {
    
      g_bEnterBSL = true;
      P1IE = 0;
      P1IFG = 0;
    
    }
    
    /*  
     * ======== UNMI_ISR ========
     */
    #if defined(__TI_COMPILER_VERSION__) || (__IAR_SYSTEMS_ICC__)
    #pragma vector = UNMI_VECTOR
    __interrupt void UNMI_ISR (void)
    #elif defined(__GNUC__) && (__MSP430__)
    void __attribute__ ((interrupt(UNMI_VECTOR))) UNMI_ISR (void)
    #else
    #error Compiler not found!
    #endif
    {
        switch (__even_in_range(SYSUNIV, SYSUNIV_BUSIFG))
        {
            case SYSUNIV_NONE:
                __no_operation();
                break;
            case SYSUNIV_NMIIFG:
                __no_operation();
                break;
            case SYSUNIV_OFIFG:
                UCS_clearFaultFlag(UCS_XT2OFFG);
                UCS_clearFaultFlag(UCS_DCOFFG);
                SFR_clearInterrupt(SFR_OSCILLATOR_FAULT_INTERRUPT);
                break;
            case SYSUNIV_ACCVIFG:
                __no_operation();
                break;
            case SYSUNIV_BUSIFG:
                // If the CPU accesses USB memory while the USB module is
                // suspended, a "bus error" can occur.  This generates an NMI.  If
                // USB is automatically disconnecting in your software, set a
                // breakpoint here and see if execution hits it.  See the
                // Programmer's Guide for more information.
                SYSBERRIV = 0; //clear bus error flag
                USB_disable(); //Disable
        }
    }
    
    
    
    
    
    

  • Hi Dennis,

    Thanks for your response.

    Dennis Lehman said:
    So perhaps try using that project and substitute the main.c attached here and see if you duplicate what I have done

    I will try this.

    In the meantime...i tried  Plan B in the following way and it looks working.

    1. After receiving the string from USB communication in a variable ( declared it __no_init ) , I did Soft Reset of Micro ( Not Powered OFF )

    2. As the variable will not be initialized to zero , it will retain the previous value.On power up in main() i just checked the value and if it matches the required one then jump to BSL area else My normal application will run

    This way Device was detected  and  programmed with TI Firmware Upgrade GUI.

    Can you please comment on this ? Any cons with the above approach.

    Regarding My original post and referring to your attached code , One significant difference is I was not handling UNMI_ISR . is it the something doing the mess?

    In this context , for my normal usb application ...sometimes i find msp430 device not responding to pc usb.in that case i need to disconnect usb as well as board power.Next first connect the board power and then connect PC usb.This process makes MSP430 to responds PC USB.Why this happens ? can any action be taken in Firmware side....you recommend!

    Regards,

    Ars

       

  • Ars,

    In general I don't see a problem with your method.  Quite good I might add.  Don't know what your end application is (safety, medical, etc).  If so, you probably don't want to completely rely on this.

    That said, yes, it probably wouldn't hurt to handle the UNMI interrupts.  If you don't I believe you end up in a trap.  Without a debugger you won't be able to know this. There is also a comment regarding the SYSUNIV_BUSIFG that may/may not affect you.  I all my experience with the F5529 I have never hit that one.

    Regarding the behavior you describe it sounds like the 430 quits responding (Maybe hit a trap?).  Simply disconnecting the USB cable won't reset the MSP.  That happens when you cycle power on the board.  From this it sounds like your application is "SELF POWERED", ie gets power from another source, not VBUS on the USB cable - correct? I know there are some settings in the descriptors.c that indicate to the HOST that the device is self powered.  I don't recall all the details and may have to grab our USB guru.

    Remind me if you created your USB application from scratch or used one of the TI USB examples and the TI descriptor tool?

  • Hi Ars,

    I haven’t heard from you for a couple of days now, so I’m assuming you were able to resolve your issue.
    If this isn’t the case, please click the "This did NOT resolve my issue" button and reply to this thread with more information.
    If this thread locks, please click the "Ask a related question" button and in the new thread describe the current status of your issue and any additional details you may have to assist us in helping to solve your issues.

  • Hello Dennis,

    Appreciating your support.

    The method 1 what i tried regarding my original post did not resolve my issue.subsequently ..same method  as you informed worked on your board( may be a 5529 LP) with your pc.But in my case it didn't. As I shared in my  last post ..the Method 2 worked for me and i have no other choice but to go with Method 2.So if there is no other possibility then we can close the current thread on this bsl topic.

    Next....regarding my last discussion about sometimes msp430 usb stops responding.And most of the time while my device(msp430f5529 board) is powered on , hot pluggng of pc usb stops responding.even disconnecting/connecting doesn't solve.Only way out is the sequence  ..."disconnect usb -> switch off msp board power then -> power msp board and then connect pc usb cable to board

    Dennis Lehman said:
    Remind me if you created your USB application from scratch or used one of the TI USB examples and the TI descriptor tool

    Yes you are correct.My board has it's own supply(+5V , +3V) from smps . and +5V is connected to VBUS pin.

     I have taken reference from TI USB examples CDC  ( C0_SimpleSend , C1_LedOnOff ). Yes But i have generated descriptors.c , descriptors.h & .inf file using TI descriptor tool as suggested by TI documents.

    If you have any solution from TI's USB guru or link to them regarding this case above, will be good. Otherwise you may close this particular thread.

    Thanks & Regards,

    Ars

  • Hi Ars,

    I read through "Starting a USB Design Using MSP430" and "USB Field FIrmware Updates...".  If you haven't already, it might be worth scanning through these and compare to what you are doing, just in case.

**Attention** This is a public forum