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/LAUNCHXL-F28027F: Debugger settings and UART option

Part Number: LAUNCHXL-F28027F
Other Parts Discussed in Thread: BOOSTXL-DRV8305EVM, MOTORWARE

Tool/software: Code Composer Studio


Hi ,

I have LAUNCHXL-F28027F and BOOSTXL-DRV8305EVM
I have some 4 questions.
   1. I wanted to modify and  then build proj_lab02c.c and then run and step thru source in the debugger.
       When I change the optimization level to off, I get the below set of errors. 

        ./gpio.obj" "./hal.obj" "./ipark.obj" "./memCopy.obj" "./offset.obj" "./osc.obj" "./park.obj" "./pid.obj" "./pie.obj" "./pll.obj"
        "./proj_lab02c.obj" "./pwm.obj" "./pwr.obj" "./spi.obj" "./svgen.obj" "./timer.obj" "./traj.obj"
        "./usDelay.obj" "./user.obj" "./wdog.obj" "C:/ti/motorware/motorware_1_01_00_17/sw/ide/ccs/cmd/f2802x/F28027F.cmd"  -llibc.a
         <Linking>
        "C:/ti/motorware/motorware_1_01_00_17/sw/ide/ccs/cmd/f2802x/F28027F.cmd", line 112: error #10099-D:

           program will not fit into available memory.  placement with
        >> Compilation failure
        makefile:173: recipe for target 'proj_lab02c.out' failed
           alignment/blocking fails for section ".text" size 0x6129 page 0.  Available
           memory ranges:
           FLASHB_D     size: 0x6000       unused: 0x5def       max hole: 0x5def   
        error #10010: errors encountered during linking; "proj_lab02c.out" not built
        gmake: *** [proj_lab02c.out] Error 1
        gmake: Target 'all' not remade because of errors.  

Should I not be able to turn it off?

2.  Is there any other debug configuration mode other than "flash (Active)"
3.   if I flash my new code, will the system still run?
4.  Can I add "uart" to do printf as a debug option? If so, is there an example?

I am attaching the code composer setting.

Thank you,
AshaDebugquestion.docx

  • 1) You can try allocating additional memory from D_FLASHA to FLASHB_D, but you must leave enough for the .econst and .switch sections
    2) Not by default, but you can create additional configs as necessary
    3) Depends on what the code is that you've flashed. If you've made significant changes to lab2c, then proper code execution will depend on those changes being correct.
    4) Yes, you can add UART to communicate to a laptop/desktop Terminal program. There are no examples, but I've laid out the steps to adding UART into a Motorware project here: e2e.ti.com/.../2078355. Please use the correct switch settings to route UART through JTAG to your computer, and then initialize the same UART module (A or B) to communicate to a Terminal

    Sean
  • Thank you for your input. I unstalled and restalled motorware, CCSv7, and relaunced and got it resolved that way.
    I am now making changes to proj_lab05a.c because my system will be applying torque and velocity.
    I ran all applicable labs upto this point.

    Concerning your uart suggestion, I looked at it and I also looked at the thread
         e2e.ti.com/.../2078213 where
         they provided the code that I used in the below set of changes but when I launch the teraterm,
         I do not see the output.  Should I not see the output?  I have stepped thru the code and it is executing
         thru the changes.
        
         Also, I am assuming that we are usig GPIO 28(SCIRXDA) and GPIO 29(SCITXDA)
        
         Are you saying that in order to see the uart output, I need to put the S1, 3rd switch down?
        
         I cannot use the Jtag and UART output at the same time?
        

    I am attaching my changes to the lab proj_lab05a. Essentialy my changes are from https://e2e.ti.com/support/microcontrollers/c2000/f/171/p/566771/2078213#2078213 where at the end, a zip file is attached with all the changes.

    Below are the changes:
    
    (1) hal.h -- (C:\ti\motorware\motorware_1_01_00_17\sw\modules\hal\boards\boostxldrv8305_revA\f28x\f2802x\src)
        
            extern interrupt void sciaRxFifoIsr(void);
            extern void HAL_sciaWrite(HAL_Handle handle, const uint16_t data);
             extern void HAL_setupSciA(HAL_Handle handle); 
            extern void HAL_sciaWrite(HAL_Handle handle, const uint16_t data); 
            extern uint16_t Hal_sciaRead(HAL_Handle handle); 
            extern void HAL_sciaClearRxFifoOvf(HAL_Handle handle); 
            extern void HAL_sciaClearRxFifoInt(HAL_Handle handle); 
            extern SCI_FifoStatus_e Hal_sciaGetTxFifoStatus(HAL_Handle handle); 
            extern void HAL_pieClearInt(HAL_Handle handle, const PIE_GroupNumber_e groupNumber); 
    
        
           Inline function HAL_initIntVectorTable()
                Added pie->SCIRXINTA = &sciaRxFifoIsr;
    
    (2) hal_obj.c (C:\ti\motorware\motorware_1_01_00_17\sw\modules\hal\boards\boostxldrv8305_revA\f28x\f2802x\src)
          #include "sw/drivers/sci/src/32b/f28x/f2802x/sci.h"
    
          Added to "typedef struct _HAL_Obj_"
               SCI_Handle 	sciaHandle;
               SCI_Obj       scia;
    
    (3) hal.c
            Modified HAL_init() by adding:
                obj->sciaHandle = SCI_init((void *) SCIA_BASE_ADDR, sizeof(SCI_Obj));
        
         
        Modified HAL_setParams() by adding  
             HAL_setupSciA(handle); 
            
       Modified HAL_setupGpios() by adding
                GPIO_setPullUp(obj->gpioHandle, GPIO_Number_28, GPIO_PullUp_Enable);
          
                GPIO_setPullUp(obj->gpioHandle, GPIO_Number_29, GPIO_PullUp_Enable);
    
          
                GPIO_setQualification(obj->gpioHandle, GPIO_Number_28, GPIO_Qual_ASync);
    
          
                GPIO_setMode(obj->gpioHandle, GPIO_Number_28, GPIO_28_Mode_SCIRXDA);
          
                GPIO_setMode(obj->gpioHandle, GPIO_Number_29, GPIO_29_Mode_SCITXDA);
    
    
      Added Below set of functions
    
    =========================================================================================
    // **************************************************************************
    // the functions
    
    //Added
    
    void HAL_setupSciA(HAL_Handle handle) {
        HAL_Obj *obj = (HAL_Obj *) handle;
    
        //CLK_enableSciaClock(obj->clkHandle); // no need to call again, already set in HAL_setupPeripheralClks() -maria-
    
        // SCI stop bit, parity, loopback, char bits, idle/address mode (SCICCR = 0x07)
        SCI_setNumStopBits(obj->sciaHandle, SCI_NumStopBits_One);    // SCICCR bit 7
        SCI_enableParity(obj->sciaHandle);                                               // SCICCR bit 5
        SCI_setParity(obj->sciaHandle, SCI_Parity_Even);                          // SCICCR bit 6
        SCI_disableLoopBack(obj->sciaHandle);                                        // SCICCR bit 4
        SCI_setMode(obj->sciaHandle, SCI_Mode_IdleLine);                     // SCICCR bit 3
        SCI_setCharLength(obj->sciaHandle, SCI_CharLength_8_Bits);   // SCICCR bit 0-2
    
        // TX enable, RX enable, RX ERR INT enable, SLEEP, TXWAKE (SCICTL1 = 0x03)
        SCI_disableRxErrorInt(obj->sciaHandle);                        // SCICTL1 bit 6
        SCI_disable(obj->sciaHandle);                                        // SCICTL1 bit 5
        SCI_disableTxWake(obj->sciaHandle);                           // SCICTL1 bit 3
        SCI_disableSleep(obj->sciaHandle);                              // SCICTL1 bit 2
        SCI_enableTx(obj->sciaHandle);                                    // SCICTL1 bit 1
        SCI_enableRx(obj->sciaHandle);                                    // SCICTL1 bit 0
    
    	// TXINT enable, RXINT enable, TXEMPTY, TXRDY (SCICTL2 = 0x03)
    	SCI_enableRxInt(obj->sciaHandle);                            // SCICTL2 bit 1
    	SCI_disableTxInt(obj->sciaHandle);                            // SCICTL2 bit 0
    
    	// SCIH-SCIL BAUD - SCI_BAUD = (LSPCLK/(SCI_BRR*8)) - 1
    	SCI_setBaudRate(obj->sciaHandle, SCI_BaudRate_9_6_kBaud);
    
    	// Reset SCI
    	SCI_enable(obj->sciaHandle);
    
    	//  PIE_enableSciInt(obj->pieHandle, SCI_RXA);                 // enable SCI interrupt
    	PIE_enableInt(obj->pieHandle, PIE_GroupNumber_9, PIE_InterruptSource_SCIARX);
    
    	//CPU_enableGlobalInts(obj->cpuHandle); // no need to call again -maria-
    	CPU_enableInt(obj->cpuHandle, CPU_IntNumber_9);    // enable CPU interrupt
    
    	SCI_resetTxFifo(obj->sciaHandle);
    	SCI_clearTxFifoInt(obj->sciaHandle);
    	SCI_resetChannels(obj->sciaHandle);
    	SCI_setTxFifoIntLevel(obj->sciaHandle, SCI_FifoLevel_Empty);
    
    	SCI_resetRxFifo(obj->sciaHandle);
    	SCI_clearRxFifoInt(obj->sciaHandle);
    	//    SCI_setRxFifoIntLevel(mySci, SCI_FifoLevel_4_Words);
    	SCI_setRxFifoIntLevel(obj->sciaHandle, SCI_FifoLevel_1_Word);
    	//SCI_disableLoopBack(obj->sciaHandle);
    
    }
    
    //Added by Maya
    void HAL_sciaWrite(HAL_Handle handle, const uint16_t data) {
    	HAL_Obj *obj = (HAL_Obj *) handle;
    
    	SCI_write(obj->sciaHandle, data);
    }
    //SCI
    
    uint16_t Hal_sciaRead(HAL_Handle handle){
    	HAL_Obj *obj = (HAL_Obj *) handle;
    
    	return SCI_read(obj->sciaHandle);
    }
    
    
    // Clear Overflow flag
    void HAL_sciaClearRxFifoOvf(HAL_Handle handle)
    {
    	HAL_Obj *obj = (HAL_Obj *) handle;
    
    	SCI_clearRxFifoOvf(obj->sciaHandle);
    }
    
    
    // Clear Interrupt flag
    void HAL_sciaClearRxFifoInt(HAL_Handle handle)
    {
    	HAL_Obj *obj = (HAL_Obj *) handle;
    
    	SCI_clearRxFifoInt(obj->sciaHandle);
    }
    
    
    SCI_FifoStatus_e Hal_sciaGetTxFifoStatus(HAL_Handle handle)
    {
    	HAL_Obj *obj = (HAL_Obj *) handle;
    
    	return SCI_getTxFifoStatus(obj->sciaHandle);
    }
    
    // Issue PIE ack
    void HAL_pieClearInt(HAL_Handle handle, const PIE_GroupNumber_e groupNumber)
    {
    	HAL_Obj *obj = (HAL_Obj *) handle;
    
    	PIE_clearInt(obj->pieHandle, groupNumber);
    }
    =========================================================================================
    
    (4) main.h (C:\ti\motorware\motorware_1_01_00_17\sw\solutions\instaspin_foc\src)
          Added 
           interrupt void sciaRxFifoIsr(void); 
           
    (5)  proj_lab05a.c
         Added below code after the   "for(;;)"
    
     for(;;)
      {
    
    
    		//GPIO_setHigh(gpioHandle, GPIO_Number_18);
    	  	HAL_setGpioHigh(halHandle,GPIO_Number_18);
    		usDelay(2000);
    
    		scia_xmit(0xA2);
    
    		if(encoderTipoLeitura == 0)
    		{
    			scia_xmit(0xB0);
    		}
    		else
    		{
    			scia_xmit(0xB3);
    		}
    
    		//scia_xmit(0x00);
    
    		 while(Hal_sciaGetTxFifoStatus(halHandle) != SCI_FifoStatus_Empty);
    
    		//while(SCI_txReady(sciaHandle) == 0);
    
    		//while(SCI_isTxEmpty(sciaHandle) == 0);
    
    	//	inc = 0;
    
    		usDelay (1000);
    
    		//GPIO_setLow(gpioHandle, GPIO_Number_18);
    		HAL_setGpioLow(halHandle,GPIO_Number_18);
    
    		usDelay(50000);
    
    		if(encoderTipoLeitura == 0)
    		{
    			encoderTipoLeitura = 1;
    		}
    		else
    		{
    			encoderTipoLeitura = 0;
    
    			usDelay(50000);
    		}
    
    //     --------------------------------x--------------------------
    
    
     
    
    / -----------------------------SCI------------------------------
    
    interrupt void sciaRxFifoIsr(void)
    {
    	if(inc < 3)
    		{
    
    		if(encoderTipoLeitura == 0)
    			{
    				msgRXDec[inc] = Hal_sciaRead(halHandle);
    
    			}
    
    			else
    			{
    				msgRXInc[inc] = Hal_sciaRead(halHandle);
    
    			}
    
    			inc++;
    
    		}
    
    	// Clear Overflow flag
    	HAL_sciaClearRxFifoOvf(halHandle);
    
    	// Clear Interrupt flag
    	HAL_sciaClearRxFifoInt(halHandle);
    
    	// Issue PIE ack
    	HAL_pieClearInt(halHandle, PIE_GroupNumber_9);
    
    	return;
    }
    
    
    // Transmit a character from the SCI
    void scia_xmit(int a)
    {
    //    while (SciaRegs.SCIFFTX.bit.TXFFST != 0) {}
        while(Hal_sciaGetTxFifoStatus(halHandle) != SCI_FifoStatus_Empty);
    
    //    SciaRegs.SCITXBUF=a;
        //SCI_putDataBlocking(sciaHandle, a);
        HAL_sciaWrite(halHandle, a); //try to use this -maria-
    //    SCI_write(sciaHandle, a);
    
    }
    
    // ----------------------------- x ------------------------------
    
    

    Thanks,

    Asha