This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nrf52832 uart buffer size

hi, i have set the uart buffer size as 64. but when i am transmitting data,i found that the size might not enough(eg. there are 100 Bytes to send).how could i do except for expanding the size? i have try to use twice to send the data by for(;;), but it isn't successful.

Parents
  • Can you edit your original question and attach your entire code?

  • init code:

    void bsp_uart_init(void)
    {
    	uint32_t                     err_code;
    	const app_uart_comm_params_t comm_params =
    	{
    		RX_PIN_NUMBER,
    		TX_PIN_NUMBER,
    		RTS_PIN_NUMBER,
    		CTS_PIN_NUMBER,
    		APP_UART_FLOW_CONTROL_DISABLED,
    		false,
    		UART_BAUDRATE_BAUDRATE_Baud115200
    	};
    	APP_UART_FIFO_INIT( &comm_params,
    			                       UART_RX_BUF_SIZE,
    			                       UART_TX_BUF_SIZE,
    			                       uart_rx_handle,
    			                       APP_IRQ_PRIORITY_LOW,
    			                       err_code);
    	APP_ERROR_CHECK(err_code);
    }
    

    send data func:

    void bsp_uart_send_data(uint8_t * p_data, uint16_t length)
    {
    	uint8_t tx_buff[MAX_RX_LEN] = {0};
    	uint8_t idx = 0;
    	memcpy(&tx_buff[idx], p_data, length);
    	idx += length;
        for (uint32_t i = 0; i < idx; i++)
        {
            while(app_uart_put(tx_buff[i]) != NRF_SUCCESS);
        }
    }
    
Reply
  • init code:

    void bsp_uart_init(void)
    {
    	uint32_t                     err_code;
    	const app_uart_comm_params_t comm_params =
    	{
    		RX_PIN_NUMBER,
    		TX_PIN_NUMBER,
    		RTS_PIN_NUMBER,
    		CTS_PIN_NUMBER,
    		APP_UART_FLOW_CONTROL_DISABLED,
    		false,
    		UART_BAUDRATE_BAUDRATE_Baud115200
    	};
    	APP_UART_FIFO_INIT( &comm_params,
    			                       UART_RX_BUF_SIZE,
    			                       UART_TX_BUF_SIZE,
    			                       uart_rx_handle,
    			                       APP_IRQ_PRIORITY_LOW,
    			                       err_code);
    	APP_ERROR_CHECK(err_code);
    }
    

    send data func:

    void bsp_uart_send_data(uint8_t * p_data, uint16_t length)
    {
    	uint8_t tx_buff[MAX_RX_LEN] = {0};
    	uint8_t idx = 0;
    	memcpy(&tx_buff[idx], p_data, length);
    	idx += length;
        for (uint32_t i = 0; i < idx; i++)
        {
            while(app_uart_put(tx_buff[i]) != NRF_SUCCESS);
        }
    }
    
Children
No Data
Related