Skip to main content
rohan_m
Associate III
February 8, 2024
Solved

Setting 38400 baud rate reception with SPI

  • February 8, 2024
  • 3 replies
  • 2104 views

Need to achieve 38400 baud rate for reception of NMEA messages but here 38400 is not in the multiple of binary numbers.

Setting the clock to 8MHz and then using prescaler is just setting it to 31.25 Kb.

rohan_m_0-1707383007686.png

How to adjust to be able to achieve that baud rate ?

This topic has been closed for replies.
Best answer by Peter BENSCH

I also suspect an UART output, as this is typically used for NMEA messages, as @TDK said. But even then you don't have to hit 38400 to several decimal places because UART works with oversampling and has a certain frequency tolerance - 1% deviation is no problem at all, and the proposal of @mƎALLEm is only 0.029% off.

3 replies

mƎALLEm
Technical Moderator
February 8, 2024

Hello,

I think you can use PLL for this.

I had a trial and achieved 38.411Kb/s . I don't know if it does fit your expectation:

SofLit_0-1707386786041.png

SofLit_1-1707386854731.png

 

 

"To give better visibility on the answered topics, please click on ""Accept as Solution"" on the reply which solved your issue or answered your question."
TDK
Super User
February 8, 2024

Typically, SPI speed is specified as a maximum speed. Have never seen a chip which required an exact SPI clock frequency.

What chip? Are you sure you're not mixing up SPI and UART? 38400 sounds like a UART baud rate from a GPS receiver.

"If you feel a post has answered your question, please click ""Accept as Solution""."
Peter BENSCH
Peter BENSCHBest answer
Technical Moderator
February 8, 2024

I also suspect an UART output, as this is typically used for NMEA messages, as @TDK said. But even then you don't have to hit 38400 to several decimal places because UART works with oversampling and has a certain frequency tolerance - 1% deviation is no problem at all, and the proposal of @mƎALLEm is only 0.029% off.