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.

MSP430F5510: USB Keypad interface is not working after some time

Part Number: MSP430F5510
Other Parts Discussed in Thread: MSP430F5529

Hi guys,

   I am interfacing the custom keypad with MSP430F5510 using USB protocol. I am using the reference example given in github below link:

But the keypress is happening for every time properly till some time. randomly the controller is hanging (that in the sense it is not coming out from the sleep) so no keypresses are happing. i tried to find out many ways to do it. But in the debug mode i tried hour together with debug sesion. I'm not getting any hang at that time. once i remove debugger and i'm trying as separate, that time i am getting problem like that.

Sometimes even it will work for full day. but by next day end it will get hang. please give some suggestion

  • Hello,

    Thank you for your post. Can you please share which version of the USB API that you're using? Also,  I'm not sure if the GitHub link contains our unmodified source code from our USB Keyboard Using MSP430™ Microcontrollers app note, so I'd recommend trying our code and see if the issue still exists. You can download it from the link below.

    Based on your description, it sounds like the device is not waking up properly. In debug mode, I suspect that the debug session is preventing the device from sleeping which prevents the CPU from getting turned off. Perhaps the code from GitHub is not handling the USB states properly.

    Regards,

    James

    MSP Customer Applications

  • For the benefit of our community, this issue seems to be related to the issue in the following thread.

    Regards,

    James

    MSP Customer Applications

  • Hello Raj,

    The code disables all interrupts prior to going to sleep and because of this the program is not coming out of sleep mode when keypress occurs.  You can resolve this issue in one of two ways, either by commenting out the __disable_interrupt() in TI_USBKBD_main.c file or by adding __enable_interrupt() prior to going to sleep in the following 'if' condition:

    if ((TI_USBKBD_Report_CanSleep() == TRUE_t))

    Regards,

    Arthi  

  • Hi Arthi,

    Thank you for your valuable reply. Have some more questions...
    1) If this can solve my issue, then how the code is executing for some hours with enabling the interrupts before going to sleep?
    2) Moreover, I'm using UNMI_ISR only. It is non-maskable. any time it can interrupt irrespective of interrupt mask register settings. I'm not sure with this point. you can correct me for this point.
    But really thankful for your suggestions..
  • Hi Arthi and James

      I found the issue where my code get stuck. I'm getting kUSBHID_intfBusyError status from the USBHID_sendReport routine. the routine USBHID_sendReport is called at TI_USBKBD_Report_Update() routine.

    And I found some discussions also about this issue in one the Lauchpad user guide at the section3.5.9. i attached the link below.

    MSP430F5529 LaunchPad™ Development Kit user guide

    Now According to that discussion i can't remove and plug in the USB connection with my host since it is a fixed layout track connection. So How can i handle this error wisely with software design itself. Share some suggestions about this.

  • If this kUSBHID_intfBusyError is the actual issue. then how the normal keyboard is working without getting any halt issues? is there any tweak should bemade to get out of this???
  • Hi Prithvi,

    It looks like the device stays in interface busy state and does not get out of this state even after the report has been sent.  So I noticed that function call USBHID_handleSendCompleted() in file usbEvenHandling.c file, is always returning FALSE.  Can you set that to always return TRUE and see if that helps.  When set to TRUE the device will exit sleep mode.

    Regards,

    Arthi

  • Hi Arthi,
    Thank you so much for your answer. I found some other alternative. if I'm getting that kUSBHID_intfBusyError in TI_USBKBD_Report_Update() routine in while loop, Inside while loop i made watchdog password violation reset to my microcontroller and begin all my USB initialization. With that I'm able to communicate with host without doing power cycling in device. But, I'm missing one keypress at that moment.
    That is not the big issue. And i tried what you have told in last reply, but i'm not able to resolve it. Anyways thank you Arthi and James
  • Hi Arthi and James,
    I need you guys help again. Here, i finished my project succesfully. but, while programming it is taking too much of time to program. i found the cause that is because of the project is COFF based project. if my project is elf project than it is taking less than 5 seconds to program.

    i tried the following steps.
    1. i changed the the COFF to ELF in general option in project properties, it throwed me an error on temprary file created while debug process.
    2. Then i changed Driverlib to the latest driverlib bcoz i thought that driverlib is for coff support.
    3. then it affected the USB API which unknwn definitions, so i updated to latest one,
    4. then all the errors gone, i updated the function names according to new usblib430.
    But, now there is nor error but when debugging, the msp430 is not sending the key value to the host. and the USBHID_SEND_COMPLETE is returned at the first time call of function call(USBHID_sendReport()) on TI_USBKBD_Report_Update();
    At the second time call, the USBHID_sendReport() returns USBHID_INTERFACE_BUSY_ERROR only. the code halts there only for all the times.
    Is there any easy way for changing woriking COFF project to ELF project with 16.9.4 or 4.4.5 compiler support?
  • Hi Prithvi Raj,

    Not sure what you are trying to do here.  However I think an easy way for you to go back to ELF based project is to re-download the MSP430USBDevelopersPackage and import the project you used to start of your application with or download the example from Resource Explorer.  Then you can just copy over your application code to the example.  The driverlib and USB APIs will be set back to the original.

    Regards,

    Arthi

**Attention** This is a public forum