[Arduino Due] : Problem while sending serial data with USB-CDC

Hello everyone,

I'm working with Arduino Due to build a small testbench that communicates with a Python script. The communication is based on the USB-CDC with the FreeRTOS CLI library provided by Atmel and it works like a charm. I've created some FreeRTOS tasks that send periodically some data (CAN frames, ADC values...) to the Python script. Using serial module in Python I can get the data and print it in my command line window.

My problem is that when I try to send many things in the serial port with a period of 1ms, it blocks after a while and nothing works anymore in the CPU, so I have to restart it to get it work again.

I thought maybe it is due to the speed transmission, I've used a baudrate of 250000, but nothing changed. I read in somewhere in the net that the baudrate while working with a virtual COM port is ignored and transmission is done anytime both nodes (Arduino and the Python script) are ready.

I'm quit confused about which track should I look to solve my problem. Do you guys have any idea about what can block my CPU and how I can handle that ?

Thanks in advance.

I didn't get any answer so I presume that my problem wasn't clear.

To be more specific, is there a way to improve speed communication or whatever can make it more easy (change serial buffer's size...) to avoid blocking my CPU while sending a lot of data in the virtual COM port ? :confused:

I still can't find a solution for my problem. Any help guys ?

Do you use a queue or a FIFO? You should limit the amount of communication to the amount that works or to the amount your current choice of communication permits.
Otherwise the buffers get full and the data is corrupted. Search for queue and for FIFO in stack overflow.

Also you should make some kind of signalling that one side informs the other when it is ready to accept data

You can also try to use the USB serial which uses the hardware for communication and is way faster

MoncefM:
Any help guys ?

How do you imagine anyone can try to help when you have not shared the code which reproduces the problem?