SAM V71/S70 incorrect USART baudrate (half speed)

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have followed the ASF samples to configure my USART module in SAM V71 on Xplained Ultra EV kit.

However, the actual baudrate is always half of what I configure.

 

#define USART_SITALL_OUT_SERIAL                           USART0
#define USART_SITALL_OUT_SERIAL_ID                     ID_USART0  
#define USART_SITALL_OUT_SERIAL_ISR_HANDLER   USART0_Handler
#define USART_SITALL_OUT_SERIAL_BAUDRATE         9600
#define USART_SITALL_OUT_SERIAL_CHAR_LENGTH  US_MR_CHRL_8_BIT
#define USART_SITALL_OUT_SERIAL_PARITY              US_MR_PAR_NO
#define USART_SITALL_OUT_SERIAL_STOP_BIT          US_MR_NBSTOP_1_BIT
#define USART_SITALL_OUT_SERIAL_IRQn                 USART0_IRQn

 

 

sysclk_enable_peripheral_clock(USART_SITALL_OUT_SERIAL_ID);
usart_init_rs232(USART_SITALL_OUT_SERIAL, &usart_sitall_out_settings, sysclk_get_main_hz());
usart_enable_tx(USART_SITALL_OUT_SERIAL);
usart_enable_rx(USART_SITALL_OUT_SERIAL);
usart_enable_interrupt(USART_SITALL_OUT_SERIAL, US_IER_RXRDY);
NVIC_EnableIRQ(USART_SITALL_OUT_SERIAL_IRQn);

 

 

I think this is a pretty standard USART configuration. However, every time I write to USART TXD line, the actual baudrate is 4800. If I change the USART config to run at 19200, it will run at 9600 etc.

 

Any ideas?

Thanks.

 

Last Edited: Tue. Aug 16, 2016 - 05:24 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

change sysclk_get_main_hz() to sysclk_get_peripheral_hz()

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It worked for me THanks.