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-F28377S Demo Project Example_28377SLaunchPad Clock Frequency Bug

Other Parts Discussed in Thread: CONTROLSUITE

Hi,

I suspect I've found a bug in Demo Project Example_28377SLaunchPad imported into CCS with regard to either the default PLLSYSCLK frequency configuration or the SCI_A baud rate selection.  When I compile and load the project and attempt to view the serial output with PuTTY at 115200-8-N-1 all I receive are jumbled characters.  I started looking into the code to make sure the clock tree was configured correctly and what I found is the default code configures the PLLSYSCLK for 100Mhz instead of 200MHz yet the SCI_A baud rate is configured based on a 200MHz SYSCLK!

Expected clock tree configuration:

  • PLLSYSCLK = SYSCLK = 200MHz
  • LSPCLK = SYSCLK/4 = 200MHz/4 = 50MHz
  • SCIBaudRate = LSPCLK/((SCIHBAUD:SCILBAUD + 1) * 8) = 50MHz/((53 + 1) * 8) = 115,741 (~115,200) Baud

Actual clock tree configuration:

  • PLLSYSCLK = SYSCLK = 100MHz
  • LSPCLK = SYSCLK/4 = 100MHz/4 = 25MHz
  • SCIBaudRate = LSPCLK/((SCIHBAUD:SCILBAUD + 1) * 8) = 25MHz/((53 + 1) * 8) = 57,870 (~57,600) Baud

If I configure PuTTY for a 57600-8-N-1 serial configuration everything works and the terminal shows the red and white TI logo.

Below are code excerpts (with file headers showing file name and version information) that contain the configurations that affect the baud rate and SYSCLK frequency.  It's plane to see that the programmer meant to use the IMULT_40 macro instead of  IMULT_20 in the InitSysPll() function in F2837xS_SysCtrl.c.  Their comments even show what they wanted to do "PLLSYSCLK = 10Mhz(OSCCLK) * 40 (IMULT) * 1 (FMULT) /  2 (PLLCLK_BY_2)".  What's even more interesting is the SCI code is commented "115200 baud @LSPCLK = 22.5MHz (90 MHz SYSCLK)" which is for neither a 100MHz or 200MHz SYSCLK!

//###########################################################################
//
// FILE:   F2837xS_SysCtrl.c
//
// TITLE:  F2837xS Device System Control Initialization & Support Functions.
//
// DESCRIPTION:
//
//         Example initialization of system resources.
//
//###########################################################################
// $TI Release: F2837xS Support Library v150 $
// $Release Date: Thu Mar  5 14:49:36 CST 2015 $
// $Copyright: Copyright (C) 2014-2015 Texas Instruments Incorporated -
//             http://www.ti.com/ ALL RIGHTS RESERVED $
//###########################################################################

    // Initialize the PLL control: PLLCR and CLKINDIV
    // F28_PLLCR and F28_CLKINDIV are defined in F2837xS_Examples.h
    // Note: The internal oscillator CANNOT be used as the PLL source if the
    // PLLSYSCLK is configured to frequencies above 194 MHz.
    InitSysPll(XTAL_OSC,IMULT_20,FMULT_1,PLLCLK_BY_2); 		//PLLSYSCLK = 10Mhz(OSCCLK) * 40 (IMULT) * 1 (FMULT) /  2 (PLLCLK_BY_2)

//###########################################################################
//
// FILE:	Example_F28377xLaunchPadDemo.c
//
// TITLE:	F28377S LaunchPad Out of Box Demo
//
// DESCRIPTION:
//! \addtogroup f28377xX_example_list
//! <h1>Out of Box Demo (LaunchPadDemo)</h1>
//!
//!  This program is the demo program that comes pre-loaded on the F28377S
//!  LaunchPad development kit.  The program starts by flashing the two user
//!  LEDs. After a few seconds the LEDs stop flashing and the device starts 
//!  sampling ADCIN14 once a second.  If the sample is greater than midscale
//!  the red LED on the board is lit, while if it is lower a blue LED is lit.  
//!  Sample data is also display in a serial terminal via the boards back 
//!  channel UART.  You may view this data by configuring a serial termainal 
//!  to the correct COM port at 115200 Baud 8-N-1.
//!
//
//###########################################################################
// $TI Release: 2837xS C/C++ Header Files V1.00 $
// $Release Date: July 15, 2015 $
//###########################################################################

// SCIA  8-bit word, baud rate 0x000F, default, 1 STOP bit, no parity
void scia_init()
{

    // Note: Clocks were turned on to the SCIA peripheral
    // in the InitSysCtrl() function

 	SciaRegs.SCICCR.all =0x0007;   // 1 stop bit,  No loopback
                                   // No parity,8 char bits,
                                   // async mode, idle-line protocol
	SciaRegs.SCICTL1.all =0x0003;  // enable TX, RX, internal SCICLK,
                                   // Disable RX ERR, SLEEP, TXWAKE

	SciaRegs.SCICTL2.bit.TXINTENA =1;
	SciaRegs.SCICTL2.bit.RXBKINTENA =1;

	SciaRegs.SCIHBAUD.all    =0x0000;  // 115200 baud @LSPCLK = 22.5MHz (90 MHz SYSCLK).
    SciaRegs.SCILBAUD.all    =53;

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

Thanks,
Jesse