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.

TMS320F28379D: F28379D gets stuck in SysCtl_selectXTAL() while startup

Part Number: TMS320F28379D
Other Parts Discussed in Thread: C2000WARE

Hello,

I've got the following problem. My cpu gets stuck at startup. It stucks while waiting for the CPUTimer2 to overrun (CPUTimer_getTimerOverflowStatus(CPUTIMER2_BASE)).

The Problem does not exist if I change the oscillator source from the external oscillator (xtal) to the internal oscillator intosc2.

I'm doing this by changing the #define DEVICE_SETCLOCK_CFG in device.h.

Are there any suggestions to this problem? There is a 20MHz oscillator connected to x1 on my hardware.

  • Hi David,

    Can you share the new values used in DEVICE_SETCLOCK_CFG definition?

    Thanks,

    Joseph

  • As a base for my project I just used a project from the c2000 ware driverlib examples of the f2837xd examples.

    so it's by default:

    #define DEVICE_SETCLOCK_CFG         (SYSCTL_OSCSRC_XTAL | SYSCTL_IMULT(20) |  \
                                                                           SYSCTL_FMULT_NONE | SYSCTL_SYSDIV(2) |   \
                                                                           SYSCTL_PLL_ENABLE)

    I just changed the divider of DEVICE_LSPCLK_FREQ from 4 to 2 so that LSPCLK is 100MHz. I changed the define in the device.h and also the argument in the call of SysCtl_setLowSpeedClock in device.c file.

  • Ok, thanks for the information.

    The Problem does not exist if I change the oscillator source from the external oscillator (xtal) to the internal oscillator intosc2.

    JC:  I believe you are using the examples structure then where the clock setup will be dependent on local files device.c and device.h.  With INTOSC2,

    #define DEVICE_OSCSRC_FREQ is 10000000U and 

    #define DEVICE_SETCLOCK_CFG (SYSCTL_OSCSRC_XTAL | SYSCTL_IMULT(40) | \
                                                               SYSCTL_FMULT_NONE | SYSCTL_SYSDIV(2) | \
                                                               SYSCTL_PLL_ENABLE)

    Please ensure that when switching to external clock, code is using the following values:

    //
    // 20MHz XTAL on controlCARD. For use with SysCtl_getClock().
    //
    #define DEVICE_OSCSRC_FREQ 20000000U

    //
    // Define to pass to SysCtl_setClock(). Will configure the clock as follows:
    // PLLSYSCLK = 20MHz (XTAL_OSC) * 20 (IMULT) * 1 (FMULT) / 2 (PLLCLK_BY_2)
    //
    #define DEVICE_SETCLOCK_CFG (SYSCTL_OSCSRC_XTAL | SYSCTL_IMULT(20) | \
                                                               SYSCTL_FMULT_NONE | SYSCTL_SYSDIV(2) | \
                                                               SYSCTL_PLL_ENABLE)

    If you do have the above settings and still getting stuck at SysCtl_SelectXTAL() function, can you share how the external oscillator is connected to the F28379D device?  Also, are you using your custom board or are you using TI LaunchPad or ControlCard?

    -Joseph

  • I think I’m already using the configuration for 20mhz xtal on controlCard.

    I will check it again and send you more information.

    I currently switched from the controlCard to our own hardware which integrates the f28379D. I‘ll send you the schematic when I’m back at the office.

    Unfortunately, I started a 2 week vacation today, so you’ll here from me when I’m back.

    Thank you in advance!

  • Ok, no worries David.  We'll resume our discussion once you get back from vacation.  Enjoy your vacation!

    -Joseph

  • As you can see in the following screenshot in the local device.h the right area is greyed out.

    Also here is a screenshot of the schematic.

  • Hi David,

    The difference between your design and the control card as far as clocking is that in control card, the clock source is external crystal (uses both X1/X2 pads) whereas in your schematics, it shows that you are using oscillator (uses only X1).  Since both are clocking at 20MHz, the multipliers and dividers should be the same.

    Couple of things to check:

         1.) scope the node CLK_20MHz to see if indeed 20MHz clock is being produced

         2.) there is a pin called VDDOSC.  Can you check to see if this pin is connected to 3.3v?

    Regards,

    Joseph

  • Hi Joseph,

    yes the VDDOSC pin is connected to 3.3V.

    When I program the hardware with Matlab/Simulink it works. The program runs in flash, so after a reset of the powersupply the controller works perfectly.

    The weird thing is that after running a project from Matlab/Simulink on the controller I'm able to load my CCS project onto the controller and it doesn't get stuck. But as soon as I reset the powersupply to restart the controller the program doesn't work. After the reset I'm also not able to run the project on the controller again. If I load it again onto the controller I see that the controller gets stuck at the certain point.

    Also here you can see a measurement made on the x1 input pin of the controller:

  • Hi David,

    With VDDOSC powered to 3.3V and X1 input getting clock pulses from the external oscillator, we are assured that the F28379D part is properly getting clocked.  I am not sure what is happenig in between Matlab/Simulink programmation and execution, but it will be ggod to confirm this as a standalone setup to isolate there the hang up is occuring.  There might be a process or routine in Matlab/Simulink that reconfigures the internal clock (i'm not really sure,just pure speculation).  Maybe you should alos check that clock configuration in Matlab/Simulink is choosing the proper clock source and multiplier values.

    With the standalone setup in CCS (code composer studio), can you program the part in flash, power cycle the board and execute the code correctly?  If you can prove this then we can be confident that your code executes correctly then next step is to isolate where in Matlab/Simulink the hang up is occuring.

    Regards,

    Joseph

  • I was looking into the generated CSS project from Matlab especially at the initialisation. The main difference is that the Matlab project doesn't use the driverlib.lib. It uses the C files like F2847xD_SysCtrl.c, F2847xD_PieVect.c and so on.

    So I guess there are two ways of programming the c2000 and therefore also two folders for the examples

    C:\ti\c2000\C2000Ware_4_01_00_00\device_support\f2837xd\examples and C:\ti\c2000\C2000Ware_4_01_00_00\driverlib\f2837xd\examples

    The initialisation of the Matlab and the device_support projects are using the InitSysPll() function out the F2837xD_SysCtrl.c file to setup the clock. In the driverlib examples the SysCtl_setClock(uint32_t config) function from sysctl.c is used.

    I implemented my project firstly with the driverlib, but as we know this didn't work. Now I implemented it in the "device_support style" and it works fine. But thats probably just the case because the InitSysPll() doesn't implement a function where the CPU waits for the CPU Timer2 to overrun, like the SysCtl_setClock() does with the SysCtl_pollCpuTimer() function.

    The program now runs and it's fine for me to implement it with the other functions, because its anyways just for a little test on the adc's.

    All in all thank you a lot for your help!

  • Hi David,

    Glad to know you got the routines to work on your board.

    Regards,

    Joseph