What's the point of having USART in SPI Mode?

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

atmega328p supports USART in SPI Mode, which i'm guessing is different than UART in synchronous mode.

 

Why would this exist if one can either use UART, USART (for UART in synchronous mode) or SPI?

This topic has a solution.
Last Edited: Mon. Jul 6, 2020 - 08:35 PM
This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

avruser1523 wrote:
atmega328p supports USART in SPI Mode

USART in SPI mode, is buffered, so can send the data a bit faster then the unbuffered SPI. 

Jim

 

FF = PI > S.E.T

 

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

Also, if the main SPI interface is occupied, you can simultaneously transfer with the UART-based SPI. Example: SPI sensor and SPI memory interface. Read from sensor and write to memory at the same time because they are two independent buses.

 

Jim

 

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

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

Note that SPI (synchronous peripheral interface) is synchronous, uart is asynchronous (Universal Asynchronous Receiver Transmitter).

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

Correct.

 

What makes it (relatively) simple conversion in hardware is the fact that both SPI and UART are "just" shift registers. Both use clocks inside. SPI routes that clock outside (when its a master). The relationship between the UART clock and the shifted data is a bit different from the relationship between the SPI clock and its data, but the change is pretty simple and can be handled in hardware. 

 

What the OP seems to be having a bit of difficulty with is the functionality of the peripherals. EVERY peripheral (well, maybe there is some exception) appears to the MCU as "just a bunch of registers". These registers control how that particular peripheral works. SPI is actually a pretty simple peripheral and I encourage the OP to read the SPI chapter in the device manual. Not the combined UART/SPI chapters but the chapter on the dedicated SPI interface. In that relatively short chapter, you will read how various bits in various status and control registers work with the SPI hardware. There are block diagrams that are relatively easy to comprehend without going too deeply into the hardware. Once you have been through that, the other peripherals might not be so daunting. 

 

Also, OP, please don't assume so much about how things work. So far, your assumptions have lead you quite astray. Instead, read the device manual. For the most part, that will dispel the false assumptions and lead you in a more productive direction.

 

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

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

Kartman wrote:
SPI (synchronous peripheral interface)

Isn't the 'S' in "SPI" for Serial ?

 

But, whatever, it is still Synchronous.

 

Kartman wrote:
uart is asynchronous (Universal Asynchronous Receiver Transmitter).

But the question was about USART = Universal Synchronous / Asynchronous Receiver / Transmitter

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...