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.

LAUNCHXL-F280025C: TMS320F280025C-Q1, DRV8323RS

Part Number: LAUNCHXL-F280025C


Tool/software:

Have a new F280025c/DRV8323RS PCB design, patterned after a LaunchXLf280025C/DRV8323RS test setup.

the LaunchXLF280025CrevA uses a XTAL, and I need to change to  the OSC2 clock.  Using CC12.7.1 and Universal Motor Control Lab 4.0....driving a 15A sensorless foc induction motor.  Labs 1-4 run fine.  Only one GPIO change to new PCB and disabled unused items.

when loading the standalone F280025C the debugger shows that the clk always goes through case SYSCTL_OSCSRC_XTAL:in SysCtl_selectOscSource(uint32_t oscSource),  Of course it ends in an endless loop because the new PCB has no XTAL.

do you have an example regarding launchXL->standalone clk change to OSC2??   Hal.h has an extern function "extern void HAL_setupClks(HAL_Handle handle); but doesn't exist anywhere that I've found.

I would appreciate help.

I've reviewed one older 2E2 showing a device.h change dor DEVICE_SETCLOCK_CFG but that didn't change the iscsoure case jump to ...XTAL instead of ...OSC2 in SysCtl_selectOscSource().

I've also set,  in device.h,  USE_PLL_SRC_INTOSC which appears to have a different DEVICE_SETCLOCK_CFG setup.  Confusing multiple place because I'm new to this code.

thank you

Al Lehman

  • Al,

    I'm happy to help. I'll go over your question in detail.

    To summarize beforehand, you appear to be on the right track. 'USE_PLL_SRC_INTOSC' is the correct #define to use, but you also need to make sure that USE_PLL_SRC_XTAL is NOT enabled.

    Detailed answer, including a very helpful tip for using large projects:

    1. You're correct in regards to HAL_setupClks(-). It appears to be a legacy function which has since been removed- I did not know a reference to it had remained in the code. Thank you for informing us of this!

    2. There is a functionality that I highly recommend using, especially for projects with large codebases:
      1. Go to the workspace settings:
      2. Enable 'Show advanced settings' and search for the 'Folding' option:
      3. Check the following boxes and hit 'apply and close':
      4. This will allow you to collapse unused sections of the code, based on the #defines and pre-defined symbols of the project:
        1. Notice that the code jumps from 308 to 324 because USE_PLL_SRC_INTOSC is not enabled in my project! This functionality is going to save you a lot of headaches down the line.
      5. Close and re-open any files you're currently in to reload them and enable this feature.

    3. Search for the "#define USE_PLL_SRC_XTAL" in your device.h file. You need to comment out this line of code. Beneath it, add "#define USE_PLL_SRC_INTOSC"
      1. By default, this should make your project use the following clock configuration, which uses osc2 by default:
        1.  
      2. This can also be seen as a tutorial on switching the clock source- all you need to do is adjust the clock configuration macro located in device.h!

    I hope all that was helpful!

    Regards,
    Jason Osborn

  • VERY HELPFUL - working on it now and i'll give you a status by tomorrow.!!!  I often wondering about not viewing used code..   GREAT.   

    thank you!!

    Al

  • Additional information -  I single stepped after insuring you recommendations are in place.  I am now stuck at an interesting "switch" case mismatch that I don't understand.   

    At SysCtl_selectOscSource() call.  the input is  uint32_t oscSource value which is 0x00000000.  8 zeros.  single stepping to "switch" and the value is still hex"0".  the next step goes to case ...XTAL (value = 0x0010000) Instead of ...OSC2 case (value is 0x00000000).

    what would cause this to happen??.   This is why I never could get OSC2 to work?  and it always goes to XTAL?

    does single stepping impact anything here?  

    HELP PLEASE..  I may be missing something here..

    Cheers

    Al

  • Another item - If I go through debug,  oscSource ends up being an OSC2 value == 0x0000000.   when I just run normal oscSource == 0x000007FF.  any hints?  I'm testing clock selection back on launchXL.  XTAL code is still good (just checking changes).  so I'm trying OSC2 now.

    Al

  • I see what's happening with your debug breakpoint, at the very least.

    • Select the 'driverlib.lib' file. Right click, select "Exclude from build".
    • Select the 'driverlib' folder. Right click, unselect "Exclude from build".

    Re-build your project and try your prev. steps again. Let me know what changes.

    Regards,
    Jason Osborn

  • thank you.   I removed the two items and rebuilt.  similar results.  I also have put optimization now at off and set the _X1,X2 GPIO 19,18 to out (no difference on the GPIO)   

    here is the result which is consistent now but still the XTAL ends up being selected.  

    device_init()->sysCtlsetClock(cofig) in sysctl.c -> config==0x8015001E

    next no failure detected->#else-> to bypass PLL section  (unless I misinterpreted this jump to #else)

    next three setups

    oscclksrcsel=  0x0000  // only 16 bits?  I guess

    xtalval = 0x0000 also

    first two | (or'd) and not= compare gives oscSource = 0x00000001 =>

    turn off PLL section

    then to sysCtl_selectOscSource  and oscSource == 0x00010000  or XTAL.  switch case works and goes to XTAL.

    Note:  when I delected driverlib.lib file and then folder,  there was still a driverlib.lib file left that did not go away.  FYI - thank you Al

  • Good News - I added a missing line in sysctl.h (at least the version I'm using) and my new pcb is running fine!!  since it is the launchXL code to start with then changing to OSC2 was not a concern?   OR the 4.0x version I'm using needed an update?   anyway I'm very happy and learned a lot.

    In sysCtl_setClock() down  to [ #if((oscclksrcsel | xtalval)  != oscSource],  PLL is turned off and  then there is a sysCtl_selectOscSource() call.

    I only had one () entry here that was..(config & SYSCTL_OSCSRC_M), so that added the 0x00010000 during the process instead of all zeros.

    I added an #if for my new PCB define  and added the() for (config & SYSCTL_OSCSRC_OSC2).  The [&& !defined()] allows me to test the same code on the launchXL.

    lab 1 runs and am testing lab 4 now.  

    Thank you for getting me going in this area.  You were a fantastic help including the tip on collapsing the code !!!

    Cheers

    Al

  • I meant sysctl.c not sysctl.h.

  • Jason - I meant sysctl.c no sysctl.h  thanx