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: MSP430WARE USB Examples get stuck in USB_setup function when using a different crystal on X2!

Part Number: MSP430F5529

Hello I am having the same problem I am using a 12Mhz crystal, and my software get stuck in the same position as Nima mentioned in his post, I used the line that he mentioned but didn't help, it still getting stuck .

Please if you have any suggestion let me know

  • Hello Tomas,

    Thanks for making a new post and linking to the old post. As Nima mentioned, this may only happen with certain crystals. In his case, he was using a 4MHz crystal, and the XT2OFFG would never clear, which is what I suspect is happening in your case. Perhaps your crystal requires a different level of drive strength and more than the minimum.

    Regards,

    James

    MSP Customer Applications
  • How can I operate if already tried with all 4 values XT2DRIVE_0,1,2 and 3?, checking the includes for that macro CCS has options either msp430f5529.h or msp430f55xx_6xxgeneric.h as library files, can it provide any issue? even if both files have the same values for the macros.
    Thanks for your support James. My crystal is a Seiko-Epson FA-20H12Mhz

    In fact fdoing further test even with     UCS_turnOnXT2 function from driverlib, configuring it between 8_16Mhz that corresponds to XT2DRIVE_1 still produce a infinite loop but this time in mentioned function.

    Please if you have any idea how to solve the problem please let me know, thank you so much


    Regards

  • Hello,

    Can you try setting the USB_XT2Freq value to the crystal frequency you are using?  The Programmers_Guide_MSP430_USB_API.pdf document, section 2.1.9 shows you what values you need to set to override the auto detection of the crystal frequency.   

    Please let me know if that works for you. 

    Regards,

    Arthi Bhat

  • Dear Arthi, I was without connection these days that's why my late answer, I checked the guide for usb API and in the section 2.1.9 talks about the "Memory Requirements", maybe you wanted to refer to the section 11.2 Clock Management?, I will review the guide looking for the functions to override the auto detection, if you have the specific section please let me know, thank you for you support

    regards

    Tomas Alarcon

  • Hello Tomas,

    Which version of the USB stack are you running?  To find out, you can open up a usb related file like hal.c and scroll to the bottom of the file, there should be the version of the USB listed there - 'Released xx_xx_xx'.  

    If you are using anything older than version 5_20_06_xx  then XT2 crystal value needs to be entered manually in the descriptors.h file.    The information on setting this value using the Descriptor Tool is described in Section 5.5.1 of the Programmers Guide.  

    In USB release version 5_20_06_xx, XT2 crystal value is detected automatically and the solution I listed above was for overriding this detection and manually setting the crystal value.

    It looks like you are using a version older than 5_20_06_xx and so you will have to set the following values as appropriate to your crystal in the descriptors.h file: 

    #define USB_PLL_XT        2                  // Defines which XT is used by the PLL (1=XT1, 2=XT2)
    #define USB_XT_FREQ_VALUE       4.0   // Indicates the freq of the crystal on the oscillator indicated by USB_PLL_XT
    #define USB_XT_FREQ       USBPLL_SETCLK_4_0  // Indicates the freq of the crystal on the oscillator 

    If you have already set these to the correct value and are still having problems you might need to review your USB design if you are using your own EVM board.

    A great reference for starting a USB design with MSP430 can be found in document, SLAA457a.pdf.

    Regards,

    Arthi

  • Dear Arthi,

    effectively I am using the version: "//Released_Version_5_20_06_02" , I tried the line that you suggest in the post that i related this, in my case I am using one crystal of 12Mhz recommended for MSP430F5529, actually I had reviewed slaa457a before to start my project, as in your post my software get stuck inside of USB_setup, may be I tried wrong clearing HWREG16 and introducing the other driver values, or just clearing with the line that you suggested, should be enough for the automatic detection?the hardware design is base in the recommendations from the different manual either for hardware as for functions, as I mentioned before I used a Seiko crystal FA-20H whit two capacitors of 10pF.

     WDT_A_hold(WDT_A_BASE); // Stop watchdog timer
     PMM_setVCore(PMM_CORE_LEVEL_0);  // Vcore setting required is PMM_CORE_LEVEL_0 due SMCLK = 8MHz
     USBHAL_initPorts();           // Config GPIOS for low-power (output low)
     USBHAL_initClocks(8000000);   // Config clocks. MCLK=SMCLK=FLL=8MHz; ACLK=REFO=32kHz
     setBatteryController();              //Set the port to activate and control the battery Controller
     setTimerParameters();           // Prepare timer for LED toggling
     //Clear XT2drive field
     HWREG16(UCS_BASE + OFS_UCSCTL6) &= ~XT2DRIVE_3;
     USB_setup(TRUE, TRUE); // Init USB & events; if a host is present, connect
     __enable_interrupt();  // Enable interrupts globally

    The functions set*****() are just custom functions to set some ports or configure the timer parameter that are not related with the starting of the crystal

     Which hardware issues can affect the behave of the fault flag of xt2?

    I will trying to place all the functions for USB before any other to see if there is any conflict between my custom code and the API .

  • Hello Tomas,

    Please try running the code example MSP430F55xx_UCS_07.c and check if you stuck on the oscillator flag do-while loop: 

    http://dev.ti.com/tirex/#/?link=Software%2FMSP430Ware%2FDevices%2FMSP430F5XX_6XX%2FMSP430F5529%2FPeripheral%20Examples%2FRegister%20Level%2FMSP430F55xx_UCS_07.c

    If you are getting stuck this may be due to incorrect load caps or a bad crystal. Have you tested the board with a different crystal? 

    Also, are you running this test on a TI hardware? This could help us replicate the issue. 

    Best regards,

    Erick

  • Hello Tomas,

    It is not clear from your post whether you have access to the documentation that describes the auto detection of XT2 crystal and how to not use this feature. If you do not have the latest documentation then you can download the documentation from the TI website:

    www.ti.com/.../MSP430USBDEVPACK

    If you don't want to use Auto-detection and you have manually set the XT2 crystal to 12MHz then you might want to remove the line of code that clears the XT2 field. I would also move the set... function calls to being called after USB_setup().

    In auto-detection of crystal, Timer A is used to compare the speed of XT2 to the REFO clock. So if you are using Timer A in your application (setTimerParameters()) this might effect the bring up of the XT2 crystal. Also it would be advisable to remove the line of code that clears the XT2drive field. You might want to verify that the port set for battery controller is not the one being used for Auto detection - GPIO port 5, pin 2 and pin 3.

    If you are still having issues then maybe you can try the previous version of USB stack. It can be downloaded from here:

    software-dl.ti.com/.../index_FDS.html

    Regards,
    Arthi
  • Hello Erick, I had test the example in my board, is a self design based in TI recommendations documents but not a TI design, I will change today the caps and if is necessary the crystal, to see if is one of those, I will keep update the results 

  • Hello Arthi, actually I had access to the documentation of the USB dev pack, but I don't find in which section is it described how to avoid auto detection, Port 5, pins 2 & 3 are just connected to the crystal; I will try with the new caps as Erick suggested, if not I would like to try not auto detection, if is possible, can you address me in which part of the documentation I can configure the USB avoiding the auto detection.

    Thank you to all of you for your patience and support
  • I did Changed the Crystal for a new one and started to work properly, most probably was damaged in the first welding process, the new one work normal with the auto detection of XT2, is same brad an model of course. Thank you all for you support.

    I had changed first the caps and the error was persistent, just after change the crystal everything started to work normally

    My best regards to you all
  • Hello Tomas,

    We're thrilled that you got everything working. Nice work! Also, thanks for sharing the solution with our community. I'm sure it will benefit others who may face the same issue.

    Regards,

    James

    MSP Customer Applications

**Attention** This is a public forum