|
|
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;
}
|
|