Skip to main content
HDaji.1
Senior
March 1, 2022
Solved

F411 SPI2 Not Defined

  • March 1, 2022
  • 8 replies
  • 1299 views

I am using example code SPI_TwoBoards_FullDuplex_DMA, and want to change SPI1 to SPI2.

LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_SPI2);

However, in the above line, compiler complains LL_APB2_GRP1_PERIPH_SPI2 not defined.

I wonder why.

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

Because SPI2 is on AHB1, not AHB2. Try LL_APB1_GRP1_PERIPH_SPI2 See data sheet.

hth

KnarfB

8 replies

KnarfB
KnarfBBest answer
Super User
March 1, 2022

Because SPI2 is on AHB1, not AHB2. Try LL_APB1_GRP1_PERIPH_SPI2 See data sheet.

hth

KnarfB

HDaji.1
HDaji.1Author
Senior
March 1, 2022

I have another question:

For the SPI Tx/Rx callback functions, they are called in IRQ handler like DMA2_Stream0_IRQHandler. But I cannot find in the project where DMA2_Stream0_IRQHandler is registered.

KnarfB
Super User
March 1, 2022

The names of the IQR Handlers are defined in the startup code, interrupt vector table, assembly code. Something like startup_stm32f411retx.s. They are pre-defined with a dummy implementation "Default_Handler", but you can override them by implementing a function with exactly that name in your own code.

hth

KnarfB