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
ok.. thans Mr.neil I doesn't have any problem in send and receive data (without work with interrupt) ...the all of my problem is in interrupt mode .. my usart is realy correct..my RXRDY usart interrupt in basic step doesn't work correctly !!
i doesn't want a big thing from you !!! I only want a one realy basically sample!!only one that work without any bug!!!is in all of the word exist one correct program for it??? if yes pleas send me to rationalization!! but it not exist any correct sample for it what is meaning of that??
"..but iF not exist any correct sample for it what is meaning of that??"
So post the smallest, complete example that illustrates your problem.
Just a simple example that sends & receives characters using the UART and interrupts.
ok...my program is so simple example of it..this program must return any caractere of receive. it is very simple . thank you very much.
they are the links for download it:
http://www.keil.com/forum/docs/thread16626.asp#msg84658
OR
and one thing i should say about my program is that: i want my program send every bit that receive suddenly.
and since speed of it, i used usart interrupt to do it very quickly.
i want my program send every bit that receive suddenly.
You may have read the user manual, but you failed to understand it. Your UART will generate an RX interrupt after receiving a word of various sizes and possibly a variable amount of these words, but not after detecting a bit. Why would you want that in a UART?
Dear everybody I'm friend of Ali Salehi. I think you must know what we want to do with Micro controller. We want to write a program that send a receive byte from serial port (as like a serial(RS-232) hardware loopback). I know that if i want to do that i must use micro controller serial in interrupt mode. but, we have a problem with interrupt mode. also we wrote a program for timer and used the interrupt mode but did not work correctly too.so Please don't say anything like as "that is basic problem". If you work with ARM interrupts, Please Help us. I think it is necessary to say that we run LCD & ADC & IO in ARM and worked correctly.
It is simply hard to believe that two people, that are supposed to be skilled or at least have the capacity to learn new things, are stuck on this. You too don't read or try to understand what people are saying to you, as you don't really bother to read the user manual in detail or the samples. Nobody here is going to do your homework - face it.
Ho, by the way I caught you in a little lie - did you REALLY successfully enable LCD control without interrupts? I don't think so.
I guess controlling an LCD is possible without interrupts, but the result cannot be really satisfactory!
Sorry, but I don't trust those "file sharing" sites, I'm afraid.
You should be able to Post the source of a simple program into the forum.
Be sure to read the instructions on posting code first...
One thing to note: do not use TABs to lay-out your code - use only spaces.
Depends on the hardware. I'm using an LPC3250. The LCD controller is not using interrupts. Simply a case of setting up the hardware and letting it do it's own thing. It works a treat.
Not sure about the at91sam7x256 that Tweedle Dum and Tweedle Dee are using here, but it surprises me that they can get an LCD controller going, but struggle with a USART.
ok..if you really can't terust me..I wirte all of my program in end if this page!!!
"...also we wrote a program for timer and used the interrupt mode but did not work correctly too..."
So there's either another buge in the compiler or you need to do some serious reading up on interrupts and how to use them.
1- we really successfully enable lcd without interrupt and without work with serial !!!
we wrote handle serial for use LCD..in other language we only work with I/O for run LCD...
2_ I don't know why you think that we are lying???why we should lie to you??? only for one homework we 2 month tray to resolve it's problem?? i am sorry for ourself!!
this is our code:
#include <at91sam7x256.h> #include <lib_at91sam7x256.h> unsigned char test = 48; void Usart0IrqHandler(void); // function prototype for USART0 handler volatile AT91PS_PMC pPMC = AT91C_BASE_PMC; // pointer to PMC data structure volatile AT91PS_PIO pPIO = AT91C_BASE_PIOA; volatile AT91PS_USART pUsart0 = AT91C_BASE_US0; volatile AT91PS_AIC pAIC = AT91C_BASE_AIC; // pointer to AIC data structure volatile AT91PS_SYS pSYS=AT91C_BASE_SYS; int main(void){ test=70; pPIO->PIO_PDR = (AT91C_PA0_RXD0 | AT91C_PA1_TXD0); pPMC->PMC_PCER = (1<<AT91C_ID_US0); // enable usart0 peripheral clock pPIO->PIO_ASR = (AT91C_PIO_PA0 | AT91C_PIO_PA1); // define peripheral A select regidtry pPIO->PIO_BSR = 0; // define peripheral B select regidtry pUsart0->US_CR = (AT91C_US_RSTRX | // reset receiver AT91C_US_RSTTX | // reset transmitter AT91C_US_RXDIS | // disable receiver AT91C_US_TXDIS); // disable transmitter pUsart0->US_MR = (AT91C_US_PAR_NONE | // no parity 0x3 << 6); // 8-bit characters pUsart0->US_IER = 0x0000; // no usart0 interrupts enabled (no effect) pUsart0->US_IDR = 0xFFFF; // all usart0 interrupts disabled pUsart0->US_BRGR = 0x139; // CD = 0x139 (313 from above calculation) // FP=0 (not used) pUsart0->US_RTOR = 0; // receiver time-out (disabled) pUsart0->US_TTGR = 0; // transmitter timeguard (disabled) pUsart0->US_FIDI = 0; // FI over DI Ratio Value (disabled) pUsart0->US_IF = 0; // IrDA Filter value (disabled) pAIC->AIC_IDCR = (1<<AT91C_ID_US0); // Disable USART0 interrupt in AIC pAIC->AIC_SVR[AT91C_ID_US0] = (unsigned int)Usart0IrqHandler; // Set the USART0 IRQ handler address in AIC // Source Vector Register[6] pAIC->AIC_SMR[AT91C_ID_US0] =(AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL | 0x4 ); // Set the int source type and pri // in AIC Source Mode Register[6] pAIC->AIC_IECR = (1<<AT91C_ID_US0); // Enable the USART0 interrupt in AIC // enable the USART0 receiver and transmitter pUsart0->US_CR = AT91C_US_RXEN | AT91C_US_TXEN; // enable the USART0 receive interrupt pUsart0->US_IER = AT91C_US_RXRDY; // enable RXRDY usart0 receive interrupt pUsart0->US_IDR = ~AT91C_US_RXRDY; // disable all other interrupts except RXRDY test=70; do{ }while(1); } 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 ; }
perhaps you can find some little error in our program but none of them doesn't about our problem!!