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.

How to use DLOG module in Motorware?

Other Parts Discussed in Thread: MOTORWARE, CONTROLSUITE, CODECOMPOSER

Dear all,

Like question "How to use PWMDAC module in Motorware?", I want to ask the same question for DLOG module.

In ControlSuite, I know to do this module as following:

// Initialize DATALOG module
    dlog.iptr1 = &DlogCh1;
    dlog.iptr2 = &DlogCh2;
    dlog.iptr3 = &DlogCh3;
    dlog.iptr4 = &DlogCh4;
    dlog.trig_value = 0x1;
    dlog.size = 0x0C8;
    dlog.prescalar = 5;
    dlog.init(&dlog);

And in the main_ISR(), I need to call, for example, to view Ta, Tb, Tc and Tb-Tc of SVGEN result:

// ------------------------------------------------------------------------------
//    Connect inputs of the DATALOG module 
// ------------------------------------------------------------------------------
    DlogCh1 = (int16)_IQtoIQ15(svgen1.Ta);
    DlogCh2 = (int16)_IQtoIQ15(svgen1.Tb);
    DlogCh3 = (int16)_IQtoIQ15(svgen1.Tc);
    DlogCh4 = (int16)_IQtoIQ15(svgen1.Tb-svgen1.Tc);

Please guide me how to use this module in Motorware correctly!

Many thank you!

  • Hi Tran,

    Please see this post: e2e.ti.com/.../457677.

    Thanks,
    Jeff
  • Dear Jeff,

    I click on the link that you have posted, but I got an error:

    Please check it for me again.

    Tran

  • Hi,

    Someone else guide me how to use Dlog module in a Motorware project. I want to have a specific example.

    Many thanks,
  • Hi Tran,

    Have you tried searching on DLOG?  There are many threads on this topic.

    Sorry about the earlier broken link, here is the link I was trying to share:  .

    Jeff

  • Dear Jeff,

    I followed your guides in the above link that you gave, but I don't understand why, when I include DLOG_4CH module in my project, and build + run the program, the program jumped to asm( "ESTOP0") as seeing in the figure:

    I initialized and run the update function of DLOG_4CH as following:

    void main()
    {
    ...
    #if (VFD_USING_DLOG == true)
      //! \brief Initialize DATALOG module.
      //! \notes Added by Duongtb: 02-Dec-2015
      dlog.iptr1 = &DlogCh1;
      dlog.iptr2 = &DlogCh2;
      dlog.iptr3 = &DlogCh3;
      dlog.iptr4 = &DlogCh4;
      dlog.trig_value = 0x1;
      dlog.size = 0x00c8;				//!> 0xc8 = 200 points; 0x400 = 1024 points
      dlog.prescalar = 1;
      //dlog.init(&dlog);
      DLOG_4CH_init(&dlog);
    #endif //VFD_USING_DLOG
    ...
    }
    interrupt void mainISR()
    {
    .
    .
    .
    #if (VFD_USING_DLOG == true)
      // ------------------------------------------------------------------------------
      //    Connect inputs of the DATALOG module
      // ------------------------------------------------------------------------------
      DlogCh1 = (int16_t)_IQtoIQ15(gPwmData.Tabc.value[0]);
      DlogCh2 = (int16_t)_IQtoIQ15(gPwmData.Tabc.value[1]);
      DlogCh3 = (int16_t)_IQtoIQ15(gPwmData.Tabc.value[2]);
      DlogCh4 = (int16_t)_IQtoIQ15(gPwmData.Tabc.value[1]-gPwmData.Tabc.value[2]);
    
    
    // ------------------------------------------------------------------------------
    //    Call the DATALOG update function.
    // ------------------------------------------------------------------------------
      //!> notes call this function in a period interrupt
      //dlog.update(&dlog);
      DLOG_4CH_update(&dlog);
    #endif
    .
    .
    .
      return;
    }
    

    In the F28054F.cmd file, I declared:

    MEMORY
    {
    PAGE 0:    /* Program Memory */
    .
    .
    . PAGE 1 : /* Data Memory */ /* Memory (RAM/FLASH/OTP) blocks can be moved to PAGE0 for program allocation */ /* Registers remain on PAGE1 */ BOOT_RSVD : origin = 0x000000, length = 0x000050 /* Part of M0, BOOT rom will use this for stack */ RAMM0 : origin = 0x000050, length = 0x0003B0 /* on-chip RAM block M0 */ RAMM1 : origin = 0x000400, length = 0x000400 /* on-chip RAM block M1 */ /* RAML0 : origin = 0x008000, length = 0x000800 /* DO NOT USE THIS L0 RAM to avoid conflicts between user's memory and FASH/SPIN library */ RAML3 : origin = 0x009000, length = 0x001000 /* on-chip RAM block L3 */ FLASHB : origin = 0x3F6000, length = 0x001000 /* on-chip FLASH */ } SECTIONS { DLOG: > RAML3, PAGE = 1 }

    Every I add the function dlog.update(&dlog); or DLOG_4CH_update(&dlog); in the mainISR() function, the program was broke at the ESTOP0 line code. 

    So please help me how to use DLOG module in a Motorware correctly or let me know where is I wrong in the above using way.

    Thank you very much!

    Tran,

  • Hi Tran,

    It looks like you don't have the steps before main().  Here's a summary of the steps that I extracted from an example in ControlSUITE (C:\TI\controlSUITE\development_kits\DRV8312-C2-KIT_v128\BLDC_Sensored):

    before main()

    int16 DlogCh1 = 0;

    int16 DlogCh2 = 0;

    int16 DlogCh3 = 0;

    int16 DlogCh4 = 0;

    // Create an instance of DATALOG Module

    DLOG_4CH dlog = DLOG_4CH_DEFAULTS;

    from main()

    // Initialize DATALOG module

       dlog.iptr1 = &DlogCh1;

       dlog.iptr2 = &DlogCh2;

       dlog.iptr3 = &DlogCh3;

       dlog.iptr4 = &DlogCh4;

       dlog.trig_value = 0x1;

       dlog.size = 0x0C8;

       dlog.prescalar = 25;

       dlog.init(&dlog);

    in ISR

    // ------------------------------------------------------------------------------

    //    Connect inputs of the DATALOG module

    // ------------------------------------------------------------------------------

         DlogCh1 = pwm1.CmtnPointer;

         DlogCh2 = _IQtoQ15(BemfA);

         DlogCh3 = _IQtoQ15(BemfB);

         DlogCh4 = _IQtoQ15(BemfC);

    // ------------------------------------------------------------------------------

    //    Call the DATALOG update function.

    // ------------------------------------------------------------------------------

       dlog.update(&dlog);

    Please add the init before main(), call the init function from main(), and just check the details in your code with the example here.

    Thanks,

    Jeff

  • Dear Jeff,

    I did the initialization before main() already. I included files dlog.h and dlog.c of Motorware into my project, in the dlog.c, all variables DlogCh1 to DlogCh4 was initialized, as:

    #include "sw/modules/dlog/src/32b/dlog4ch.h"
    
    
    
    // **************************************************************************
    // the defines
    
    
    // **************************************************************************
    // the globals
    
    DLOG_4CH dlog = DLOG_4CH_DEFAULTS;
    
    
    int16_t DlogCh1 = 0;
    int16_t DlogCh2 = 0;
    int16_t DlogCh3 = 0;
    int16_t DlogCh4 = 0;
    

    Moreover, I also add dlog4chc.asm file in order to link to the DLOG_4CH_init() and DLOG_4CH_update() functions. But I still get the above error every running the DLOG_4CH_update() function. It's so odd! Because I use this module with ControlSuite projects without any problems.

    Thank you for your feedback,

    Tran

  • Hi Tran,

    I am working on using DLOG in motorware too. Did you succeed after you got the above errors? I get a warning saying '#10247-D creating output section "DLOG" without a SECTIONS'. Could you help me out if you have been able to use DLOG in motorware with the above steps you have mentioned.

    Aditya
  • Dear Aditya,

    Thank you for your question in this topic. In deed I haven't been successful in testing DLOG in motorware enviroment. But I did not have the warning #10247-D because I declared the output SECTION "DLOG" in the file F2805x.cmd as following:

    /* Added by Duongtb: 2-Dec-2015 */
    SECTIONS
    {
    	DLOG: > RAML3, PAGE=1
    }
    

    If you run DLOG successfully, please share me how to do it.

    With kind regards,

    Mr. Tran

  • Dear Tran,

                        I did understand that issue. I corrected it by adding

    DLOG             : > RAML0_L8,     PAGE = 0 in the 28069 cmd file.

    The compile time warning and errors were rectified thereof. But now, when I debug, run it on the board, It doesn't work. I get an error whose screenshot i have attached below. Please suggest me if you have come across this. Or please suggest me a workaround for obtaining the signals from the board without using oscilloscope, SCI, or dumping the values into some fpga board if you have come across any. 

    Aditya

  • Dear Aditya,

    I also met the problem when running DLOG module every call to the function DLOG_4CH_update(&dlog) in the main_ISR() interrupt:

    #if (VFD_USING_DLOG == true)
    // ------------------------------------------------------------------------------
    //    Call the DATALOG update function.
    // ------------------------------------------------------------------------------
      //!> notes This function is causing to generate an illegal interrupt every calling
      //!? 		 The program counter pointed to ESTOP0 line in pie.c module. I don't understand why???
      //dlog.update(&dlog);
      DLOG_4CH_update(&dlog);
    #endif //#if (VFD_USING_DLOG == true)

    When I compile the program with this section code, the result is no error. But when download code to the DSP and run the debug mode then:

    In the debug window, the program is STOP at ESTOP0 line in the pie.c module as the following figure:

    Up to now I have been still not understood the reason why? The problem is when I use DLOG in ControlSUITE enviroment I had no problems with it!

    I asked for the help from Motorware Team, but when following the link that they gave the problem was not still resolved.

    You can ask for their support together with me!

    Mr. Tran

  • Dear Tran,

    For me, I don't understand how the graph tool works either. It gives haphazard results which I am not able to figure out. I have posted the same here.

    https://e2e.ti.com/support/development_tools/code_composer_studio/f/81/t/489319

    Have you succeeded in plotting the voltage, current waveforms using graph tool? If so please tell me what the DSP datatype, and other parameters in the graph properties must be chosen. 

    Aditya

  • Dear Aditya,

    If you want to understand how to DLOG work, please refer to the series of lessons that is generated by TI:

    C28x_Microcontroller_MDW_5-0.pdf

    I hope you feel this is useful!

    Mr. Tran

  • Tran,

    You posted a request for help in a thread I created, in which I showed several plots that I generated in CodeComposer.  However, those were not created using the dlog module.  Initially, I had tried plotting some variables using the CCS graphing functions, but that was faulty.  The sampling rate was inconsistent, and obviously was also too slow to capture any waveforms.

    As a result, I created what I can only describe as my own dlog setup.  At the time, I didn't know that the dlog existed.  So, to plot my data, I just created a global array in main.c, and stored my data to that location.  Then, I was able to use CCS to pull the waveforms.

    At the top of main.c, I declare the following globals:

    long storedData1[500];

    long storedData2[500];

    unsigned short storedDataIndex = 0;

    Then, I use the following to store data at the appropriate location:

    if (storedDataIndex < 500)
    {
    storedData1[storedDataIndex] = {VARIABLE TO BE STORED};
    storedData2[storedDataindex] = [OTHER VARIABLE TO BE STORED};
    storedDataIndex++;
    }

    Then I use the CCS graphing function to generate the plots, and from there I can download them to Excel.  Under tools, I set up a graph, and then use &storedData1 and &storedData2 as the addresses to plot.  I set the window to 500 points, but if you had a smaller buffer you could use fewer points.

    Unfortunately, I'm not generally familiar with the dlog module or how it works, but this works great for me.

    Hope that helps.

    Matt

  • Dear Matt,

    Thank you for your reply and sharing your solution. It's a creative solution.

    I will apply your method as well as considering more about DLOG.

    Thanks again!