cancel
Showing results for 
Search instead for 
Did you mean: 

USART1 interrupt issues, seems to get stuck after 2 or 3 triggers...

wbarkley
Associate II
Posted on September 13, 2012 at 16:12

The original post was too long to process during our migration. Please click on the attachment to read the original post.
11 REPLIES 11
michaelmccartyeng
Associate II
Posted on September 18, 2012 at 03:31

realize that with your current code when you overrun your buffer you will end up writing back to the begging. if you have an expected packet structure it will destroy at least one packet causing you to loose data. 

You should look into a circular buffer or at least be sure not to set the rxbyte count back to 0 anywhere else except in the int and check for overflow. I only say this because I ran into the same issue with the exact same code. I would get errors at high bit rates and eventually found out it was because upon sending two packets my buffer was getting set back to index 0 and destroying my packet, but only if sending two at a time. 

Circular buffers might have a little learning curve but they are a great way to handle this sort of situation. 

wbarkley
Associate II
Posted on September 25, 2012 at 19:10

The original post was too long to process during our migration. Please click on the provided URL to read the original post. https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I6lm&d=%2Fa%2F0X0000000buy%2FNpyYjTZXmcCLTvZUkR.UUQhc0cxqoUfiR0DLyWVHXko&asPdf=false