cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H743 - Is there any conflict between EXTI 9_5 lines with USB_CDC_FS?

ASá.1
Associate

Hey, I'm using a STM32H743ZI. I'm trying to implement a callback function in my code but when I implement the IRQ_handler, the USB_CDC_FS stops working - when I remove the IRQ handler it works just fine.

The computer recognizes the USB port but I can't transmit/receive data.

Here's the pins defined for the USB:

0693W000003CBUNQA4.png

And for the callback function I'm using EXTI_6 in the pin PB6.

I followed the example provided in the repository and here's the code:

static void EXTI9_5_IRQHandler_Config(void)
{
  GPIO_InitTypeDef   GPIO_InitStructure;
 
  /* Enable GPIOC clock */
  __HAL_RCC_GPIOB_CLK_ENABLE();
 
  /* Configure PC.13 pin as input floating */
  GPIO_InitStructure.Mode = GPIO_MODE_IT_RISING;
  GPIO_InitStructure.Pull = GPIO_PULLDOWN;
  GPIO_InitStructure.Pin = GPIO_PIN_6;
  HAL_GPIO_Init(GPIOB, &GPIO_InitStructure);
 
  /* Enable and set EXTI lines 9 to 5 Interrupt to the lowest priority */
  HAL_NVIC_SetPriority(EXTI9_5_IRQn, 2, 0);  //I've changed the priority up until 15. didn't work
  HAL_NVIC_EnableIRQ(EXTI9_5_IRQn);
}
 
void HAL_GPIO_EXTI_Callback (uint16_t GPIO_Pin){
 if (GPIO_Pin == GPIO_PIN_6){
	 myfunction();
 }
 else{
	 __NOP();
 }
};

I've tried set the priority to the loest possible ( HAL_NVIC_SetPriority(EXTI9_5_IRQn, 15, 0)) and still the USB_CDC_FS doesn't seem to respond.

Edit: Since my main file is a .cpp file I also tried C linkage

extern "C" void EXTI9_5_IRQHandler_Config(void)
{
  GPIO_InitTypeDef   GPIO_InitStructure;
 
  /* Enable GPIOC clock */
  __HAL_RCC_GPIOB_CLK_ENABLE();
 
  /* Configure PC.13 pin as input floating */
  GPIO_InitStructure.Mode = GPIO_MODE_IT_RISING;
  GPIO_InitStructure.Pull = GPIO_PULLDOWN;
  GPIO_InitStructure.Pin = GPIO_PIN_6;
  HAL_GPIO_Init(GPIOB, &GPIO_InitStructure);
  
  /* Enable and set EXTI lines 9 to 5 Interrupt to the lowest priority */
   HAL_NVIC_SetPriority(EXTI9_5_IRQn, 5, 0);
   HAL_NVIC_EnableIRQ(EXTI9_5_IRQn);
}

Unfortunately it didn't solve my issue. The IRQ is iomplemented but the main program gets stuck in a while loop, as if the MCU just stops working.

The systick priority is set to 0:

#define TICK_INT_PRIORITY      ((uint32_t)0U) /*!< tick interrupt priority */

SOLVED:

For the one's who might come up with this problem, check the startup_stm32h743xx.s file.

In .s the file the exti9_5 handler was being declared as  EXTI9_5_IRQHandler instead of EXTI9_5_IRQHandler_Config ans I did in the man file.

I changed the function name in the main.cpp to match the name in the .s file and it's working

0 REPLIES 0