cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L475 USB OTG Host GPIO Interrupt Failed

Brian Dahl
Associate II
Posted on March 02, 2018 at 18:48

Hi,

i have a STM32L475 with USB OTG as Host with USB Disk attached and an GPIOInt with callback void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin).

If i build my HAL without USB all is ok, but when i build it with USB Support, the callback is never called anymore.

Can anybody help me (I have tested to set the usb Priority to 1 and the GPIOInt to 0 but it had failed).

Best Regards

Brian

#gpio-interrupt #usb-msc-device #stm32-l4
1 ACCEPTED SOLUTION

Accepted Solutions
Posted on March 03, 2018 at 09:06

I use the rtc.

So that's probably source of the problem - PC13 is used for various RTC functions when it overrides the GPIO settings (and then possibly disconnects also from EXTI, although this is not described clearly in the manual). See GPIOs controlled by the RTC subchapter in RTC chapter of Reference Manual.

View solution in original post

8 REPLIES 8
Posted on March 02, 2018 at 21:33

Which pin?

Read out and check relevant GPIO and EXTI registers.

JW

Brian Dahl
Associate II
Posted on March 02, 2018 at 22:00

Pin PC13 Configured as GPIO_EXTI13, External Interrupt Mode Rising Edge.

The Registers:

GPIO:

MODE13=00

MODER13=IN(00)

OT_13=FALSE

OSPEED13=00

OSPEEDR13=GPIO_Low_Speed(00)

PUPD13=00

PUPDR13=GPIO_Puipd_NOPULL(00)

ID13=FALSE

IDR13=FALSE

ODR13=FALSE

OD13=FALSE

BR13=FALSE

BS13=FALSE

LCK13=FALSE

AFSEL13=0

BR13=FALSE

BR_13=FALSE

ASC13=FALSE

EN_13=FALSE

EXTI:

IM13=TRUE

EM13=FALSE

RT13=TRUE

FT13=FALSE

SWI13=FALSE

PIF13=FALSE

I hope that thats all...

Best regards

Brian

Brian Dahl
Associate II
Posted on March 02, 2018 at 22:49

Ok when i set 

EXTI_SWIER1.SWI13

= true, then the callback is called with the right GPIO_Pin....

The IDR Register isn't changed if i press the button...

Who supress it???

Best regards 

Brian

Brian Dahl
Associate II
Posted on March 02, 2018 at 23:29

No it is on the Board B-LE475-iot the user button, and if i use a simple test Programm, than it is all functional...

I use the rtc...all other are connected

Posted on March 02, 2018 at 22:37

Humm.

Is SYSCFG_EXTICR4.EXTI13 set properly?

If you now toggle the pin, do you see GPIOC_IDR.ID13 to toggle? Do you see EXTI_PR1.PIF13 come true on the rising edge? If not, does writing one to EXTI_SWIER1.SWI13 trigger the interrupt?

PC13 is a RTC pin in the VBAT domain. Do you use RTC? Are VDDA/VSSA//VBAT properly connected?

JW

Posted on March 02, 2018 at 23:02

PC13 is a RTC pin in the VBAT domain. Do you use RTC? Are VDDA/VSSA//VBAT properly connected?

Broken button? DIsconnected button from pin? Button trace shorted to a grounded signal?

JW

Brian Dahl
Associate II
Posted on March 03, 2018 at 08:45

Ok i have used PB9 and that works...

Posted on March 03, 2018 at 09:06

I use the rtc.

So that's probably source of the problem - PC13 is used for various RTC functions when it overrides the GPIO settings (and then possibly disconnects also from EXTI, although this is not described clearly in the manual). See GPIOs controlled by the RTC subchapter in RTC chapter of Reference Manual.