W806 Receive data using interrupt mode, Open only UART_INTS_RL and UART_INTS_RTO Two interrupts
I set two variables, It is used to count the total number of interrupts entered while receiving INT_Count And the number of times received INT_RX_Count, And print every read FIFO Number of data;
On-site test, Send a 153 Byte of data, Print as follows:
RF: 16
RF: 0
RF: 16
RF: 0
RF: 16
RF: 0
RF: 16
RF: 0
RF: 16
RF: 0
RF: 16
RF: 0
RF: 16
RF: 0
RF: 16
RF: 0
RF: 16
RF: 0
RF: 9
INT_Count=19, INT_RX_Count=18
Judging from the print above, Only incoming interrupts are received 18 time, But half of them read 0 value, I try to reset after reading RXFIFO, Reduce the system frequency to 40MHz, This is still the case, Clearly resources are being wasted
There are two questions, 1. given 16 Byte triggered interrupt, Why does it appear 0 Value triggering? 2. How to avoid this, Improve efficiency?
Suggest code problems, Do not engage in verbal narration, Just look at your print, Unfamiliar variables are really hard to understand
@ZYQ Thank you for your answer! It's just that your answer doesn't help me at all. I probably knew it was the code, Or it should be about this U The usage of avoiding some pits during use is not familiar; If I post the code, Just the serial part, Exactly which paragraph to post, If I knew, I wouldn't be here asking for help. therefore, Now the feedback is the test process and the phenomenon; If you don't understand, Please forgive me, Limited ability of personal expression.
The good news is, This problem is currently in the group of friends 4061N The help has been solved! Thanks again!
Now let's talk about the reasons for this study,
My serial port part of the program is based on the original firmware library modification, Because there are many original firmware libraries bug, 0. 6. 0 The version interrupt sending mode does not work properly, Two changes were made here, There is also a subtraction operation on the pointer after receiving, It is very insecure and can cause data confusion during frequent mass transfers!
After correcting for these problems, The serial port operation will still occasionally crash... Therefore, the above tests were made!
The official firmware's action for handling interrupts is to clear the interrupt identifier first, Then read FIFO, The above test situation will occur; Group friend 4061N Analysis of, It's after clearing the interruption, On account of FIFO There is also data in, The interrupt was triggered twice!
finally, After reading FIFO Then clear the interrupt again, Can solve the double interrupt situation!
I hope you pay special attention when using the serial port!
As to whether my crash in the project had anything to do with it, Further tests will be done, We'll let you know then, thank you!
Thanks again to our friends 4061N The help of!
As long as the problem is solved, My answer, Just wanted to say, You need to get to the point and ask the question, It doesn't mean anything else, If you don't know what's wrong, So why don't you pack them all up and put them up, Someone who wants to help you, To analyze your code, Can really help you; It's like going to the hospital, All you'll tell the doctor is that I have an upset stomach, It's just an upset stomach, The phenomenon is that you have an upset stomach, You're right; The point is, you're not three years old, Keeping doctors guessing you might have a reason? ? How does a doctor divide that? ?
above, Feedback is the test process and phenomena! I think these are the closest things to the root of the problem
Both variables are hard to understand, All packed, More unfamiliar variables, And no one wants to see it!
merely, Thank you for your kind answer