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

issues using DMA with nrf9160

hi all,

i am using the uart with it's dma to transfer data into the nrf9160, but some of the data is lost in it's way. 
here are some examples of the loss count in bytes from different transfers (58 bytes lost in the first transfer):

payload.size = 6484
payload strlen() = 6426

payload.size = 6380
payload strlen() = 6380

payload.size = 6420
payload strlen() = 6420

payload.size = 6520
payload strlen() = 6426

payload.size = 6828
payload strlen() = 6682

any idea of why it happens or how to fix this?

Parents
  • Hi,

     

    Are you using CTS/RTS?

    Are your buffers statically defined (ie: not malloc/calloc'ed)?

    strlen() will parse output until it hits zero termination, could it be that the data has been corrupted, and zero chars is present in the buffer?

     

    Could you show a code snippet on how you setup the UART?

     

    Kind regards,

    Håkon

  • HI, 

    1. CTS/RTS is not used.

    2. The buffers are statically allocated

    3. I doubt that corrupt data is the case, we always memset all buffers to zero. also when not using DMA it works perfectly.

    4.

            memset(ubuf_image,0, sizeof(ubuf_image));
            uart_wifi = device_get_binding(DT_UART_1_NAME);
            if (!uart_wifi) {
                    printk("error\r\n");
            }
            printk("ubuf_image=[0x%x]\n", ubuf_image);
    #ifndef UART_DMA
            uart_irq_rx_enable(uart_wifi );
            printk("uart_irq_rx_enable() done\n");
            uart_irq_callback_set(uart_wifi , uart_cb);
    #else
            uart_callback_set(uart_wifi, uart_callback_algo, uart_wifi);
    #endif
    

    Thanks!

Reply
  • HI, 

    1. CTS/RTS is not used.

    2. The buffers are statically allocated

    3. I doubt that corrupt data is the case, we always memset all buffers to zero. also when not using DMA it works perfectly.

    4.

            memset(ubuf_image,0, sizeof(ubuf_image));
            uart_wifi = device_get_binding(DT_UART_1_NAME);
            if (!uart_wifi) {
                    printk("error\r\n");
            }
            printk("ubuf_image=[0x%x]\n", ubuf_image);
    #ifndef UART_DMA
            uart_irq_rx_enable(uart_wifi );
            printk("uart_irq_rx_enable() done\n");
            uart_irq_callback_set(uart_wifi , uart_cb);
    #else
            uart_callback_set(uart_wifi, uart_callback_algo, uart_wifi);
    #endif
    

    Thanks!

Children
Related