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.

Observe floating data using DataLog module?

Other Parts Discussed in Thread: CONTROLSUITE

Hi, every one

I am trying to observe a floating type data in my programme using Datalog module. But somthing is wrong, I observe a sine waveform in the CCS graph tool.

Hope anyone could help me. Thanks

First I creat a instance and set the parameter

//////////////////////////////////////////////////////////////////////////////////////////////

DLOG_4CH dlog = DLOG_4CH_DEFAULTS;

int DlogCh1=0;//used to store the data temporarily,

dlog.iptr1 = & DlogCh1;

dlog.trig_value = 0x0;

dlog.size = 0x400;//the size for each channel, right?

dlog.prescalar = 1;

dlog.init(&dlog);

///////////////////////////////////////////////////////////////////////////////////////////////

then in the programme loop of 100us, I update the DataLog module. The floating data I want to observe called volt

{

DlogCh1=(int16)(32768.0L*Var1); //Is it right? Floating point data to IQ15 data

dlog.update(&dlog);

}

////////////////////////////////////////////////////////////////////////////////////////////////////

this is the configuration of the graph tool

  • Qian,

    The DLOG module is coded such that it can buffer data in Q15 format only, it's the user's responsibility to typecast the Q into Q15 in it's main code,

    Conversion of an integer to float is not trivial, it's different representation of bits.. hence i would recommend using the optimized IQ math library function, the way we have in the motor control project,

      DlogCh1 = (int16)_IQtoIQ15(clarke1.Bs);

    In this case clarke1.Bs is in the global Q format, the global q could be Q24 or float.. when using IQmath header files..

    Regards

    -Manish Bhardwaj

  • Hi, Manish

    Thank you first.

    My DSP is F28335, floating point. So In my code, I should call the header file " IQmathLib.h"?

    And in CCS Graph tool configuration, I should choose"16 bit signed integer"or"32 bit floating" in the DSP data type option?

  • Qian,

    Please see a motor control project to see how the data logger is being used, you would have to include the IQmath library and header file.

    The project reference can be found here

    controlSUITE\development_kits\HVMotorCtrl+PfcKit_v1.6\HVACI_Sensorless_2833x

    You would need to choose 16 bit signed integer for data type of the buffer being displayed,

    regards

    Manish Bhardwaj

  • Hi, Manish

    The data logging module helps me a lot in my project. But here is a new question, my supervisor wants me to plot the figure in matlab instead of printscreen the CCS graph. Is there an easy way to store the data passed to CCS through emulator? Or we can only first store the data in on-chip memory and read the memory in some way, e.g. GEL ?

    Can you give me some hints? Thanks

    Best wishes,

    Qian

  • Qian,

    I would recommend using the memory window, copying the entire region that is covered by the DLOG Buffer into the excel sheet, and after that Matlab can be used to parse that data into plots. 

    Hope this help,

    Manish Bhardwaj

  • Hi, Manish

    Your advice did help me! Thanks!

    I can't understand why I forgot the 'copy memory' issues.

    Best wishes,

    Qian

  • Hi, Are there any plans to do a DataLog module with float? Would it be simple to convert the actual DLog using Q15 to using float ? Thanks!
  • The constraint is memory space to change to float, we typically use RAM only projects are atleast have our critical code running out of RAM, therefore for 4 datalog buffer there might not be enough space ( across the family of devices we have). The module itself is in assembly so it's not straight forward to port it to float,
  • I understand the memory constraint and the fact that it has to work on many platform. If I want to make it work only for the platform I use ( F28335 ) and maybe reduce the number of dlog channel from 4 to 1 or 2, is changing the assembly a big problem or it could be done? Thanks
  • typedef struct{	
    	long task; // Variable: Task address pointer float 
    	*iptr1; // Input: First input pointer float 
    	*dbuff_ptr; // pointer to the location of the data buffer 
    	float trig_value; // Input: Trigger point 
    	int prescalar; // Parameter: Data log pre scale 
    	int skip_cntr; // Variable: Data log skip counter 
    	int cntr; // Variable: Data log counter 
    	float *write_ptr; // Variable: Graph address pointer 
    	int size; // Parameter: Maximum data buffer 
    	int current_state; // current state 1= Wait for trigger, 2 = check for rising edge , 3= log data , 4= reset data log 
    	int (*init)(); // Pointer to init function 
    	int (*update)(); // Pointer to update function 
    } DLOG_CH; 
    
    // the init function should update the state to be 1 , i.e. wait for trigger 
    
    DLOG_CH_update() 
    { 
    	switch(current_state) 
    	{ 
    		case 1: // if the value is already greater than the trig value then do not trigger 
    				// if the value is smaller than trigger value then wait for rising edge 
    				if(*iptr1<trig_value) 
    					current_state=2; // wait for the rising edge
    				break; 
    		case 2: // wait for the rising edge
    				if(*iptr1>trig_value) // the value crossed the trigger value in the rising edge
    				    current_state=3; // start logging data
    				break;
    		case 3: skip_cntr++; 
    				if(skip_cntr==prescalar) 
    				{ 
    					// log data 
    					*write_ptr=*iptr1; 
    					write_ptr++; // move the data buffer pointer to the next location 
    					skip_ctr=0; 
    					cntr++; 
    				} 
    				if(cntr==size) 
    				{ 
    					current_state=4; // finished buffering data for this trigger, reset datalogger 
    				} 
    				break; 
    		case 4: write_ptr=dbuff_ptr; // point the write buffer to the first buffer location 
    				cntr=0; 
    				current_state=1; // now keep on waiting for trigger 
    				break; 
    	} 
    }
    
    
    

     

    Enclosed is the pseudo code,

    This is as far as i can help on this,

    Regards

    Manish Bhardwaj

  • Great, I'll check it out and give you some feedback later on.

     

    I was also wondering, is there a way in CCS to get a compilation report of the memory usage ( Flash, Ram etc...) ?  Maybe per type, econst, .text etc?

  • Yes, look for the map file inside the bunch of files that are generated inside the F2803x_RAM folder inside your project if you are using code provided  by TI

    you can use any standard text editor  for viewing this file,

    The location for the map file can be specified inside C2000 Linker Options-> Basic Options -> -- map file,

     

    -Manish Bhardwaj

  • Mr. Bhardwaj,

    Copying the entire region  covered by the DLOG Buffer only allows us to save the instantaneous data to a file (just 1 sample). In order to observe the data throughout the experiment, I need to be able to save the data from multiple (consecutive) instances (as the time goes by in real time). Is this possible via memory browser?

    Respectfully

    Goksan