Hello,
我有一个小疑问发送很多a by UART using DMA ("UART_OP_DMA"). I tryed to send for example 450 bytes of data (char tab[450]). I recive data on terminal but only about 400 sign is correct. When i use "UART_OP_BLOCKING" everything is correct.
Abowe part of my test code:
#define size 500 char tab[size]; for(uint32_t x=0;x
And results on terminal (before this i've get correct 400 signs "b"):
´üŘü<0><0><0><0>´ü<0><0><0><0><0><0><0><0>“×đ@›ü<0><0><0><0> <0><0><0> <0><0><0><0><0><0><0><0><0><0><0> Ęń
My question is:
What i'm doing wrong ?
Device:
Hi adam.stroz,
I would recommend first checking the 6.0.14.1114\projects\target_apps\peripheral_examples\uart of the SDK. In my side, I am able to print more than 500 bytes using the uart_send_dma_example(). To do so, please check if you have the same configuration and replace the OUTPUT_STRING with your table.
Thanks, PM_Dialog
Hello,
I tested your example (with Keil, normally i'am working with smart snippers studio). In your example when i replace OUTPUT_STRING with my table (500 'b' sign) everything is correct (i recive 500 'b' sign on terminal). But my program still don't work. I noticed that, when i insert (only for test purposed):
after send instruction, everything is correct (i recive 500 'b' sign on terminal).
Can you give me another instructions ?
Hi adam.stroz,
Could you please clarify what is doesn’t work?
Thanks, PM_Dialog
Hello,
Of course, the main problem is that i recive wrong data on terminal (i tryed 2 diffrents terminal). I send 500 sign 'b' but recived only 450 and rest sign are trash. When i stop program after send instructions (by usign while(1) instructions) everything works fine. I work with empty_perpiherial_template from SDK.
I don't know why my program send some trash to uart.
Hi adam.stroz,
Are you using any of the sleep modes? Can you please run it in debug mode and check if it gets stuck into an assertion etc. ?
Thanks, PM_Dialog
Hello,
i don't using any sleep modes.
when i run it in debug mode, program after instructionuart_sendcontinues work normally.
If it matters, i calluart_sendfunc inuser_on_connection func.
Hi adam.stroz,
Thanks for the update. So, are you able to print the correct data?
Thanks, PM_Dialog
Hello,
At this moment no... I don't know what is wrong. Maybe i should try sending on another project (for ex. prox_reporter) ? Can you test for me this simple example (send my example array, with DMA) on your test board ?
Hi adam.stroz,
Which project of the SDK are you using? I ran it in the UART project from the SDK peripheral examples - 6.0.14.1114\projects\target_apps\peripheral_examples\uart. I used the code snippet below:
Thanks, PM_Dialog
I'm using empty_peripheral_template from target_apps\template\empty_peripheral_template. Can you test it for me in this project ?
Hi adam.stroz,
My apologies – forgot to attach the code snippet in my previous comment. I have tested in the empty_peripheral_template using UART2 block. The data is printed in the connection callback.
CFG_UART_DMA_SUPPORT and CFG_PRINTF macros are also defined in the project.
Thanks, PM_Dialog
Hello,
I tested your code and everything is correct. But in my case I want to send data and continue to execute next steps. So I must delete this part of the code:
(I don't want to wait until sending is complete). When i deleted this part from your code, the same problem occurs (trash sign).
Can you delete this part of code and test ?
So finally... i solved the problem :) It was enough to declare the array,
as global. I think, that after the exit function when I declared my array, the array is lost, but pointer that I provided to function uart_send still points to the memory area where the table was. So other instructions in the program could change the data in this memory area. This could result in sending bad data.
Hi adam.stroz,
Glad that you figured your issue out and thanks for sharing the fix!
Thanks, PM_Dialog