TI E2E 英文论坛海量技术问答的中文版全新上线,可点击相关论坛查看,或在站内搜索 “参考译文” 获取。

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.

IWR6843AOP: iwr6843aop 使用串口UART-B,初始化后,使用UART_read接口,其运行情况跟初始化配置的不对应

Part Number: IWR6843AOP

串口配置如下,

int32_t UartInit(void)
{
    int32_t errCode;

    UART_Params uartParams;
    DMA_Params dmaParams;
    DMA_Handle dmaHandle;

    gUartLastError = UART_ERROR;
    /* Initialize the UART */
    UART_init();

    /* Initialize the DMA for UART */
    DMA_init();

    /* Open the DMA Instance */
    DMA_Params_init(&dmaParams);
    dmaHandle = DMA_open(0, &dmaParams, &errCode);
    if (dmaHandle == NULL)
    {
        printf("Error: Unable to open the DMA Instance [Error code %d]\n", errCode);
        return gUartLastError;
    }

    /* Platform specific configuration */
    UartPlatformInit(&gMmwMssMCB.cfg.platformCfg);

    /* Setup the default UART Parameters */
    UART_Params_init(&uartParams);
    uartParams.writeDataMode = UART_DATA_BINARY;
    uartParams.readDataMode = UART_DATA_BINARY;
    uartParams.clockFrequency = MSS_SYS_VCLK;
    uartParams.baudRate = 921600;
    uartParams.isPinMuxDone = 1U;
    uartParams.dmaHandle = dmaHandle;
    uartParams.txDMAChannel = UART_DMA_TX_CHANNEL;
    uartParams.rxDMAChannel = UART_DMA_RX_CHANNEL;
    uartParams.readEcho = UART_ECHO_OFF;
    uartParams.readReturnMode = UART_RETURN_FULL;

    /* Open the Logging UART Instance: */
    gMmwMssMCB.loggingUartHandle = UART_open(1, &uartParams);
    if (gMmwMssMCB.loggingUartHandle == NULL)
    {
        System_printf("Error: Unable to open the Logging UART Instance\n");
        Pcount3DDemo_debugAssert(0);
        return gUartLastError;
    }

    gUartLastError = UART_OK;

    return gUartLastError;
}
在使用UART_read接口:
static void UartRead_Task(UArg arg0, UArg arg1)
{
    uint8_t rx;
    CLI_write ("[%s]\n", __FUNCTION__);
    while(1)
    {
        int32_t ret = UART_read(gMmwMssMCB.loggingUartHandle, (uint8_t *)&rx, 1U);
        if(ret > 0)
            CLI_write ("UART_read(%d):%u\n", ret, rx);
    }
}
问题点:
1)该 UART_read接口未处于等待接收数据状态,而是一直重复被调用,按照配置是一直等待数据的。
2)另外该task中如果加入Task_sleep()就会系统崩溃,不知啥原因。
但将UART-B换为UART-A,初始化UART-A,则该接口正常.
UART-B的接收处理是怎么做的才正常呢?
  • 请问是自己的板子吗?UARTA和UARTB硬件上接法一样吗?uart TX, RX管脚上的时序正确么?

  • 1)自己的硬件板子,用的是6843。

    2)UARTA和UARTB硬件上接法一样,因为软件上的配置pinmux将他们都可以绑定到相同的引脚出来。

    3)管脚时序看不出,我软件上的配置就是Uart_open时换了一个口,一个是0一个是1,然后UART_read就会有区别,个人感觉应该是驱动层面上的原因。

    4)在ti众多的工程中没看到用UARTB的接收实现例子,只有用它的发送接口。

    请问:

    1)有用过这个UARTB的接收实现参考没?
    2)接收处理这块你们能否测试一下,就是Uart_open时把0换为1(uartA换为uartB),然后pinmux时,引脚绑定改到对应串口,然后观察现象如何?

  • 你好,

    你是否有修改下面标黄部分代码为UartSci_Duplexity_FULL?

    mmwave_sdk_03_05_00_04\packages\ti\drivers\uart\platform\uart_xwr68xx.c

    /**
    * @brief This is the XWR18xx MSS specific UART configuration. There are
    * 2 UART instances available on the MSS. UART1 is tied to SCI-A and UART3 is
    * tied to SCI-B. This should *NOT* be modified by the customer.
    */
    UartSci_HwCfg gUartSciHwCfg[2] =
    {
    /* UART1 Hardware configuration:
    * - Capable of sending and receiving data
    * - PIN MUX is required */
    {
    ((volatile SCIRegs*)SOC_XWR18XX_MSS_SCI_A_BASE_ADDRESS),
    UartSci_Duplexity_FULL,
    UartSci_PinMux_REQUIRED,
    SOC_XWR18XX_MSS_SCIA_LVL0_INT,
    SOC_XWR18XX_MSS_SCIA_TX_DMA_REQ,
    SOC_XWR18XX_MSS_SCIA_RX_DMA_REQ,
    &UartSci_openDMA,
    &UartSci_closeDMA,
    &UartSci_isDMAEnabled,
    &UartSci_initiateRxDMA,
    &UartSci_initiateTxDMA
    },

    /* UART3 Hardware configuration:
    * - Capable of only sending data
    * - PIN MUX is required */
    {
    ((volatile SCIRegs*)SOC_XWR18XX_MSS_SCI_B_BASE_ADDRESS),
    UartSci_Duplexity_TX_ONLY,
    UartSci_PinMux_REQUIRED,
    SOC_XWR18XX_MSS_SCIB_LVL0_INT,
    SOC_XWR18XX_MSS_SCIB_TX_DMA_REQ,
    SOC_XWR18XX_MSS_SCIB_RX_DMA_REQ,
    &UartSci_openDMA,
    &UartSci_closeDMA,
    &UartSci_isDMAEnabled,
    &UartSci_initiateRxDMA,
    &UartSci_initiateTxDMA
    }
    };