AT91SAM9260 USART config

Hey all,

I’m having some trouble getting the USART1 port working on my board (sam9-l9260 from olimex).

I got the DBGU port working just fine, but apparently the USART port is a little different…?

I have it set up like the following:

void configure_usart()
{

	AT91C_BASE_US1->US_CR = AT91C_US_RSTRX | AT91C_US_RSTTX;
	AT91C_BASE_US1->US_CR = AT91C_US_RXDIS | AT91C_US_TXDIS;
	    /* Disable interrupts */
	AT91C_BASE_US1->US_IDR = 0xFFFFFFFF;

	    /* Configure PIOs */
	    AT91C_BASE_PIOB->PIO_ASR = AT91C_PB6_TXD1 | AT91C_PB7_RXD1;
	    AT91C_BASE_PIOB->PIO_BSR = 0;
	    AT91C_BASE_PIOB->PIO_PDR = AT91C_PB6_TXD1 | AT91C_PB7_RXD1;

	    /* === Configure serial link === */
	    /* Define the baud rate divisor register [BRGR = MCK / (115200 * 16)] */
	    AT91C_BASE_US1->US_BRGR = 54;
	    /* Define the USART mode */
	    AT91C_BASE_US1->US_MR = AT91C_US_PAR_NONE
								| AT91C_US_USMODE_NORMAL
								| AT91C_US_CLKS_CLOCK
								| AT91C_US_CHRL_8_BITS
								| AT91C_US_NBSTOP_1_BIT;

	    /* Disable the RX and TX PDC transfer requests */
	    AT91C_BASE_US1->US_PTCR = AT91C_PDC_RXTDIS;
	    AT91C_BASE_US1->US_PTCR = AT91C_PDC_TXTDIS;

	    /* Enable transmitter and receiver 
	    AT91C_BASE_US1->US_CR = AT91C_US_TXEN;
	    AT91C_BASE_US1->US_CR = AT91C_US_RXEN;

	    AT91C_BASE_PMC->PMC_PCER = 1 <<AT91C_ID_US1;  //providing clock from the PMC
	    AT91C_BASE_PIOB->PIO_PPUER = AT91C_PB6_TXD1;
}

any help would be greatly appreciated!

thanks :?

So yeah, I solved the problem. It turns out that configuration was correct, just something with my computer/hyperterminal connection was off apparently. :roll:

Im using the ARM-USB-OCD so im not sure if that COM port wasn’t allowing it to talk or what…but anyway, hooking it to a desktop COM port worked like a charm.

So, if anyone needs a USART configuration for the AT91SAM9260…that one above works.