Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 262198

CCS/CC1312R: UART print works fine when debugging, but not when board is flashed

$
0
0

Part Number:CC1312R

Tool/software: Code Composer Studio

I am using a CC1312R chip on a custom board and am having a problem with getting the board to work when flashing. I'm using the simplelink cc13x2_26x2_sdk version 3.10.01.11.

When I use the debug feature in CCS and a XDS110 debug probe, the chip sends the data over UART like it should. However, when I flash the .bin to the chip, I can't get it to print anything over UART (My only way of seeing if the board is running).

I have gotten it to print over UART after being flashed and unattached from the debug probe once, but haven't been able to get it to happen since then.

I'm generating the .bin with "${CCS_INSTALL_ROOT}/utils/tiobj2bin/tiobj2bin.bat" "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}_X_xx.bin" "${CG_TOOL_ROOT}/bin/ofd470.exe" "${CG_TOOL_ROOT}/bin/hex470.exe" "${CCS_INSTALL_ROOT}/utils/tiobj2bin/mkhex4bin.exe" in the post-build steps.

Another possibly related issue is that sometimes I will get garbage values over UART when debugging for only a few specific System_printf() calls (Just a simple "got here" string). The problem seems to happen intermittently. 

My code is as follows: 

/*!
 * @brief       Main task function
 *
 * @param       a0 -
 * @param       a1 -
 */
Void
appTaskFxn(UArg a0, UArg a1)
{
   int32_t retval = 0;


#ifndef POWER_MEAS
#if defined(BOARD_DISPLAY_USE_UART)
   // Initialize  UART0 for manufactory configuration and test
   UART_init ();    //call to simplelink sdk

    /* Enable System_printf(..) UART output */
   UART_Params_init (&uartParams);

   uartParams.baudRate = 9600;
   // Set UART to time out on reads.  readTimeout unit is system clock ticks.
   // CLOCK_TICK_PERIOD is in microseconds.
   uartParams.readTimeout
      = UART_READ_TIMEOUT_SECONDS
      * (MICROSECONDS_PER_SECOND / CLOCK_TICK_PERIOD);
   uartParams.writeDataMode = UART_DATA_BINARY;
   uartParams.readDataMode = UART_DATA_BINARY;

   // Echo causes trouble with external automated test equipment.
   uartParams.readEcho = UART_ECHO_OFF;
   uartCfg = UART_open (Board_UART0, &uartParams);
   // Stall if UART_open failed
   if (uartCfg == NULL)
   {
      while (1)
      {
         ;
      }
   }
   UartPrintf_init (uartCfg);
#endif /* BOARD_DISPLAY_USE_UART */
#endif /* POWER_MEAS */


// ??? BIOS_start seems to clear the RTC, so initialization needs to
// be delayed
// ??? needs attached host computer   time (&secs_1970);
// ??? HWREG(AON_RTC_BASE + AON_RTC_O_SEC) = secs_1970;

#ifdef TIMAC_AGAMA_FPGA
    /* FPGA build disables POWER constraints */
    Power_setConstraint(PowerCC26XX_IDLE_PD_DISALLOW);
    Power_setConstraint(PowerCC26XX_SB_DISALLOW);

    IOCPortConfigureSet(IOID_20, IOC_PORT_RFC_GPO0, IOC_STD_OUTPUT);
    IOCPortConfigureSet(IOID_18, IOC_PORT_RFC_GPI0, IOC_STD_INPUT);
    // configure RF Core SMI Command Link
    IOCPortConfigureSet(IOID_22, IOC_IOCFG0_PORT_ID_RFC_SMI_CL_OUT, IOC_STD_OUTPUT);
    IOCPortConfigureSet(IOID_21, IOC_IOCFG0_PORT_ID_RFC_SMI_CL_IN, IOC_STD_INPUT);

#endif

#ifndef OSAL_PORT2TIRTOS
    /* Initialize ICall module */
    ICall_init();
#endif
//    /* Copy the extended address from the CCFG area */
//    memcpy(ApiMac_extAddr, (uint8_t *)&(__ccfg.CCFG_IEEE_MAC_0),
//           (APIMAC_SADDR_EXT_LEN / 2));
//    memcpy(ApiMac_extAddr + (APIMAC_SADDR_EXT_LEN / 2), (uint8_t *)&(__ccfg.CCFG_IEEE_MAC_1),
//           (APIMAC_SADDR_EXT_LEN / 2));

    /* Check to see if the CCFG IEEE is valid */
// Just use the hardware address. Ignore what may be in the ccfg file.
//    if(memcmp(ApiMac_extAddr, dummyExtAddr, APIMAC_SADDR_EXT_LEN) == 0)
    {
        /* No, it isn't valid.  Get the Primary IEEE Address */
        memcpy(ApiMac_extAddr, (uint8_t *)(FCFG1_BASE + EXTADDR_OFFSET),
               (APIMAC_SADDR_EXT_LEN));
    }

    Task_sleep(300000);  //Sleep for 3 seconds to let clock stabilize? Suggestion online
   System_printf("In appTaskFxn\r\n");
   retval = SysCtrlResetSourceGet ();
   System_printf ("Reset source = %d\r\n", retval);
   Task_sleep (0x2000);


   /* Initialize the application */
#ifdef OSAL_PORT2TIRTOS
   Sensor_init(_macTaskId);
#else
   ICall_createRemoteTasks();

   /* Initialize the application */
   Sensor_init();
#endif

    /* Kick off application - Forever loop */
    while(1)
    {
        System_printf("In loop...");
        //Wait 1 second
        Task_sleep(100000);
    }
}


int main(void)
{
    Task_Params taskParams;
        int32_t retval = 0;
    #ifndef USE_DEFAULT_USER_CFG
        macUser0Cfg[0].pAssertFP = macHalAssertHandler;
    #endif

        /*
         Initialization for board related stuff such as LEDs
         following TI-RTOS convention
         */
        PIN_init(BoardGpioInitTable);

    #if defined(POWER_MEAS)
        /* Disable external flash for power measurements */
        Board_shutDownExtFlash();
    #endif

    // ??? We use SPI even if not OAD
    // #if defined(FEATURE_BLE_OAD) || defined(FEATURE_NATIVE_OAD)
        SPI_init();
    // #endif

        i2cSetup ();

        //init_config_phy_id (); // macTaskInit needs this information.
        //Removed for SafeSense integration


    #ifdef OSAL_PORT2TIRTOS
       _macTaskId = macTaskInit(macUser0Cfg);
    #endif

        /* Configure task. */
        Task_Params_init(&taskParams);
        taskParams.stack = appTaskStack;
        taskParams.stackSize = APP_TASK_STACK_SIZE;
        taskParams.priority = APP_TASK_PRIORITY;
        Task_construct(&appTask, appTaskFxn, &taskParams, NULL);

    #ifdef DEBUG_SW_TRACE
        IOCPortConfigureSet(IOID_8, IOC_PORT_RFC_TRC, IOC_STD_OUTPUT
                        | IOC_CURRENT_4MA | IOC_SLEW_ENABLE);
    #endif /* DEBUG_SW_TRACE */

        BIOS_start(); /* enable interrupts and start SYS/BIOS */

        return (0);
    }

Please let me know if you need any other information. I appreciate any help with this.


Viewing all articles
Browse latest Browse all 262198

Trending Articles