hitiger
hitiger
这家伙很懒,什么也没写!

注册于 2年前

回答
1
文章
0
关注者
0

case DEMO_MSG_UART_RECEIVE_DATA:

    {
        rx_len = uart->rx_data_len;
        while (rx_len > 0)
        {
            printf("\n----1  rx_len----%d", rx_len);
            len = (rx_len > DEMO_UART_RX_BUF_SIZE) ? DEMO_UART_RX_BUF_SIZE : rx_len;
            printf("\n----2  len----%d", len);
            memset(uart->rx_buf, 0, (DEMO_UART_RX_BUF_SIZE + 1));
            tls_uart_read(TLS_UART_1, msg_rxfifo_buf, len);
            tls_uart_read(TLS_UART_1, rx_fifo_buf1[0], len);
            printf("\n----####  msg_rxfifo_buf----%s\n", msg_rxfifo_buf);
            printf("\n----####  rx_fifo_buf1[0]----%s\n", rx_fifo_buf1[0]);
            ret = tls_uart_read(TLS_UART_1, (u8 *)uart->rx_buf, len);
            ret = tls_uart_read(TLS_UART_1, (u8 *)uart->rx_buf, len); /* input */
            printf("\n----####  DEMO_MSG_UART_RECEIVE_DATA----%s\n", uart->rx_buf);
            printf("\n----3  ret----%d", ret);

            if (ret <= 0)
            {
                break;
            }

            rx_len -= ret;
            uart->rx_data_len -= ret;

if USE_DMA_TX_FTR

            // tls_uart_dma_write(uart->rx_buf, len, uart_dma_done, TLS_UART_1);

else

            tls_uart_write(TLS_UART_1, uart->rx_buf, len); /* output */
            printf("\n----4  DEMO_MSG_UART_RECEIVE_DATA  uart->rx_buf----%s\n", uart->rx_buf);

endif

        }
        printf("\n----5  DEMO_MSG_UART_RECEIVE_DATA  uart->rx_msg_num----%s\n", uart->rx_msg_num);
        if (uart->rx_msg_num > 0)
        {
            uart->rx_msg_num--;
        }

        printf("\n----6  DEMO_MSG_UART_RECEIVE_DATA----%s\n", uart->rx_buf);
    }
    break;
    
    代码用的是开发板自带的wm_uart_demo.c
    我修改了下,运行得不到发送过来的1234
   

image.png

发布
问题