Hello,
我对使用DMA(“UART_OP_DMA”)通过UART发送大量数据的问题。我试图发送例如450字节的数据(char选项卡[450])。我在终端上的数据,但只有约400个符号是正确的。当我使用“uart_op_blocking”时,一切都是正确的。
Abowe part of my test code:
#define size 500 char选项卡[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,
我建议首先检查SDK的6.0.14.1114 \ projects \ target_apps \ peripheral_examples \ uart。在我身边,我能够使用UART_SEND_DMA_EXAMPLE()打印超过500个字节的字节。为此,请检查您是否具有相同的配置并使用表替换output_string。
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,
你能澄清什么是不起作用的吗?
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.
我不知道为什么我的程序向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,
我不使用任何睡眠模式。
当我以调试模式运行时,指令后的程序UART_SEND.continues work normally.
If it matters, i callUART_SEND.func 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,
我的道歉 - 忘了在我以前的评论中附加代码段。我已经使用UART2块在empty_peripheral_template中进行了测试。数据在连接回调中打印。
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:
(我不想等到发送完成)。当我从代码中删除此部件时,发生相同的问题(垃圾符号)。
您能删除这部分代码和测试吗?
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