cancel
Showing results for 
Search instead for 
Did you mean: 

Help to use SPI on NUCLEO-G491

KatsuMat
Associate

Hello,
I am not receiving SPI interrupt on the NUCLEO-G491, and I would like some support.
Here is the source code project.

https://github.com/katsumat/STM32CubeIDE/tree/main/workspace_1.16.1/SPI

 

Specifically, I would like to perform the following actions:

 

single line name

KatsuMat_0-1734471326715.png

 

SPI connection.

 

Here is the waveform for SPI1

 
 
 

KatsuMat_6-1734470438617.png

I have set a breakpoint here at /* USER CODE BEGIN 3 */, but it is not being hit.
KatsuMat_7-1734470670023.png

I have set a breakpoint at SPI2_IRQHandler, but it is not being hit. Could you advise me on why the interrupt is not occurring?

1 ACCEPTED SOLUTION

Accepted Solutions

Thank you very much!

Interrupts are now working, and communication has been successfully established.

KatsuMat_0-1734642357754.png

 

View solution in original post

8 REPLIES 8
Karl Yamashita
Lead III

You have your pins swapped. MISO (Serial Out) and MOSI (Serial In)

PA6 connects to PB15 and PA7 connects to PB14

 

Tips and Tricks with TimerCallback https://www.youtube.com/@eebykarl
If you find my solution useful, please click the Accept as Solution so others see the solution.
TDK
Guru

PF1 is not connected to the CN7 header by default.

TDK_0-1734486680566.png

Must close SB24 and open SB25.

TDK_1-1734486776055.png

 

If you feel a post has answered your question, please click "Accept as Solution".

Thank you for your response!
I have set SPI1 as master and SPI2 as slave.
In this case, I believe I should connect PA6 to PB14 and PA7 to PB15.
Is this correct, or am I mistaken?

KatsuMat_1-1734564325788.png

KatsuMat_2-1734564493828.png

KatsuMat_0-1734564198332.png

 

Based on your photo of MOSI connected to MOSI, this is incorrect. For SPI communications, MOSI on the master is connected to MISO on the slave.

MOSI = master out (master drives), slave in (slave reads)

MISO = master in, slave out

Edit: the above is nonsense. MOSI should be connected to MOSI. I was clearly distracted writing this.

If you feel a post has answered your question, please click "Accept as Solution".

Hi TDK san.

Thanks!!

OK!
I need to move the resistor from SB25 to SB24 with solder...

KatsuMat_0-1734566433747.png

 

Note that my previous reply about MOSI/MISO was incorrect. It has been fixed.

The reply about SB24/SB25 is correct.

If you feel a post has answered your question, please click "Accept as Solution".

Sorry, I had a brain fart. I've been working on multiple slave devices that are communicating in series due to small pin count with limited I/O's for CS. For that type of setup, it is MISO to MOSI between slave devices. 

But for your setup, you had the connection correct. Sorry for the confusion.

Tips and Tricks with TimerCallback https://www.youtube.com/@eebykarl
If you find my solution useful, please click the Accept as Solution so others see the solution.

Thank you very much!

Interrupts are now working, and communication has been successfully established.

KatsuMat_0-1734642357754.png