cancel
Showing results for 
Search instead for 
Did you mean: 

Understanding the difference between USART and SPI controllers

audun
Associate
Posted on April 28, 2016 at 15:16

Hi, we are surveying microcontrollers for a new product where we need at least 2 SPI interfaces and 2 uart interfaces. All of these 4 interfaces will have to be able to operate concurrently.

I have some trouble understanding if e.g. the STM32F401VB will suffice. It is listed with 4 SPI interfaces and 3 USART interfaces. Are all of these actually independent serial bus controllers, or are some of these the same?

In short: Requiring communication on 2 UART lines and 2 SPI lines, all in concurrency, will the STM32F401(VB) meet my demands?

//Audun Knudsrod

#!stm32f4-!stm32f401-!spi-!usart
4 REPLIES 4
Posted on April 28, 2016 at 15:25

The USART and SPI peripherals are independent. You would need to review the Data Manual for the specific part and identify the pins you need for the RX, TX, MISO, MOSI, CLK, etc 

I'd expect the part to be able to escape pins for 2x SPI and 3x USART, but you'll need to do the due diligence work on that.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
John F.
Senior
Posted on April 29, 2016 at 09:17

The STM32CubeMX tool from ST will allow you to choose the microcontroller and select the peripherals you want and map them to pins graphically. It's a useful sanity check even if you don't want to use the code generation features.

audun
Associate
Posted on April 29, 2016 at 09:17

Thanks.

I am used to SPI controllers being extensions to USART controllers, so I was a bit uncertain about how that actually added up
re.wolff9
Senior
Posted on April 30, 2016 at 11:25

In STM-speak an USART is really an USART and SPI is just SPI optionally with I2S tacked on. 

Anyway, if those 2 USART+ 2 SPI  is all you need, you would also have had enough if there were only 4 modules. But in reality there are 7 in the '401. (check the DATASHEET (that's the name of the document in ST-lingo) in for example the memory map to see that there are actually distinct addresses for each of the USARTs and SPI modules. 

Anyway, the problem is mapping them to pins. That might become a puzzle, especially if you have other stuff you may want to use like USB. 

And of course, if those 4 peripherals are the ONLY ones you need, you'd think you might only need say 2*4 for SPI and 2*2 for USART = 12 pins. so a 32 or 48 pin device should do. That's when the pin assignments become important.... and especially if you need a few more peripherals, the assignment might bump you up a package level...