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.

F28377S sci_echoback_cpu01 clocking and BAUD issues

Other Parts Discussed in Thread: CONTROLSUITE

Hello there!  I'm having an issue running the sci_echoback_cpu01 example from the ControlSuite repository.  Here's the thing - the example is originally configured for a 9600 BAUD, but actually works at a 4800 BAUD instead.  This got me thinking that the clocking was incorrect.  As per the example code, 

    //
    // SCIA at 9600 baud
    // @LSPCLK = 50 MHz (200 MHz SYSCLK) HBAUD = 0x02 and LBAUD = 0x8B.
	//
	SciaRegs.SCIHBAUD.all    =0x0002;
    SciaRegs.SCILBAUD.all    =0x008B;

	SciaRegs.SCICTL1.all =0x0023;  // Relinquish SCI from Reset

This is with manually setting the LSPCLKDIV to 4 (should be the default), 

   EALLOW;
   ClkCfgRegs.LOSPCP.bit.LSPCLKDIV = 4;
   EDIS;

And manually setting the cpu clock to XTAL as such (default for the program), using the API from usb_dev_serial

   SysCtlClockSet(SYSCTL_OSCSRC_XTAL | SYSCTL_PLL_ENABLE | SYSCTL_IMULT(20) | SYSCTL_SYSDIV(1));

But as per the usb_dev_serial comments,

      SysCtlClockSet(SYSCTL_OSCSRC_XTAL | SYSCTL_PLL_ENABLE | SYSCTL_IMULT(20) | SYSCTL_SYSDIV(2));

should generate a 50MHz clock.

So a few questions:  

  1. What's my clock actually running at?  I know the calculation for the clock speed should be XTALSPEED*(IMULT*FMULT)/SYSDIV.  Is the calculation for the BAUD incorrect or is the CPU frequency incorrect?
  2. What is the XTAL frequency?  The datasheet says it's between 10 and 20 MHz, but I can't find any indicator on how to change it and actually specify it.
  3. How do I set the CPU to 200MHz?  If I change the CPU config as such, I get illegal interrupts,
   SysCtlClockSet(SYSCTL_OSCSRC_XTAL | SYSCTL_PLL_ENABLE | SYSCTL_IMULT(40) | SYSCTL_SYSDIV(1));
  • Hi Kenneth,

    If you are using the Launchpad then XTAL frq would be 10MHz hence with multiplier value "SYSCTL_IMULT(20)" the SYSCLK will be 100MHz instead of 200MHz. You may want to pull the latest controlSUITE because I believe this was fixed there.

    How do I set the CPU to 200MHz?  If I change the CPU config as such, I get illegal interrupts

    SysCtlClockSet(SYSCTL_OSCSRC_XTAL | SYSCTL_PLL_ENABLE | SYSCTL_IMULT(40) | SYSCTL_SYSDIV(1));

    You need to change it like below -

    SysCtlClockSet(SYSCTL_OSCSRC_XTAL | SYSCTL_PLL_ENABLE | SYSCTL_IMULT(40) | SYSCTL_SYSDIV(2));

    This should fix the issue.

    Regards,

    Vivek Singh

  • Thank you very much!
  • Thank you for your quick response - follow up question:

    When using RTOS with the same suggested configuration as above,

    But by my math we should get 200MHz.  This wouldn't be an issue unless the BIOS wasn't trying to enforce a CPU freq in the runtime config.  Thoughts?

  • Hi Vivek,

    I updated the ControlSUIT, this sample code still have the same issue. The BAUD is still working in lower frequency. Do you have a suggestion for how to fix this? I could not find the SysCtlClockSet(SYSCTL_OSCSRC_XTAL | SYSCTL_PLL_ENABLE | SYSCTL_IMULT(40) | SYSCTL_SYSDIV(2)); function.
  • Figured out, in the F2837xS_SysCtrls.c file,

    this line should be changed:
    InitSysPll(XTAL_OSC,IMULT_20,FMULT_1,PLLCLK_BY_2); //PLLSYSCLK = 10Mhz(OSCCLK) * 40 (IMULT) * 1 (FMULT) / 2 (PLLCLK_BY_2)

    to
    InitSysPll(XTAL_OSC,IMULT_40,FMULT_1,PLLCLK_BY_2); //PLLSYSCLK = 10Mhz(OSCCLK) * 40 (IMULT) * 1 (FMULT) / 2 (PLLCLK_BY_2)

    This will effect not just this sample, but also SCI sample. Which will caused the baud rate mismatch, please alert ControlSUIT team to modify the code in next release.

    Taisen
  • Hi Taisen,

    What version of SW for F2837xS device you are using?

    I'll inform controlSUITE team about the same so that it can be fixed in next release.

    Regards,

    Vivek Singh

  • Hi Vivek,

    I am using v3.3.7 - November 13, 2015 controlSUITE, I believe that is the newest version.

    That would be great! Thank you Viviek.

    Best
    Taisen
  • Taisen,

    Following is the code inside "F2837xS_SysCtrl.c" file in latest controlSUITE release (software version - v180).

    #ifdef _LAUNCHXL_F28377S
        InitSysPll(XTAL_OSC,IMULT_40,FMULT_0,PLLCLK_BY_2);   //PLLSYSCLK = (XTAL_OSC) * (IMULT + FMULT) / (PLLSYSCLKDIV)
    #else
        InitSysPll(XTAL_OSC,IMULT_20,FMULT_0,PLLCLK_BY_2);   //PLLSYSCLK = (XTAL_OSC) * (IMULT + FMULT) / (PLLSYSCLKDIV)
    #endif

    So this indeed has both the option. Am I missing something here?

    Regards,

    Vivek Singh

  • Hi Vivek,

    I think you opened the wrong project, yes, if you open other project in the V180 device_support folder, that already updated. However, in the development kits/Example_28377LaunchPad project (the most updated release software), which is still referring to V150 F2837xS_SysCtrl.c file. That still have this frequency issue.

    That is why I made the comment last night.

    Best
    Taisen
  • Hi Taisen, You are right. It was not fixed in development kit folder. This will be fixed in next release.

    Regards,

    Vivek Singh