I'am working with at91sam7x256 and in my program the usart interrupt dosen't work correctly ! I communicatinon with atmel but it isn't fix yet.
thise is my program...pleas help me
www.4shared.com/.../usart16__2_.html
my mail :salehi.elc@gmail.com
Do you honestly find that clear & easy to read?!
When you're struggling with tricky problms like this, the last thing you need is a scruffy layout to make things harder!
So, here's your ISR:
void Usart0IrqHandler(void){ int statuse; statuse = pUsart0->US_CSR; test = pUsart0->US_RHR; pUsart0->US_THR = test; if( AT91F_US_TxReady(AT91C_BASE_US0)==0 ) do{ }while( AT91F_US_TxReady(AT91C_BASE_US0)==1 ); AT91C_BASE_AIC->AIC_EOICR = 0; return ; }
The first thing you need to do is to provide comments to describe what you're doing and - more importantly - why.
Why is 'test' global?
Is a 'while' loop really a good idea inside an ISR?
Ali,
According to this post, you do not need to write to the AIC_EOICR register unless it was invoked by SW.
www.embeddedrelated.com/.../2874.php
Here is another resource for serial comms. The code looks very familiar to what you have posted, so you should be able to compare yours to this one and solve your problem...
www.sparkfun.com/.../at91sam7 serial communications.pdf
dear Andy. your advise is right! I should comment all of my code..but now I think that I can description here!!
the test is the a bit that receive and it get from US_RHR registry !!
after that we sent test bit with writ in US_RHR registry!!
it is very simple!
and about that -> "...According to this post, you do not need to write to the AIC_EOICR register unless it was invoked by SW...."
yes is right but my problem doesn't for it..i check it! not difference from to bo or not to be of AIC_EOICR in code!
and about it: "..Here is another resource for serial comms. The code looks very familiar to what you have posted, so you should be able to compare yours to this one..."
I read all of it beforehand..and if i can write this program it is for this resource!
it is a very good resource but it doesn't have a good description a bout interrupt,
in this resource the all of thing about normal usart explain very exactly and step by step but when the interrupt subject start it explain that very short and obscure..
I.....
forfeit, give up, throw overboard, waive, forgo, forego, abandon, drop out, fall by the wayside, drop by the wayside, throw in, throw in the towel, quit, chuck up the sponge (like this one!!!), discontinue, stop, cease, give up, quit, lay off, spare, part with, dispense with, release, relinquish, resign, free, pass, hand, reach, pass on, turn over, vacate, resign, renounce, leave office, quit, step down, resign, surrender, cede, deliver, yield, waive, foreswear....
ooooops!! :-o WHAT is MEANING OF YOU ????
No, you can't - it makes no sense!
I think that i found problem!! the problem is exactly keil compiler . i changed my compiler to IAR . THE KEIL HASE BUG!
THE KEIL HASE BUG!
Sue them, then. They cost you days of fruitful work, misery and tears. Yes?
You might, of course, be right - but that is of no use at at all if you can't describe precisely what the alleged bug is!
Was the code written to be compatible with the Keil or IAR compiler?
You haven't found a bug. All you have found is a difference in behaviour when switching compiler. Maybe you have a serious bug in your code, that is only noticeable under some specific conditions?
"THE KEIL HASE BUG!"
Well, based upon your extensive and professionally reported evidence, I guess we all have no alternative but to stop using Keil development tools immediately and move across to other superior products.
Will the last one out please remember to close the door.
I think that is the far more likely option...
yes!