Showing posts with label CC2652. Show all posts
Showing posts with label CC2652. Show all posts

Tuesday, September 1, 2020

How to remove OAD feature on CC26x2/CC13x2 project_zero

 The following steps show you how to remove OAD feature on CC26x2/CC13x2 project_zero

 1. Replace C:\ti\simplelink_cc13x2_26x2_sdk_4_10_03_02_eng\examples\rtos\CC26X2R1_LAUNCHXL\ble5stack\project_zero\tirtos\ccs\cc13x2_cc26x2_app.cmd
   with C:\ti\simplelink_cc13x2_26x2_sdk_4_10_03_02_eng\examples\rtos\CC26X2R1_LAUNCHXL\ble5stack\simple_peripheral\tirtos\ccs\cc13x2_cc26x2_app.cmd
   
2. Check "Exclude from build" on project_zero OAD folder in CCS Project Explorer.

3. Remove all OAD_xxx related code from projec_zero.c and _imgHdr

4. Change project_zero_app.cfg

m3Hwi.nvicCCR.UNALIGN_TRP = 0;
//m3Hwi.nvicCCR.UNALIGN_TRP = 1;

/* Put reset vector after OAD metadata */
var compilerOpts = prog.build.target.ccOpts.prefix; // Get the target compiler options
var regex = /(?:\-\-define\=)(\w*)(?:\=*\w*\s)/g;
var compilerDefs = [];
while ((tmp = regex.exec(compilerOpts)) !== null) compilerDefs.push(tmp[1]); // Parse compiler symbols

if (compilerDefs.indexOf('SECURITY') > -1) { // Check for SECURITY compiler symbol
    m3Hwi.resetVectorAddress = 0x90; // Image B Reset Vector Address
}
else {
    m3Hwi.resetVectorAddress = 0x50; // Image A Reset Vector Address
}

/* Put interrupt vector at start of RAM so interrupts can be configured at runtime */
m3Hwi.vectorTableAddress  = 0x20000000;

To

m3Hwi.nvicCCR.UNALIGN_TRP = 0;
//m3Hwi.nvicCCR.UNALIGN_TRP = 1;

/* Put reset vector at start of Flash */
m3Hwi.resetVectorAddress  = 0x0;

/* Put interrupt vector at start of RAM so interrupts can be configured at runtime */
m3Hwi.vectorTableAddress  = 0x20000000;

Tuesday, June 16, 2020

How to use two UARTs in CC26x2 and CC13x2.

The following steps show you how to enable second UART in CC26x2 and CC13x2 using uartecho example.

1. Add second UART CONFIG_UART_1 from syscfg with the following steps



2. Add the following red codes to use CONFIG_UART_1.

void *mainThread(void *arg0)
{
    char        input;
    const char  echoPrompt[] = "Echoing characters:\r\n";
    const char  echo1Prompt[] = "UART 2 Echoing characters:\r\n";
    UART_Handle uart;
    UART_Params uartParams;
    UART_Handle uart1;
    UART_Params uart1Params;


    /* Call driver init functions */
    GPIO_init();
    UART_init();

    /* Configure the LED pin */
    GPIO_setConfig(CONFIG_GPIO_LED_0, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);

    /* Turn on user LED */
    GPIO_write(CONFIG_GPIO_LED_0, CONFIG_GPIO_LED_ON);

    /* Create a UART with data processing off. */
    UART_Params_init(&uartParams);
    uartParams.writeDataMode = UART_DATA_BINARY;
    uartParams.readDataMode = UART_DATA_BINARY;
    uartParams.readReturnMode = UART_RETURN_FULL;
    uartParams.baudRate = 115200;

    uart = UART_open(CONFIG_UART_0, &uartParams);

    if (uart == NULL) {
        /* UART_open() failed */
        while (1);
    }

    /* Create second UART with data processing off. */
    UART_Params_init(&uart1Params);
    uart1Params.writeDataMode = UART_DATA_BINARY;
    uart1Params.readDataMode = UART_DATA_BINARY;
    uart1Params.readReturnMode = UART_RETURN_FULL;
    uart1Params.baudRate = 115200;

    uart1 = UART_open(CONFIG_UART_1, &uart1Params);

    if (uart1 == NULL) {
        /* UART_open() failed */
        while (1);
    }

    UART_write(uart, echoPrompt, sizeof(echoPrompt));
    UART_write(uart1, echo1Prompt, sizeof(echo1Prompt));

    /* Loop forever echoing */
    while (1) {
        if(UART_read(uart, &input, 1))
            UART_write(uart, &input, 1);
    }

3. Build and run uartecho and now you can see "UART 2 Echoing characters:" output from the seconds UART TX pin.