Because no one answered the questions in my previous post, I opened another one. I used LWIP to send data successfully, but only 1446 data were sent at a time. I captured 16384 data at a time, so I needed to send 16K data in a cycle. What can I do to achieve it?
If I send only 1446 data at a time, the efficiency will be slow and it will take many cycles to send the captured data at a time.
A development branch of how to use lwip with ad9361 you can find here: https://github.com/analogdevicesinc/no-OS/tree/ad9361_remove_blocking_read, that is working with iio-oscilloscope: https://github.com/analogdevicesinc/iio-oscilloscope, as a client.
Have a look in: https://github.com/analogdevicesinc/no-OS/blob/ad9361_remove_blocking_read/projects/drivers/network/network.c
to checkout how we use lwip. We use tcp, probably if you configure lwip to use UDP instead you can hope for better results. We use tcp to be compatible to iio-oscilloscope. If you configure lwip to use UDP protocol, you will need a client application, since you can't use iio-oscilloscope.
Using tcp protocol, with 1446 bytes of util data, we managed to reach over 30Mbit/s .
Thank you for your answer. I have another question.
Can I send multiple packets at a time by calling tcp_write multiple times?
Yes, you can send multiple packets sequentially, by calling "tcp_write()" multiple times. Before calling "tcp_write()" (that only puts data in some queue), you should check the number of bytes available in the output queue by calling "tcp_sndbuf()" function.
Finally "tcp_output()" must be called to effectively send the data.
Please check "network_write_data()" function in:
For more documentation on lwip please read this: http://www.nongnu.org/lwip/2_0_x/raw_api.html
If you are not using already Wireshark tool to debug the network communication, I would suggest to try it.
I have another question. Now I'm implementing continuous data transmission. My sending process is to capture data first, then send data with tcp-write and tcp-output.
How can data be captured continuously during execution of sending instructions without losing data due to execution of sending instructions?
For continuous acquisition you will have to use interrupts. Use the option "ADC_DMA_IRQ_EXAMPLE ". In this way "adc_capture()" becomes non-blocking and an interrupt handler is called when the transfer into memory is completed and "dma_transfer_completed_flag" is set. If you would like, it is possible to re implement the interrupt handler. While DMA captures data from the converter, you should send data from previous finished capture, over network interface. Of course network transfer should be faster than the DMA capture. It is possible to slow down the capture, by adjusting sampling rate.
I ran the above adc_capture program on Zedboard+AD9361's no-os.I found that it also ran once, and I still needed to build a loop around the call to "ADC_DMA_IRQ_EXAMPLE "to implement continuous capture.
Is it right for me to think this way?
Something like this:
network_write_data((const char *)ADC_DDR_BASEADDR2, 16384);
dma_transfer_completed_flag = 0;
network_write_data((const char *)ADC_DDR_BASEADDR1, 16384);
Hello, according to your answer, I ran adc_capture with the example of adc_dma_irq_and found that normal capture is not a problem, but when cooperating with the tcp_output of LwIP (I use TCP protocol), the program entered a dead-cycle subroutine. Is there a problem with interrupt settings?
Recently, I used my own LwIP protocol to cooperate with adc_capture to send data. When I used the original adc_capture command, there was no problem. I have two questions to ask you to help me solve:
1. But when I join ADC_DMA_IRQ_EXAMPLE into adc_capture, the tcp_output instruction in LwIP falls into a dead loop.
2. I try to see:
Https://github.com/analog device sinc/no-OS/blob/ad9361_remove_blocking_read/projects/drivers/network/network.c
Void network_write_data (int32_t instance_id, const char*buf, size_t len)
To solve the problem in 1, but I don't know what int32_t instance_id and const char*buf stand for respectively. If I want to capture data, I don't know what parameters to enter when calling network_write_data. Can I give a hint? Thank you