cancel
Showing results for 
Search instead for 
Did you mean: 

conflict USART and SPI

MNapi
Senior III

Each time I enable SPI, it works fine.
However, whenever I include USART, SPI freezes, and this issue affects multiple chips I've tested.
SPI and USART both work well individually.


The problem seems to stem from CubeMX, which doesn't generate the code correctly.
Coding directly in Keil or CubeIDE might solve the issue, but it's time-consuming—which is exactly why we use CubeMX in the first place.


Does anyone know if this could be a simple issue, like an interrupt conflict or shared resource problem?

I looked at bunch of options like making sure the interrupt priority for USART and SPI is different.

Making sure SPI does not kick in while USART (DMA) is still processing data, ect

It's definitely a CubeMX code generation issue.
Any suggestions on how to make SPI and USART work together?

 

 

 

 

 

1 REPLY 1
Andrew Neil
Super User

@MNapi wrote:

whenever I include USART, SPI freezes


What, exactly, "freezes" ?

On what hardware?

I have used SPI and USART via CubeMX with no problem - so it must be something you're doing.

Show a minimum but complete example which illustrates the issue.

 

How to write your question to maximize your chances to find a solution

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.