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.

Invoke the USB BSL by user USB HID software

Other Parts Discussed in Thread: MSP-GANG

I’m working on a project with the MSP430F66xx device.

In this project  I need to Invoke the USB BSL by user USB HID software

 

If I do like this in the code, the device switch to BSL HID mode:

-------------------------------------------------

VOID main(VOID)

{

    WDTCTL = WDTPW + WDTHOLD;                      // Stop watchdog timer   

    Init_StartUp();                                                     //initialize device

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

    USB_init();                                                          // Init USB

-------------------------------------------------

 

 

But if I put the ((void (*)())0x1000)()  command into the switch(USB_connectionState()) -> case ST_ENUM_ACTIVE block like this:

-------------------------------------------------

if(!(strcmp(wholeString, "Enter BSL HID Mode")))                                  // Compare to string #2, and respond

{

   strcpy(outString,"Entering BSL HID Mode");                                         // Prepare the outgoing string

   sendData_inBackground((BYTE*)outString,strlen(outString),1,0);      // Send the response over USB

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

 }

-------------------------------------------------

the device stops somewhere but does not change to BSL HID mode

 

How do I switch to HID BSL when the device is plugged into “normal” HID USB?

Any hint or feedback is highly appreciated

 

Med venlig hilsen/ Regards

Steffen kristensen

Larsen & Brusgaard

  • Have you tried using sendData_waitTilDone() function, for sending "Entering BSL HD Mode" phrase right before invoking BSL, instead of the sendData_inBackground() to see if the device switches to HID BSL mode properly?

    Regards,

    Bhargavi

  • Hi,

    Thanks for the reply.

    The sendData_waitTilDone() function didn’t fix it, it’s still not entering BSL USB mode.

    Regards

    Steffen Kristensen

     

     

     

     

     

  • It is possible that it is a problem with the crystal you are using. There was a problem with my chip using the CDC api with the 64 pin target board from TI, the crystal does not stabilize causing the device to not enumerate. I have no idea if this is even a possible problem for you, but I figured I would throw it out there for you to check out. My device would go into BSL mode no problem it would just lag forever until I would touch the crystals capacitors which caused it to stabilize. I think this might be a problem with the drive the MSP430 is providing the crystal in BSL mode, but I could be wrong.

    Best of luck,

    NJC

    ___________________

    msp430launchpad.com

  • Hi Steffen,

    Could you try clearing the GIE bit (disabling interrupts) before invoking BSL from application firmware? It is possible that since the user firmware is jumping into the BSL memory space with the GIE bit enabled, if there are any pending interrupts then the code execution jumps back to the application firmware space (where the ISRs are located) and so the device is not entering BSL mode properly.

    Regards,

    Bhargavi

  • Hi Bhargavi,

    Thanks for the reply.

     

    Even with clearing the GIE bit it’s not working.

    When not using GIE, I can trace the code beep into the USB interrupts, but somewhere it’s lost.

    When using GIE the code jumps to 0xFFFC and is lost.

     

    I have found a way of fixing it. It’s not nice and I’m not proud of it, but it’s working.

    When I need to go to USB BSL, I write a unique string into flash, start the watchdog and get a reset.

    After a reset and before entering HID USB, I look for this string, and if it’s there I jump to 0x1000 and enter BSL USB

    It works but again it’s not nice code.

     

    Regards

    Steffen kristensen

  • Hi Steffen,

    my understanding is:

    1. You are running your HID (or other USB stack).
    2. You want to call the standard USB-BSL (based HID protocol).

    Important is to understand there are two different USB stacks, even both could be HID, so you have to finish one before start another.

    Clean way to switch to USB-BSL is:

    1. Disable current running USB stack by USB_disable()
    2. Disable global interrupt;
    3. Jump to 0x1000.

    Your workaround works because the reset by watchdog disables USB module, but you can do it manually, as above.

    Please let me know if it helps.

    Regards,
    Rosty

     

  • I am using 5528 part and TI's 64pin USB target board. I did everything sugguested above, but the after I called

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

    the code jumped back to start of my application instead of BSL, it is effectively just peformed a reset. What can I do to fix it? thanks!

  • Hi graviton,

    is the board powered from USB cable during call of BSL? The BSL will reset device by the VBUS_Off event.

    Regards,
    Rosty

  • i use my programm to control the msp-gang programmer,when i use the usb interface it is work good.but when i use the rs-232,i can not connect the programmer,if anyboday can tell me why?because my any computer can not install the driver for the programmer through the usb.so i must use the rs-232,thanks very much.

  • maybe because of the parameter of the rs-232,can anybody tell me how to set it?thanks.

**Attention** This is a public forum