W806 The number of times the serial port receives access interrupts

Publish in 2022-06-17 19: 41: 03
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?

See more

follower
0
Be viewed
2. 2k
2 Multiple replies
ZYQ
ZYQ 2022-06-18
我已不再支持 W80X 任何Related problemtherecover, 请大家不要私信, 有problem找 isme thank you

Suggest code problems, Do not engage in verbal narration, Just look at your print, Unfamiliar variables are really hard to understand

si26
si26 2022-06-20
This guy is lazy, Nothing written!

@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!

Write an answer

Please login to post your answer, Click to log in

publish
problem

Share
Friend

Cell phone
browse

Scan code mobile browsing