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.

[参考译文] AM13E23019:UART5 线路超时和 RX 超时中断延迟

Guru**** 2999690 points

Other Parts Discussed in Thread: SYSCONFIG

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

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1648759/am13e23019-uart5-line-timeout-and-rx-timeout-interrupt-delays

部件号: AM13E23019
主题: SysConfig 中讨论的其他器件

大家好、在我的应用中、我需要检查 Rx 线路是否空闲、然后需要尽快生成中断。 我尝试使用以下 SysConfig 设置实现此目的  

image.png

退出我的应用程序  

 #define APP_UART_TRANSFER_SIZE (0x8U)
uint8_t tcf_txbuffer[APP_UART_TRANSFER_SIZE]={'T', 'C', 'F', 'T', 'E', 'S', 'T', ' '};
uint8_t ncf_txbuffer[APP_UART_TRANSFER_SIZE]={'N', 'C', 'F', 'T', 'E', 'S', 'T', ' '};
uint8_t tcf_rxbuffer[APP_UART_TRANSFER_SIZE], ncf_rxbuffer[APP_UART_TRANSFER_SIZE];
uint8_t txCount = 0, rxCount = 0;

us8 index = 0;
uint8_t uart_interrupt_graph[22][100];


main()
{

     /* Testing UART */
    while (txCount < APP_UART_TRANSFER_SIZE)
    {
        DL_UART_transmitData(APP_UART_0_INST, tcf_txbuffer[txCount]);
        txCount++;
    }
    
    while(DL_UART_isBusy(APP_UART_0_INST));
    
    /* Code to generate Break Character */
    DL_UART_enableLINSendBreak(APP_UART_0_INST);
    DL_Common_delayCycles(188330);
    DL_UART_disableLINSendBreak(APP_UART_0_INST); 

    txCount = 0;
    while (txCount < APP_UART_TRANSFER_SIZE)
    {
        DL_UART_transmitData(APP_UART_0_INST, ncf_txbuffer[txCount]);
        txCount++;
    }

    while(1)
    {
    // Superloop
    }
}

// ISRs
__attribute__((section(".TI.ramfunc")))
extern "C" void APP_UART_0_INT_Handler()
{
    g_diagCounters.uartIsrCount++;
    uint32_t interruptStatus = DL_UART_getPendingInterrupt(APP_UART_0_INST);
    uart_interrupt_graph[interruptStatus][index] = 1;
    index++;
    switch (interruptStatus)
    {
    //     /* UART interrupt index for end of transmission */
        case DL_UART_IIDX_EOT_DONE:
        {
            // LOG("UART IIDX: EOT_DONE\r\n");
            BSP_AM13E230_E2::Debug1Pin_Toggle();
            break;
        }
        /* UART interrupt index for Line Time Out */
        case DL_UART_IIDX_LTOUT:
        {
            // LOG("UART IIDX: LTOUT\r\n");
            BSP_AM13E230_E2::Debug3Pin_Toggle();
            break;
        }
        /* UART interrupt index for receive timeout */
        case DL_UART_IIDX_RX_TIMEOUT_ERROR:
        {
            BSP_AM13E230_E2::Debug2Pin_Toggle();
            // LOG("UART IIDX: RX_TIMEOUT_ERROR\r\n");
            break;
        }
    }
}





image.png

注意:TX 和 RX 引脚外部环回、逻辑分析仪通道 0 与其连接。 优化级别为-O2

问题:  

  1. 计算得出的 RX 超时中断= 150 ns 意味着什么(在 sysconfig 中)。 它是否要取决于波特率? 如何决定这一点?
  2. 我看到 Tx 超时和线路超时的延迟约为 1.5ms
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。



    以下是显示数据传输结束和 ISR 超时执行之间 1.5 ms 延迟的屏幕截图。 上面的印刷错误(Rx 超时和线路超时延迟 1.5 毫秒)
    令人惊讶的是、当我将波特率配置为 115200 时、该延迟最多可以达到 15-20ms  

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

    尊敬的 Dheeraj:

    IFLS.RXTOSEL 字段选择 UART 中 RX 超时中断标志的时序 (x)。 如果 RX FIFO 中至少有一个元素、并且在 x 段时间后没有接收到起始边沿、则会设置该标志。 请参阅以下说明:

    另一方面、当一个字符周期内没有起始边沿(基于配置的波特率)并且 RX FIFO 的状态无效时、则触发线路超时中断。

    请告诉我这是否合理。

    此致、

    Delaney

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

    我使用的是预发行版用户指南、但信息不清楚。 感谢您的输入。  




    除此之外、我确实在 SysConfig 中看到了一个错误。 SysConfig 在计算 RX 超时时时时似乎考虑了 Semi-MCLK 、而不是波特率。  
    请检查并确认。  



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

    尊敬的 Dheeraj:

    是的、您说得对。 SysConfig 使用 UART 时钟 (Semi-MCLK) 计算 RX 超时、而不是波特率。

    SysConfig 中的实际计算(来自 uart_common.syscfg.js)(972-981 行):

    function getRXTimeoutCalc(inst) {
        let sourceClkFreq;
        let timeout;
        
        sourceClkFreq = getUARTClockSourceFreq(inst); // Gets UART clock frequency
        
        timeout = (inst.rxTimeoutValue) / sourceClkFreq; // Simple division
        
        return timeout;
    }

    其中 getUARTClockSourceFreq()(第 745-752 行)返回:

    function getUARTClockSourceFreq(inst) {
        let uartClockFreq = common.getBUSCLKFreq("UART"); // Get BUSCLK
        uartClockFreq = uartClockFreq / inst.uartClkDiv.slice(-1); // Apply divider
        return uartClockFreq;
    }

    因此、计算公式如下:

    超时(秒)= rxTimeoutValue / Clock_Frequency

    其中:
    UART_ClkDiv = Clock_Frequency


    我已经提交了一个 JIRA 来得到这个纠正: jira.itg.ti.com/.../MSDK-2369

    此致、
    Shaunak