inetbot web crawler
Main  |  Get access to the repository  |  API  |  The robot  |  Publications  |  Usenet Groups  |  Plainweb  | 
 inetbot - Groups (beta)

Current group: comp.sys.arm

Atmel serial interrupt (at91r40008)

Atmel serial interrupt (at91r40008)  
James Johnson
 Re: Atmel serial interrupt (at91r40008)  
Tauno Voipio
From:James Johnson
Subject:Atmel serial interrupt (at91r40008)
Date:Tue, 11 Jan 2005 08:17:02 -0500
I'm trying to get interupt-driven serial IO working on the Atmel
EB40A/AT91R40008. I initialize serial0 this way. In my main loop I am
transmitting a character about once per second. I can see the character on the pc that is plugged
into 'serial A' on the eb40a. However, no interrupt is ever generated. The US0 bit is enabled in
the power-saving register. I'm using a JTAG device to debug the code. I have a breakpoint set in the
serial interrupt but the program never gets ther. I also have some timer interrupts going and they
work.

What am I missing?

void initSerial(void) {
int i;
unsigned long ul;
unsigned int dummy;


US0_CR = ( US_TXDIS | US_RXDIS | US_RSTTX | US_RSTRX | US_RSTSTA);
for (i=1000; i>0; i--);

US0_RCR = 0x00000000;
US0_TCR = 0x00000000;

PIO_PDR = MY_PIO_TXD0 | MY_PIO_RXD0;
US0_MR = US_CLKS_MCK | // use MCK
US_CHRL_8 | // 8 data bits
US_CHMODE_NORMAL |
US_PAR_NO | // no parity
US_NBSTOP_1; // 1 stop bit

dummy = PS_PCSR;
dummy |= 0x00000004;
PS_PCER = dummy; // enable clock input to baud rate gen (power saving)
dummy = dummy ^ 0xffffffff;
PS_PCDR = dummy;

US0_IER = US_ENDTX; // Enable ENDTX interrupt (0x10)
dummy = ~US_ENDTX;
US0_IDR = ~US_ENDTX; // Disable everything else

US0_TPR = (unsigned short)txbuf;
US0_TCR = 1; // TXLEN;


US0_BRGR = 430; // 9600 baud at 66 MHz

for(i = 0; i < TXLEN; i++) {
txbuf[i] = 0x00;
}

US0_CR = US_TXEN; // changes registers: (US0_TPR, US0_TCR)!!!

for (i=1000; i>0; i--);

// Source #2 is USART0

AIC_SMR2 = 0x00000027; // edge triggered / prio = 7
AIC_SVR2 = (unsigned int)serial0_irq; // Address of ISR
dummy = 0x00000004;
AIC_IECR = dummy; // Enable USART0 interrupt
dummy ^= 0xffffffff;
AIC_IDCR = dummy; // disable all other interrupts
AIC_ICCR = 0x00000004; // Clear any USART0 interrupt

return;
}
From:Tauno Voipio
Subject:Re: Atmel serial interrupt (at91r40008)
Date:Wed, 12 Jan 2005 09:16:42 GMT
James Johnson wrote:
> I'm trying to get interupt-driven serial IO working on the Atmel
> EB40A/AT91R40008. I initialize serial0 this way. In my main loop I am
> transmitting a character about once per second. I can see the character on the pc that is plugged
> into 'serial A' on the eb40a. However, no interrupt is ever generated. The US0 bit is enabled in
> the power-saving register. I'm using a JTAG device to debug the code. I have a breakpoint set in the
> serial interrupt but the program never gets ther. I also have some timer interrupts going and they
> work.
>
> What am I missing?

--- clip clip ---

You have asked the same question in several groups.

Next time, please cross-post the message so the
responses will come to all the groups. Also,
please think which groups to post in - the
Usenet users get pretty annoyed for massive
off-topic cross-posts. The groups I have seen
your message in (c.a.embedded, c.s.arm) are OK.

Please see my response in comp.arch.embedded.

--

Tauno Voipio
tauno voipio (at) iki fi
   

Copyright © 2006 inetbot   -   All rights reserved