AnsweredAssumed Answered

OTG FS IRQChannel not "recognized" by F105RBT6?

Question asked by cuneo.john on May 13, 2014
Latest reply on May 13, 2014 by cuneo.john
I'm working on a project based on the V2.10 Host lib.
When trying to enable global interrupt for OTG FS, the program enters the hardware fault "loop of death"(the notorious HardFault_Handler in stm32f10x_it.c)

Problematic codes:

void USB_OTG_BSP_EnableInterrupt(USB_OTG_CORE_HANDLE *pdev)
{
  NVIC_InitTypeDef NVIC_InitStructure;
 
  NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);

  NVIC_InitStructure.NVIC_IRQChannel = 67;
  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 3;
  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
  NVIC_Init(&NVIC_InitStructure); 

...

}

In debug mode, I pinpointed the actual code that's responsible: (in misc.c)

  /* Enable the Selected IRQ Channels --------------------------------------*/
    NVIC->ISER[NVIC_InitStruct->NVIC_IRQChannel >> 0x05] =
      (uint32_t)0x01 << (NVIC_InitStruct->NVIC_IRQChannel & (uint8_t)0x1F);

So I'm thinking the value "67", which according to a .c file in the V2.10 library should be the channel number for I\OTG FS global interrupt, clearly isn't working out for F105.

So why am I using this value "67" instead of #include certain files in the V2.10 lib, and let the compiler work out the rest? Because that would complicate my project. I would have to inevitably include a lot of things that I don't really want by doing that.

I know it's not "standard practice" to right click and use "go to definition" to find this value "67",  but I tried other ST documents, as always, the ST documents are painfully unorganized and the UM0427 did not even give the value for OTG IRQ channels. Table 274. NVIC_IRQChannels ended with "DMA2_Channel4_5_IRQChannel".

So could anyone please help me? Maybe I shouldn't use this value directly (which is highly improbable)? Or this value is wrong, should be something else?

Outcomes