cancel
Showing results for 
Search instead for 
Did you mean: 

BSP SD_DetectIRQHandler() doesn't work

Jur Div
Associate II
Posted on June 28, 2018 at 13:19

I am trying to use BSP SD functions. One way to detect if SD card is inserted is with BSP_SD_IsDetected()

 

and another way is via interrupts w/ BSP_SD_ITConfig() .

The comments don't explicitly say which is the correct IRQ handler to use, but I'm pretty sure it is this macro I need:

&sharpdefine

SD_DetectIRQHandler

()

HAL_GPIO_EXTI_IRQHandler

(SD_DETECT_PIN)

Trying to use it in my project, it gives me following errors:

/home/..../Inc/stm32f7xx_hal_gpio.h:115:36: error: expected declaration specifiers or '...' before '(' token

&sharpdefine GPIO_PIN_13                ((uint16_t)0x2000U)  /* Pin 13 selected   */

^

/home/jure/Projects/ARMdev_stuff/STM32Cube_FW_F7_V1.11.0/Drivers/BSP/STM32746G-Discovery/stm32746g_discovery.h:168:46: note: in expansion of macro 'GPIO_PIN_13'

&sharpdefine SD_DETECT_PIN                        GPIO_PIN_13

^~~~~~~~~~~

/home/jure/Projects/ARMdev_stuff/STM32Cube_FW_F7_V1.11.0/Drivers/BSP/STM32746G-Discovery/stm32746g_discovery_sd.h:104:68: note: in expansion of macro 'SD_DETECT_PIN'

&sharpdefine SD_DetectIRQHandler()             HAL_GPIO_EXTI_IRQHandler(SD_DETECT_PIN)

^~~~~~~~~~~~~

src/interrupts.c:15:6: note: in expansion of macro 'SD_DetectIRQHandler'

void SD_DetectIRQHandler()

^~~~~~~~~~~~~~~~~~~

Also this ''error-type'' shows up in my IDE, I don't know what it means though:

0690X0000060BvbQAE.png

How can I detect SD Card presence with interrupts? What function should I implement as a IRQHandler for this event?

#sd #f7 #stm32f746-discovery #sd-card #bsp
4 REPLIES 4
Posted on June 28, 2018 at 13:40

Why would you do this?

void SD_DetectIRQHandler()

Surely you'd just want to expand the macro not create a body function

Wouldn't this be the expected utilization?

void EXTI15_10_IRQHandler(void)

{

  SD_DetectIRQHandler();

}

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
Posted on June 28, 2018 at 14:45

Aah yes, your version makes much more sense!

🙂

I tought it's a bit wrong what I was doing.

Still, my approach of implementing a function wasn't totally crazy - since I want to detect the ''SD-inserted event'' and do something (execude my code) when that happens. What is the point of having this BSP macro/function if you can't control what it does + still have to figure out by yourself what is the handler name (EXTI15_10_IRQHandler)?

Anyway, thanks for clearing up how this macro works!

Posted on June 28, 2018 at 16:20

With the HAL model you'd put your functionality in a callback from the EXTI, this is just plumbing to get to that.

If it is simpler you can add code to the IRQ Handler to qualify the source and do your thing in there.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
Posted on June 28, 2018 at 19:00

I believe I'll do it this way, yes. Thanks for answering!