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.

Viewing the output for ControlSuite examples on DSP/SGEN etc. on C2000 Launchpad 28377S

Other Parts Discussed in Thread: CONTROLSUITE

Dear Forum, 

I am trying to run the examples in the ControlSuite. I have a C2000 Launchpad with Delfino 28377S uC. I have been able to run a DAC/ADC example from a training course. So I know my hardware is responding, drivers etc in place. 

Since we want to generate a sine wave, and compute its FFT, I was trying to run the codes SGENT1 and SGENHP1 (high-precision sine wave) and Fixed_Point_RFFT for FFT calculations. These example projects are located in  C:\ti\controlSUITE\libs\dsp\sgen & C:\ti\controlSUITE\libs\dsp\FixedPointLib and I updated the project properties to use the 28377 cmd file and tried with the compiler that the project was bundled with (6.0.1). 

The projects build without errors. When I debug it, I do not see any output. I even loaded the associated js script file for viewing the watch expressions and graph, but those show up empty too. When I step through the code, I find that it always halts on 

while(SysCtrlRegs.PLLSTS.bit.PLLLOCKS != 1)

located in DSP2833x_SysCtrl.c and this happens with all the listed projects. 

The main file of SGENHP1 is like so:

// =====================================================================================
//  This software is licensed for use with Texas Instruments C28x
//  family DSCs.  This license was provided to you prior to installing
//  the software.  You may review this license by consulting a copy of
//  the agreement in the doc directory of this library.
// -------------------------------------------------------------------------------------
//          Copyright (C) 2010-2011 Texas Instruments, Incorporated.
//                          All Rights Reserved.
//======================================================================================
/* ==============================================================================

System Name:    Signal Generator Module demo 

File Name:      SGENHP1.C

Description:    Primary System file for demonstrating the Signal Generator module

Originator:     Digital control systems Group - Texas Instruments

Target dependency:  C28x

Description:
============

   The "C" frame work, for demonstrating the signal generator module is given below
                 ___________           _____________
                |           |         |             |
                |           | X1=OUT  |   EVMDAC    |
                |  SGENHP_1 |-------->|   DLOG_4CH  |
                |           |         |   PWMDAC    |
                |___________|         |_____________|

*/
//######################################################################################
// $TI Release: C28x SGEN Library Version v1.01 $
// $Release Date: September 30, 2011 $
//######################################################################################

#include "DSP28x_Project.h"     // Device Headerfile and Examples Include File
//#include "F28x_Project.h"     // DSP28x Headerfile
#include <sgen.h>
//#include "ti_ascii.h"
//#include "sci_io.h"

#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include <file.h>

#define SIGNAL_LENGTH 512
   
/* Create an instance of Signal generator module    */
SGENHP_1 sgen = SGENHP_1_DEFAULTS;

#pragma DATA_SECTION(ipcb, "SGENipcb");
int ipcb[SIGNAL_LENGTH];
         
/* Temp variable to store the signal genr output    */   
int x1;
     
void main()
{    
	   unsigned long i;

  	   InitSysCtrl();
	   DINT;
	   InitPieCtrl();
	   IER = 0x0000;
	   IFR = 0x0000;
	   InitPieVectTable();
	   EINT;   // Enable Global interrupt INTM
	   ERTM;   // Enable Global realtime interrupt DBGM
	     
/* Signal Generator module initialisation   */ 
       sgen.offset=0;
       sgen.gain=0x7fff;        /* gain=1 in Q15                              */
       sgen.freq=0x14F8CF92;    /* freq = (Required Freq/Max Freq)*2^31       */
                                /*      = (50/305.17)*2^31 = 0x14f8cf92       */         
       sgen.step_max=0x3E7FB26; /* Max Freq= (step_max * sampling freq)/2^32 */
                                /* Max Freq = (0x3E7FB26*20k)/2^32 = 305.17  */
       sgen.alpha=536870912;    		/* phase_norm =(pi/4/(2*pi))*2^16=8192   */
            
        for(i=0;i<SIGNAL_LENGTH;i++)
        {
        	ipcb[i]=0;
        }

        for(i=0;i<SIGNAL_LENGTH;i++)
        {
            sgen.calc(&sgen);
            x1=sgen.out;
            ipcb[i]=x1;
        }   
        
        for(;;);    

} /* End: main() */


Do I need to make any changes to this code ? or any other setting that needs to be changed ? Does the code need some interrupt function or something ?


Thanks

  • Chintan,

    It appears that the Projects are only built for the F2833x devices which are not totally code compatible with F2837x devices.

    You will have to swap out at least all of the System  Control type files in the project with the F2837x versions. The clocking is different, and many modules on the device are different. I would suggest going through each linked file, and updating with the F2837x Versions where necessary.

    Thanks,
    Mark 

  • Thanks Mark for your response.

    So I am guessing there is no set path or document detailing the migration process, and I would have to do a trial and error while trying to port the code.

    I tried changing all the files from DSP2833x_ to F2837x_ . I also removed the files that were not used in the project. I was  left with one file that I could not find a direct equivalent in the controlSUITE : DSP2833x_ADC_cal.asm . What would be the equivalent for 2837x and where could I find it ?

    I get errors (3) when I try to build the project using this file: 

    Description Resource Path Location Type
    errors encountered during linking; "2833x_SGENHP1.out" not built 2833x_SGENHP1 C/C++ Problem
    unresolved symbol _GPIO_EnableUnbondedIOPullups, first referenced in ./F2837xS_SysCtrl.obj 2833x_SGENHP1 C/C++ Problem
    unresolved symbols remain 2833x_SGENHP1 C/C++ Problem

  • Glad to help. We do not have a migration guide for this project at this time. I have put a request in to our SW team to see if there are plans on officially porting this.

    There is no equivalent file for that in the F2837xS. ADC_Cal loads the ADC Trim Values. This is handled in the F2837xS_SysCtl.c function.

    Please include the F2837xS_Gpio.c file for the GPIOEnableUnbondedIOPullups function. 

    If you are having trouble getting this ported to F2837xS, you might consider taking a basic/blank project from F2837xS, and pull in the required functions for the SGEN functionality

    Thanks,
    Mark

  • Thanks a lot Mark. Adding F2837xS_Gpio.c got rid of all three errors and I didnt need the ADC_Cal after all. 

    For anyone trying to to do what I wanted to do, I guess whats needed to be done is: 

    1. Use the compiler that is used to build the original project ( I have not tested with other compilers, it might or might not work with newer compilers). 

    2. Change all the files DSP2833x_ files to their corresponding F2837x_ files. You would find them in the  C:\ti\controlSUITE\device_support\F2837xS\v191\F2837xS_common\source and C:\ti\controlSUITE\device_support\F2837xS\v191\F2837xS_headers\source.

    3. Add the folders C:\ti\controlSUITE\device_support\F2837xS\v191\F2837xS_common\include and C:\ti\controlSUITE\device_support\F2837xS\v191\F2837xS_headers\include to the include folders via Properties -> Build -> Include options 

    4. Keep the 28335_SGEN_RAM_lnk.cmd file. This has important definitions needed by the program. (It would be interesting to see how this file behaves upon integration with other projects or upon addition of functionality to the main file.)

    5. You might consider changing the header file in sgenhp1.c to F28x_Project.h from DSP28x_Project.h although it worked fine without that change too. 

    Thanks again Mark. 

  • Chintan,

    Thanks for the update. I am glad that you have gotten it working. I will suggest to our Software team to look into providing a migration guide. No guarantees, but I do know that many customers are migrating from F28335 to F2837x Series.

    -Mark