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 Reply
  • How long is MAX_RX_LEN? If 'length' is longer than MAX_RX_LEN you will modify bytes that is outside of tx_buff when you use memcpy() like that. When I tested your code this resulted hard faults.

    I suggest that you try something like this instead:

    void bsp_uart_send_data(uint8_t * p_data, uint16_t length)
    {
        for (uint32_t i = 0; i < length; i++)
        {
            while(app_uart_put(*p_data) != NRF_SUCCESS);
            p_data++;
        }
    }
    

    This also seems to work:

    void bsp_uart_send_data(uint8_t * p_data, uint16_t length)
    {
        for (uint32_t i = 0; i < length; i++)
        {
            while(app_uart_put(p_data[i]) != NRF_SUCCESS);
        }
    }
    

    but I'm no C expert so I don't know what is most optimal.

Children
No Data
Related