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.

Program stops working after USB unplug

Other Parts Discussed in Thread: MSP430F5529

I'm currently using the MSP430F5529 mcu in order to analyze and detect/recognize gestures (like a handshake). The system is able to read a few templates from an SD card, capture a live gesture (with an IMU), and successfully compare the live gesture with the templates and return the results.

The program is able to load and run fine after running Debug mode from CCS. However, after unplugging the USB, and then pluggging back in, the system no longer functions correctly. I noticed that the heartbeat monitor does not light up when its supposed to however it does seem that my program is still implemented on the system. Through external debugging measures, like flashing LEDs to indicate the read of the SD card and when a gesture is currently being captured, I can see that my code is still implemented. The code performs fine every time after loading from CCS but not after unplugging the USB and replugging in.

Thoughts?

Thanks in advance

  • at a quick check, I would ask you to see if the Watch dog timer is halted or running.

  • I can verify that I do in fact set the watchdog (WDTCTL) at the start of my program. I am unsure though if there is a physical way to test the functionality of the watchdog. 

  • did u set WDTCL ?? I think u should hold it 

    	// Disable WTD
    	WDTCTL = WDTPW + WDTHOLD;

    if it is other way set , change them to this 

  • thanks for the quick reply. I set and hold the watchdog exactly like that

  • Hi,

    Do you see the device in Device Manager when you re-plug the USB cable?  Also are you powering your device from USB or is it externally being powered?  If you disabled interrupts, have you re-enabled them?    When you say that the program works fine when device is connected to CCS..does that mean that as long as CCS is in debug/run mode your program works correctly?  What happens when you stop the debugger?  Does the program continue to work?

     

    Regards,

    Arthi Bhat

  • Yes, device manager properly recognizes the USB cable after it has been disconnected and reconnected. This system will hopefully be able to be externally powered in a few weeks however, for now, will be USB powered. I do believe that I re-enable all the interrupts I use after disabling them. I will verify this though. Thanks for the suggestion.

    Yes, as long as CCS is in debug/run mode, the program functions as expected. When I stop the debugger, the program does continue to still function as expected. It is only when I unplug the device from power, then power it back on, does it exhibit the issues described above. 

  • It can happen that you don’t have properly initialize a variable which locks or long delay your program from running. During a debug session all RAM is cleared but not when you just boot the MCU.

    Also check if the RESTART connection from the USB emulator not is holding the MCU (normally not, but…).

  • Thanks for the reply guys. I've managed to get the system working now. Even though the heartbeat monitor does not light up, I've verified the functionality of the system after plugging back in. The thing that may have been tricking me is that for some reason, the first gesture capture after plugging in is not registered but all subsequent gestures are fine. This and a combination of resetting the system using the external reset on the MCU may have solved my issue.

    Thanks!

  • Hey Al1230,

    Glad to hear that , you have resolved your issue. Cheers :).
    Will you please close this thread by clcikingon verify answere. As you have resolved this issue by your self check, Verify answer in your post. plese.

    This helps in sorting out threads and other threads to show up. Cheers.

**Attention** This is a public forum