Hi,
I changed my CPU clock speed on my ATSAML21e18b from 4MHz to 48 MHz but the UART seems to have stopped working.
I initialize my UART as
void UART_init(void) { /* Configure UART */ //Initializes the device to predefined defaults usart_get_config_defaults(&usart_config); usart_config.mux_setting = USART_RX_1_TX_0_XCK_1; usart_config.pinmux_pad0 = PINMUX_PA00D_SERCOM1_PAD0; usart_config.pinmux_pad1 = PINMUX_PA01D_SERCOM1_PAD1; usart_config.pinmux_pad2 = PINMUX_UNUSED; usart_config.pinmux_pad3 = PINMUX_UNUSED; usart_config.baudrate = 115200; while(usart_init(&usart_module, SERCOM1, &usart_config) != STATUS_OK){ }; usart_enable(&usart_module); }
In my main() function I have a short while loop that runs until all initialization is set up and then it hands some stuff over to Linux before jumping into an infinite while loop. The part that is no longer working is this:
if(!strcmp("cmd_done", (char*)usart_buffer)) { usart_write_buffer_wait(&usart_module, (unsigned char*)"Received cmd done\n\r", 19); /* Hand over the display to imx6 */ TFT_Init_RGB(3); /* Hand over the backlight control to imx6 */ port_pin_set_output_level(LCD_BACKLIGHT_PIN, false); break; } else if(!strcmp("fsh_rbpt", (char*)usart_buffer)){ /*write the block protection bits to zero*/ usart_write_buffer_wait(&usart_module, (unsigned char*) "Writing block protection bits...\n", 33); }
When I send the commands to the serial port through Linux and try to cat the response I see nothing.
Is the CPU clock somehow interfering with the USART baud rate? My understanding was that increasing the CPU clock would only affect that MAXIMUM baud rate and 115200 is plenty for this application.
I used ASF (clocks_config.h) to set up GCLK0 at 48 MHz.