Hi all
I'm using the SAM4L XPlained pro board and I'm trying to get the UART2 to work. I have been successful at getting UART0 and UART1 to work just fine but not UART2. Not sure what it is I'm missing. Here are the code snippets I'm using to enable the UART2.
conf_board.h:
#ifndef CONF_BOARD_H_INCLUDED #define CONF_BOARD_H_INCLUDED /** Enable Com Port. */ #define CONF_BOARD_COM_PORT #define CONF_BOARD_USART0 #define CONF_BOARD_EIC #endif
main.c:
const sam_usart_opt_t usart_console_settings = { baud, USART2_SERIAL_CHAR_LENGTH, USART2_SERIAL_PARITY, USART2_SERIAL_STOP_BIT, US_MR_CHMODE_NORMAL }; #if SAM4L sysclk_enable_peripheral_clock(USART2_SERIAL); #else sysclk_enable_peripheral_clock(USART2_SERIAL_ID); #endif usart_init_rs232(USART2_SERIAL, &usart_console_settings, sysclk_get_main_hz()); usart_enable_tx(USART2_SERIAL); usart_enable_rx(USART2_SERIAL);
usart_enable_interrupt(USART2, US_IER_RXRDY); NVIC_EnableIRQ(USART2_IRQn);
Any help is greatly appreciated,
Thanks