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.

Compiler/CC2640R2F: HWREG freeze on my code

Part Number: CC2640R2F


Tool/software: TI C/C++ Compiler

Hi team

I need to generate some random numbers, so I follow the example from 

rfEasyLinkListenBeforeTalk_CC2640R2_LAUNCHXL_tirtos_ccs

My code seem to hang on using the HWREG micro

    System_printf("test printf <- this print OK\n");
    System_flush();

    System_printf("data in memory: %x", HWREG(TRNG_BASE + TRNG_O_CTL)); // <<== my code freeze here
    System_flush();

    System_printf("test printf <- this DOES NOT print\n");
    System_flush();

So I imported a new empty project and test the above code again, it freeze on a new empty project as well. Here is what my code looks like from a new empty_CC2640R2_LAUNCHXL_tirtos_ccs. I am testing it on the cc2640r2f launch pad. So what am I missing here??

/*
 *  ======== empty.c ========
 */

/* For usleep() */
#include <unistd.h>
#include <stdint.h>
#include <stddef.h>

/* Driver Header files */
#include <ti/drivers/GPIO.h>
// #include <ti/drivers/I2C.h>
// #include <ti/drivers/SPI.h>
// #include <ti/drivers/UART.h>
// #include <ti/drivers/Watchdog.h>

/* Board Header file */
#include "Board.h"

// ===============================================================
// my codes, new header for Systme_printf() and micro defines
// ===============================================================

/* Driverlib Header files */
#include <ti/devices/DeviceFamily.h>
#include DeviceFamily_constructPath(driverlib/trng.h)

/* XDC Module Headers */
#include <xdc/std.h>
#include <xdc/runtime/System.h>

// ============ END ==============================================

/*
 *  ======== mainThread ========
 */
void *mainThread(void *arg0)
{
    /* 1 second delay */
    uint32_t time = 1;

    /* Call driver init functions */
    GPIO_init();
    // I2C_init();
    // SPI_init();
    // UART_init();
    // Watchdog_init();

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

    /* Turn on user LED */
    GPIO_write(Board_GPIO_LED0, Board_GPIO_LED_ON);



    // ===============================================================
    // my code starts here
    // ===============================================================
    System_printf("test printf <- this print OK\n");
    System_flush();

    System_printf("data in memory: %x", HWREG(TRNG_BASE + TRNG_O_CTL));  // <<== freeze here, can't get pass HWREG()
    System_flush();

    System_printf("test printf <- this DOES NOT print\n");
    System_flush();
    // ============ END ==============================================

    while (1) {
        sleep(time);
        GPIO_toggle(Board_GPIO_LED0);
    }
}