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

nRF91: issues in setting the call back using uart_callback_set()

Hi,

I am able to set up uart async receive, but when I try to set the call back using uart_callback_set() so that i can call the uart_tx() routine to push the data out, but soon i call the uart_callback_set() the app crashes and in serial log it doesn't give any traces to see what went wrong.

{
    uart_irq_callback_set(dev, uart0_fifo_callback);
    uart_callback_set(dev, uart0_callback, dev);
    LOG_ERR("uart_callback_set: %d", status);
}

uart_tx(dev, buf, len, 100);

#UART CONFIGURATION
CONFIG_SERIAL=y
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_UART_ASYNC_API=y
CONFIG_UART_0_NRF_FLOW_CONTROL=y

regards

KK

Parents Reply
  • Hi KK,

     

    kk2mkk said:
    And its working, but in your above implementation if i am sending out huge data it will be blocking and there are high changes that i miss the Rx interrupts so using CONFIG_UART_ASYNC_API could solve this problem?

     Since it does not really know how many bytes it will receive, it has a 1 byte RX DMA buffer set, and if you do not read it out fast enough, it will be overwritten. Using UART_ASYNC_API will solve this if you know how much data you should receive in a frame over a given time period for instance.

     

    Kind regards,

    Håkon

Children
No Data
Related