找回密码
 立即注册

微信扫码登录

查看: 20|回复: 0

[BTBLE SDK] Having issues in UART rx DMA

[复制链接]

3

主题

1

回帖

39

积分

英勇黄铜

积分
39
发表于 前天 14:05 | 显示全部楼层 |阅读模式 来自 印度
Information
说明:   建议参照本版块置顶帖内容输入必要信息
芯片型号: TLSR9513E(B91)
SDK及版本: BTBLE dual mode
I am using UART rx as DMA for recieving data from the third party device and sends that data to the BT connected device what I am seen is that I am not getting a full data mostly some random data

my code:


        uart_reset(UART1);
        uart_clr_tx_index(UART1);
        uart_clr_rx_index(UART1);
        uart_set_pin(UART1_TX_PC6, UART1_RX_PC7);
        uart_cal_div_and_bwpc(baud_rate, sys_clk.pclk * 1000 * 1000, &div, &bwpc);
        uart_set_rx_timeout(UART1,bwpc, 40, UART_BW_MUL2);
        uart_init(UART1, div, bwpc, UART_PARITY_NONE, UART_STOP_BIT_ONE);
        uart_set_rx_dma_config(UART1, DMA2);
        uart_cts_config(UART1, UART1_CTS_PC4, 1);  // Active HIGH
        if(fc_hw_flag.hw_flow_ctrl_flg == 1){uart_set_cts_en(UART1);}
        uart_set_irq_mask(UART1, UART_RXDONE_MASK);
        plic_interrupt_enable(IRQ18_UART1);
        core_enable_interrupt();
        uart_receive_dma(UART1, ( unsigned char *)at_cmd_buffer, AT_CMD_BUFFER_LEN); //AT_CMD_BUFFER_LEN = 1024



ISR:
    if(uart_get_irq_status(UART1, UART_RXDONE))
        {
                w_ptr = uart_get_dma_rev_data_len(UART1, DMA2);
                uart_receive_dma(UART1, (unsigned char *)at_cmd_buffer, AT_CMD_BUFFER_LEN);
                uart_clr_irq_status(UART1, UART_CLR_RX);
                uart_rx_flg = 1;
        }


superloop :

if(uart_rx_flg && app_spp_handle > 0)
    {
//            core_disable_interrupt();
            uart_rx_flg  = 0;
            btp_spp_sendData(app_spp_handle, nullptr, 0, at_cmd_buffer, w_ptr);
            w_ptr = 0;
//            core_enable_interrupt();
    }
    if(uart_rx_flg && g_connHandle != 0)
        {
                uart_rx_flg  = 0;
                blc_gatt_pushHandleValueNotify(g_connHandle, SPP_SERVER_TO_CLIENT_DP_H, (void * ) at_cmd_buffer, w_ptr);
                w_ptr = 0;
        }



您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Telink forum ( 沪ICP备17008231号-1 |沪公网安备31011502403548号 )

GMT+8, 2026-1-7 07:07 , Processed in 0.094597 second(s), 23 queries .

Powered by Discuz! 隐私政策

泰凌微电子版权所有 © 。保留所有权利。 2024

快速回复 返回顶部 返回列表