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

Not able to allocate UART receive buffer

  I use our designed board with control chip nrf5340  to test ncs1.5.0 sample peripheral_uart , I not changed a word of sample .but when debug program, show :Not able to allocate UART receive buffer.   this buffer is only 20 bytes length!!!! .our board can load /debug ,but when debug ncs1.5.0 example peripheral_uart ,alway error . is our board supply voltage error or design error???, or soft may have some configure i do not configure??? using nrf5340dk debug will not produce these error.

 

Parents
  • in ncs1.5.0,there is two samples use this way to deal with uart receive event , in sample peripheral_uart  function void uart_cb(xxxx)  ,there are two place like below code:

    struct uart_data_t *buf

    buf = k_malloc(sizeof(*buf));
    if (buf) {
     buf->len = 0;
    } else {
     LOG_WRN("Not able to allocate UART receive buffer");
    k_delayed_work_submit(&uart_work,UART_WAIT_FOR_BUF_DELAY);
     
    }

    when using nrf5340 debug ,every encount this situation . program all run to else branching ,not run to if branching

    NORDIC code style is  difficult  than all other chip manufacture code style ,nordic code always turn a thousand turns,very difficult to understand .a mini change always mean many error.i declare

    static struct uart_data_t *buf

    a globle variable of in main.c  , and delete all code as below:

    buf = k_malloc(sizeof(*buf));
    if (buf) {
     buf->len = 0;
    } else {
     LOG_WRN("Not able to allocate UART receive buffer");

    but can not work well .

    i do not change a word of sample peripherart_uart in NCS1.5.0 !!!

Reply
  • in ncs1.5.0,there is two samples use this way to deal with uart receive event , in sample peripheral_uart  function void uart_cb(xxxx)  ,there are two place like below code:

    struct uart_data_t *buf

    buf = k_malloc(sizeof(*buf));
    if (buf) {
     buf->len = 0;
    } else {
     LOG_WRN("Not able to allocate UART receive buffer");
    k_delayed_work_submit(&uart_work,UART_WAIT_FOR_BUF_DELAY);
     
    }

    when using nrf5340 debug ,every encount this situation . program all run to else branching ,not run to if branching

    NORDIC code style is  difficult  than all other chip manufacture code style ,nordic code always turn a thousand turns,very difficult to understand .a mini change always mean many error.i declare

    static struct uart_data_t *buf

    a globle variable of in main.c  , and delete all code as below:

    buf = k_malloc(sizeof(*buf));
    if (buf) {
     buf->len = 0;
    } else {
     LOG_WRN("Not able to allocate UART receive buffer");

    but can not work well .

    i do not change a word of sample peripherart_uart in NCS1.5.0 !!!

Children
Related