Hello!
This is my first post in ARM. I have some experience with AVR and now I'm trying for the first time an ARM Cortex M0 (ATSAMD20J18).
I started a new project with ASF and added sercom usart in callback mode. This is my code:
void init_uart_dbg(void) { struct usart_config config_usart; usart_get_config_defaults(&config_usart); config_usart.baudrate = 115200; config_usart.mux_setting = USART_RX_0_TX_2_XCK_3; config_usart.pinmux_pad0 = PINMUX_PB12C_SERCOM4_PAD0; config_usart.pinmux_pad1 = PINMUX_UNUSED; config_usart.pinmux_pad2 = PINMUX_PB14C_SERCOM4_PAD2; config_usart.pinmux_pad3 = PINMUX_UNUSED; while (usart_init(&usart_dbg,SERCOM4, &config_usart) != STATUS_OK) {} usart_enable(&usart_dbg); usart_register_callback(&usart_dbg, usart_write_callback_dbg, USART_CALLBACK_BUFFER_TRANSMITTED); usart_register_callback(&usart_dbg, usart_read_callback_dbg, USART_CALLBACK_BUFFER_RECEIVED); usart_enable_callback(&usart_dbg, USART_CALLBACK_BUFFER_TRANSMITTED); usart_enable_callback(&usart_dbg, USART_CALLBACK_BUFFER_RECEIVED); } void usart_read_callback_dbg(struct usart_module *const usart_module) { ioport_set_pin_level(LED_BLINK,1); } void usart_write_callback_dbg(struct usart_module *const usart_module) { ioport_set_pin_level(LED_BLINK,1); }
and
int main (void) { system_init(); ioport_init(); delay_init(); ioport_set_pin_level(GSM_POWER,1); init_uart_dbg(); system_interrupt_enable_global(); usart_write_buffer_wait(&usart_dbg,"\n\n---------------RESET!!!-----------\n",38); while(1) { delay_ms(100); usart_write_wait(&usart_dbg,'A'); } }
The "A"s prints in my terminal but when I try to send a character, the interrupt doesn't fire (led should go on). The PCB is OK, I tested with a scope on RX pin of the uC (pin 25, PB12) and the signal is OK.
I don't know what am I missing. I want to echo back the received character.
thanks!