Skip to main content
Graduate
December 17, 2024
Solved

Help to use SPI on NUCLEO-G491

  • December 17, 2024
  • 2 replies
  • 1698 views

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?

    This topic has been closed for replies.
    Best answer by KatsuMat

    Thank you very much!

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

    KatsuMat_0-1734642357754.png

     

    2 replies

    Graduate II
    December 17, 2024

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

    PA6 connects to PB15 and PA7 connects to PB14

     

    KatsuMatAuthor
    Graduate
    December 18, 2024

    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

     

    Super User
    December 18, 2024

    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.

    Super User
    December 18, 2024

    PF1 is not connected to the CN7 header by default.

    TDK_0-1734486680566.png

    Must close SB24 and open SB25.

    TDK_1-1734486776055.png

     

    KatsuMatAuthor
    Graduate
    December 19, 2024

    Hi TDK san.

    Thanks!!

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

    KatsuMat_0-1734566433747.png

     

    Super User
    December 19, 2024

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

    The reply about SB24/SB25 is correct.