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.

RTOS/CC1350: HwiP_disable() function hangs the RTOS code on cc1350

Part Number: CC1350


Tool/software: TI-RTOS

Hi,

For a project we have an msp430fr connected to the cc1350 uart. To flash this msp from the CC1350. To do this I've ported the "CC2640R2Host_UART_BSL_MSP430FR" example, but I'm running into a problem.

When writing the password through UART, it calls an UART_write:

UART_SendByteArray(sendBuffer, PASSWORD_LENGTH + 6);

//*****************************************************************************
// Send byte array through UART ***********************************************
// byteArray: the array of the bytes to write *********************************
// size: the size of the data array *******************************************
//*****************************************************************************
void UART_SendByteArray(uint8_t * byteArray, uint16_t size)
{
    UART_write(uart, byteArray, size);
}

And in the UART_write functiojn it calls the HwIP_disable() function but then it hangs and doesn't continue.

    /* Disable preemption while checking if the UART is in use. */
    key = HwiP_disable();

The code is in the UARTCC26XX.c and this uart works fine on another firmware for this chip.

int_fast32_t UARTCC26XX_write(UART_Handle handle, const void *buffer,
        size_t size)
{
    unsigned int                    key;
    UARTCC26XX_Object               *object;
    UARTCC26XX_HWAttrsV2 const     *hwAttrs;

    /* Get the pointer to the object */
    object = handle->object;
    hwAttrs = handle->hwAttrs;

    /* Check that there is data to write */
    DebugP_assert(size != 0);

    /* Disable preemption while checking if the UART is in use. */
    key = HwiP_disable();
    /* The UART TX is disabled after a successful write, if it is
     * still active another write is in progress, reject. */
    uint32_t writeActive = HWREG(hwAttrs->baseAddr + UART_O_CTL) & (UART_CTL_TXE);
    if (!object->opened || writeActive) {
        HwiP_restore(key);
        DebugP_log1("UART:(%p) Could not write data, uart closed or in use.",
                    ((UARTCC26XX_HWAttrsV2 const *)(handle->hwAttrs))->baseAddr);

        return (UART_ERROR);
    }

We're using the latest "simplelink_cc13x0_sdk_2_30_00_20" and "tirtos_builds_CC1350_LAUNCHXL_release_ccs_2_30_00_20", but with a custom board. 

What can this be??

  • Hmm, I changed our custom board file to the CC13X0_LAUNCHXL board files and now it continues on UART_write but hangs again after that on UART_read at the same point:

    /* Disable interrupts while reading from the ring buffer */
    key = HwiP_disable();

    Strange...
  • Hi Jorick,

    Could you share your board file modifications? Also, what is the contexts from which you perform the UART_write/read calls? How do you setup the UART driver in code?
  • Hi M-W,

    Found it after a lot of debugging, my gpioPinConfigs:

    /*
     * Array of Pin configurations
     * NOTE: The order of the pin configurations must coincide with what was
     *       defined in CC1350_LAUNCHXL.h
     * NOTE: Pins not used for interrupts should be placed at the end of the
     *       array.  Callback entries can be omitted from callbacks array to
     *       reduce memory usage.
     */

    GPIO_PinConfig gpioPinConfigs[] = {
        /* Input pins */
        GPIOCC26XX_DIO_13 | GPIO_DO_NOT_CONFIG,  /* Button 0 */
        GPIOCC26XX_DIO_14 | GPIO_DO_NOT_CONFIG,  /* Button 1 */

        /* Output pins */
        GPIOCC26XX_DIO_07 | GPIO_DO_NOT_CONFIG,  /* Green LED */
        GPIOCC26XX_DIO_06 | GPIO_DO_NOT_CONFIG,  /* Red LED */

        /* Output pins */
        RESET_PIN_CC26XX | GPIO_CFG_OUT_STD | GPIO_CFG_OUT_STR_HIGH | GPIO_CFG_OUT_HIGH,  /* RESET */
        TEST_PIN_CC26XX | GPIO_CFG_OUT_STD | GPIO_CFG_OUT_STR_HIGH | GPIO_CFG_OUT_HIGH,  /* TEST */

    //    GPIOCC26XX_DIO_26 | GPIO_CFG_OUT_STD | GPIO_CFG_OUT_STR_HIGH | GPIO_CFG_OUT_HIGH,  /*SW TX */
        GPIOCC26XX_DIO_26 | GPIO_DO_NOT_CONFIG   /*SW TX */
    };

    didn't match the list below:

    /*!
     *  @def    CC1350_LAUNCHXL_GPIOName
     *  @brief  Enum of GPIO names
     */
    typedef enum CC1350_LAUNCHXL_GPIOName {
        CC1350_LAUNCHXL_GPIO_S1 = 0,
        CC1350_LAUNCHXL_GPIO_S2,
        CC1350_LAUNCHXL_SPI_MASTER_READY,
        CC1350_LAUNCHXL_SPI_SLAVE_READY,
        CC1350_LAUNCHXL_GPIO_LED_GREEN,
        CC1350_LAUNCHXL_GPIO_LED_RED,

        RESET_PIN,
        TEST_PIN,

        SW_UART_TX,
        CC1350_LAUNCHXL_GPIOCOUNT
    } CC1350_LAUNCHXL_GPIOName;

    So the the pin I tried to toggle had an index that fell out of the gpio array. After I removed the SPI entries it works now.