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.

CCS/DRV8312-C2-KIT: how to display more than 4 channels using DATALOG module?

Part Number: DRV8312-C2-KIT

Tool/software: Code Composer Studio

The datalog module only defines 4 inputs. What should I do if I want to show more than 4 input signals? Thanks.

  • Yes, you can define more than 4 inputs, but you have to define more dlog buffer, change _init() and _update() in source code file, and you need to define more pointers for the dlog buffer in header file also.
  • Hi yanming, thanks for your reply.  I want a total 8 channels. I have modified the  header file

    #ifndef __DLOG4CH_H__
    #define __DLOG4CH_H__
     
    #define NULL    0
     
    typedef struct {    long  task;          // Variable:  Task address pointer   
                        int  *iptr1;         // Input: First input pointer (Q15)      
                        int  *iptr2;         // Input: Second input pointer (Q15)         
                        int  *iptr3;         // Input: Third input pointer (Q15)  
                        int  *iptr4;         // Input: Fourth input pointer (Q15)  
                        int  *iptr5;         // Input: First input pointer (Q15)
                        int  *iptr6;         // Input: Second input pointer (Q15)
                        int  *iptr7;         // Input: Third input pointer (Q15)
                        int  *iptr8;         // Input: Fourth input pointer (Q15)
                        int  trig_value;     // Input: Trigger point (Q15)        
                        int  prescalar;      // Parameter: Data log prescale      
                        int  skip_cntr;      // Variable:  Data log skip counter      
                        int  cntr;           // Variable:  Data log counter       
                        long write_ptr;      // Variable:  Graph address pointer               
                        int  size;           // Parameter: Maximum data buffer     
                        int  (*init)();      // Pointer to init function          
                        int  (*update)();    // Pointer to update function         
                   } DLOG_4CH;                
                                                             
    typedef DLOG_4CH *DLOG_4CH_handle;                            
                                                             
    void DLOG_4CH_init(void *);
    void DLOG_4CH_update(void *);                                                         
                                                             
    /*=============================================================================
    Default initalizer for the DLOG_4CH object.
    ==============================================================================*/
                         
    #define DLOG_4CH_DEFAULTS { 0UL, \
                                NULL, \
                                NULL, \
                                NULL, \
                                NULL, \
                                NULL, \
                                NULL, \
                                NULL, \
                                NULL, \
                                0, \
                                1, \
                                0, \
                                0, \
                                0UL, \
                                0x0C0, \
                                (int (*)(int))DLOG_4CH_init, \
                                (int (*)(int))DLOG_4CH_update }
    
    #endif

    And the source code:

               .def  _DLOG_4CH_update 
                    .def  _DLOG_4CH_init
    
    ; Data log buffer definition
    BUFF_SIZE       .set  0C8h
                    
    DLOG_4CH_buff1      .usect "DLOG", BUFF_SIZE
    DLOG_4CH_buff2      .usect "DLOG", BUFF_SIZE
    DLOG_4CH_buff3      .usect "DLOG", BUFF_SIZE
    DLOG_4CH_buff4      .usect "DLOG", BUFF_SIZE
    DLOG_4CH_buff5      .usect "DLOG", BUFF_SIZE
    DLOG_4CH_buff6      .usect "DLOG", BUFF_SIZE
    DLOG_4CH_buff7      .usect "DLOG", BUFF_SIZE
    DLOG_4CH_buff8      .usect "DLOG", BUFF_SIZE
    ;==============================================================================
    ; Initialization Function
    ;==============================================================================
    
    _DLOG_4CH_init:                                     
            MOVL    XAR5,#POS_TRIG_S1
            MOVL    *XAR4,XAR5          ; task=#POS_TRIG_S1 
            ADDB    XAR4,#10            ; XAR4->trig_value
            
            MOV     *+XAR4[2],#0
    
            MOVL    XAR5,#DLOG_4CH_buff1
            MOVL    *+XAR4[4],XAR5      ; write_ptr=DLOG_4CH_buff1
                   
            
            MOV     AL,*+XAR4[6]        ; ACC=size
            MOV     *+XAR4[3],AL        ; cntr=size
            LRETR
                
    ;==============================================================================
    ; Datalog Update Function
    ;==============================================================================
    
    _DLOG_4CH_update:   
            SETC    SXM
            MOVL    XAR5,XAR4           ; XAR4->task
            MOVL    XAR7,*XAR4++        ; XAR4->iptr1, XAR7=task            
            ADDB    XAR5,#10            ; XAR5->trig_value
            LB      *XAR7               ; Branch to TASK    
            
    POS_TRIG_S1:
            MOV     ACC,*XAR5           ; ACC=trig_value
            MOVL    XAR6,*XAR4          ; XAR6=iptr1
            SUB     ACC,*XAR6           ; ACC=(trig_value - *iptr1)
            BF      DL_EXIT,LEQ         ; Exit if ACC <= 0 
                                             
            MOVL    XAR6,#POS_TRIG_S2   
            MOVL    *--XAR4,XAR6        ; task=POS_TRIG_S2
            LRETR
                    
    POS_TRIG_S2:                    
            MOV     ACC,*XAR5           ; ACC=trig_value
            MOVL    XAR6,*XAR4          ; XAR6=iptr1
            SUB     ACC,*XAR6           ; ACC=(trig_value - *iptr1)
            BF      DL_EXIT,GEQ         ; Exit if ACC >= 0 
                                                        
            MOVL    XAR6,#DL_TRIGGERED   
            MOVL    *--XAR4,XAR6        ; task=POS_TRIG_S2
            LRETR
                    
    DL_TRIGGERED:                                   
            INC     *+XAR5[2]           ; skip_cntr=skip_cntr+1
            MOV     ACC,*+XAR5[2]       ; ACC=skip_cntr
            SUB     ACC,*+XAR5[1]       ; ACC=skip_cntr-prescalar
            SBF     DL_EXIT,NEQ         ; if (skip_cntr+1) < prescalar, then exit
            
            MOV     *+XAR5[2],#0        ; skip_cntr=0   
            MOV     ACC,*+XAR5[3]       ; ACC=cntr
            SBF     DLOG_END,EQ 
                            
            DEC     *+XAR5[3]           ; cntr=cntr-1
            ADDB    XAR5,#4             ; XAR5->write_ptr
    
            MOVL    XAR6,*XAR5          ; XAR6=write_ptr
            ADDB    XAR6,#1             ; XAR6=write_ptr+1
            MOVL    *XAR5,XAR6          ; write_ptr=write_ptr + 1
            SUBB    XAR6,#1             ; XAR6=write_ptr
    
            MOV     AR0,#BUFF_SIZE      ; AR0=BUFF_SIZE 
            
                                    
    ; Log sample pointed by IPTR1       
            MOVL    XAR7,*XAR4++        ; XAR7=iptr1
            MOV     AL,*XAR7            ; AL=*iptr1
            NOP     *,ARP6
            MOV     *0++,AL             ; *write_ptr=*iptr1, XAR6=write_ptr+size
    
    ; Log sample pointed by IPTR2           
            MOVL    XAR7,*XAR4++        ; XAR7=iptr2
            MOV     AL,*XAR7            ; AL=*iptr2
            NOP     *,ARP6
            MOV     *0++,AL             ; *write_ptr=*iptr2, XAR6=write_ptr+size
    
    ; Log sample pointed by IPTR3                           
            MOVL    XAR7,*XAR4++        ; XAR7=iptr3
            MOV     AL,*XAR7            ; AL=*iptr3
            NOP     *,ARP6
            MOV     *0++,AL             ; *write_ptr=*iptr3, XAR6=write_ptr+size
    
    ; Log sample pointed by IPTR4                   
            MOVL    XAR7,*XAR4++        ; XAR7=iptr4
            MOV     AL,*XAR7            ; AL=*iptr4
            NOP     *,ARP6
            MOV     *0++,AL             ; *write_ptr=*iptr4, XAR6=write_ptr+size
            LRETR
    
     ; Log sample pointed by IPTR5
            MOVL    XAR7,*XAR4++        ; XAR7=iptr5
            MOV     AL,*XAR7            ; AL=*iptr5
            NOP     *,ARP6
            MOV     *0++,AL             ; *write_ptr=*iptr5, XAR6=write_ptr+size
            LRETR
    
      ; Log sample pointed by IPTR6
            MOVL    XAR7,*XAR4++        ; XAR7=iptr5
            MOV     AL,*XAR7            ; AL=*iptr5
            NOP     *,ARP6
            MOV     *0++,AL             ; *write_ptr=*iptr5, XAR6=write_ptr+size
            LRETR
     ; Log sample pointed by IPTR7
            MOVL    XAR7,*XAR4++        ; XAR7=iptr5
            MOV     AL,*XAR7            ; AL=*iptr5
            NOP     *,ARP6
            MOV     *0++,AL             ; *write_ptr=*iptr5, XAR6=write_ptr+size
            LRETR
    
     ; Log sample pointed by IPTR8
            MOVL    XAR7,*XAR4++        ; XAR7=iptr5
            MOV     AL,*XAR7            ; AL=*iptr5
            NOP     *,ARP6
            MOV     *0++,AL             ; *write_ptr=*iptr5, XAR6=write_ptr+size
            LRETR
    
    ; Reinitialise the module to log the data when the logging is triggered next
            
    DLOG_END: 
    
            MOVL    XAR6,#DLOG_4CH_buff1
            MOVL    *+XAR5[4],XAR6      ; write_ptr=DLOG_4CH_buff1
                   
            MOVL    XAR6,#POS_TRIG_S1   
            MOVL    *--XAR4,XAR6        ; task=POS_TRIG_S2
    
            MOV     AL,*+XAR5[6]        ; ACC=size
            MOV     *+XAR5[3],AL        ; cntr=size
          
    DL_EXIT:        
            LRETR   

  • When I compiled the code, it shows the error :

    "../F28035_RAM_BLDC_Sensorless.CMD", line 90: error: program will not fit into
    available memory. run placement with alignment/blocking fails for section
    ".ebss" size 0x1ce page 1. Available memory ranges:
    dataRAM size: 0x800 unused: 0x1b8 max hole: 0x1b8



    Any suggestions? Thanks.

  • No such large size RAM for dlog buffer, you have to increase RAM size or decrease dlog channels.
  • Hi yanming, thanks for your reply. Because I really need 7 or 8 channels to show the relationship between currents and voltages, do you know how to increase the RAM size? Is there any other way in CCS that I can store the data of different variables? Then I plot figures using other tools.
  • Change the cmd file to increase the section for datalog. If no enough RAM, maybe, you can use F28069 controlCard which device has more RAM.
  • Hi yanming, I only have F28035. How could I change the cmd file? Thanks.
  • Increase dataRAM size in cmd file, it's better to refer to TMS320C28x Assembly Language Tools User's Guide and TMS320C28x Optimizing C, C++ Compiler User's Guide to understand what's the command file and how to configure.