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.

[参考译文] CC2642R:为2个任务调用 UART2_WRITE 会导致硬故障

Guru**** 2589275 points
Other Parts Discussed in Thread: SYSCONFIG

请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/wireless-connectivity/bluetooth-group/bluetooth/f/bluetooth-forum/1387852/cc2642r-calling-uart2_write-for-2-tasks-will-cause-a-hardfault

器件型号:CC2642R
主题中讨论的其他器件:SysConfig

工具与软件:

您好、团队

  SDK:C:\ti\simplelink_cc13xx_cc26xx_sdk_7_41_00_17。

  代码:

int bsp_uart_open(uint32_t baudrate, UART_FNCT_RESPONSE respfnct)
{
    (void)baudrate;

    UART2_Params uartParams;
    /* Create a UART where the default read and write mode is BLOCKING */
    UART2_Params_init(&uartParams);
    uartParams.readMode     = UART2_Mode_NONBLOCKING;
    uartParams.writeMode    = UART2_Mode_BLOCKING;
    uartParams.baudRate     = UART_DEBUG_BAUDRATE;
    uart2_1_handle = UART2_open(CONFIG_UART_1_DEBUG, &uartParams);
    if (uart2_1_handle == NULL)
    {
        /* UART2_1_open() failed */
        DEBUG_ASSERT(0);
        return -1;
    }
    
    /* Create a UART in CALLBACK read mode */
    UART2_Params_init(&uartParams);
    uartParams.readMode     = UART2_Mode_NONBLOCKING;
    uartParams.writeMode    = UART2_Mode_BLOCKING;
    uartParams.baudRate     = UART_MCU_BAUDRATE;
    uart2_0_handle = UART2_open(CONFIG_UART_0_BLE, &uartParams);
    if (uart2_0_handle == NULL)
    {
        /* UART2_0_open() failed */
        DEBUG_ASSERT(0);
        return -1;
    }

    gBspUARTStat.respfnct  = respfnct;
    gBspUARTStat.open_flag = true;

    return 0;
}

在前一个任务调用 UART2_WRITE 后、下一个任务调用该写入接口函数会发生硬故障。  

错误代码:

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好!

    感谢您的咨询。

    请问您是如何在 SysConfig 中配置 UART2的、以及在哪里调用 UART2_WRITE ()呢?

    BR、

    David。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好!

    在计时器回调函数和任务中调用。   我配置了 UART2_Mode_nonblocking 模式、以便不会出现硬故障、但发送的串行端口数据将丢失

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好!

    您能在此处多讲一讲这个用例吗? 由计时器触发的任务和回调函数是否可以同时使用 UART 结束?

    BR、

    David