Skip to main content
RhSilicon
Lead
June 23, 2023
Solved

In which STM32CubeIDE project file are the USB OTG interrupt priority values?

  • June 23, 2023
  • 6 replies
  • 3589 views

Hi, I'm testing the priorities of the modules, and I would like to know in which file the "Device Configuration Tool Code Generator" saved the NVIC definitions.

I have a lot of code outside the delimiters, I can't use the "Device Configuration Tool Code Generator", so I need to know which file is saved, and change manually.

NVIC.png

    This topic has been closed for replies.
    Best answer by Peter BENSCH

    A distinction must be made between

    • the configuration file IOC, which describes the current basic configuration
    • the generated programme framework, in which one places one's own code between the USER CODE BEGIN - USER CODE END markers

    The IOC uses STM32CubeMX as the starting point for programme generation. The IOC is also used for later programme generation after a possible change in the configuration (further peripherals or pins to be used, etc.), whereby the own code parts between the above markers are retained (as long as the respective peripherals are not removed).

    The NVIC priority is now stored in the IOC at the mentioned location for later programme generation. In the generated source code, however, the priority stored in the IOC is also inserted, e.g. in USB_HOST\Target\usbh_conf.c, depending on the USB function selected using e.g. 

    HAL_NVIC_SetPriority(OTG_FS_IRQn, xxx, 0);

    I hope I understood your question correctly and could help you with it?

    Regards
    /Peter

    6 replies

    Peter BENSCH
    ST Technical Moderator
    June 23, 2023

    The NVIC definitions are stored in the IOC file, which is a text file, but you have to be very careful when modifying it so as not to destroy the structure. Since it is not intended for manual modification, there is also little documentation on the internal structure.
    However, you will find the IRQ priority under NVIC.OTG_FS_IRQn.

    Hope that helps?

    Regards
    /Peter

    In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
    RhSilicon
    RhSiliconAuthor
    Lead
    June 23, 2023

    Thanks,

    If the intention is not to be handled manually, how can I add delimiters in the code for the automatic generator to preserve my code?

    RhSilicon
    RhSiliconAuthor
    Lead
    June 23, 2023

    NVIC.OTG_FS_IRQn.png

     

    This is the last place I would look, I thought this file was read only by "Device Configuration Tool Code Generator"

    RhSilicon
    RhSiliconAuthor
    Lead
    June 23, 2023

    I closed the project, removed the *.ioc file and performed project cleanup, but it compiled with no errors. So there must be another file that has this priority data.

    RhSilicon
    RhSiliconAuthor
    Lead
    June 23, 2023

    Or is it not possible to change the priority and the "Device Configuration Tool Code Generator" shows this option just for decoration?

    Peter BENSCH
    Peter BENSCHBest answer
    ST Technical Moderator
    June 23, 2023

    A distinction must be made between

    • the configuration file IOC, which describes the current basic configuration
    • the generated programme framework, in which one places one's own code between the USER CODE BEGIN - USER CODE END markers

    The IOC uses STM32CubeMX as the starting point for programme generation. The IOC is also used for later programme generation after a possible change in the configuration (further peripherals or pins to be used, etc.), whereby the own code parts between the above markers are retained (as long as the respective peripherals are not removed).

    The NVIC priority is now stored in the IOC at the mentioned location for later programme generation. In the generated source code, however, the priority stored in the IOC is also inserted, e.g. in USB_HOST\Target\usbh_conf.c, depending on the USB function selected using e.g. 

    HAL_NVIC_SetPriority(OTG_FS_IRQn, xxx, 0);

    I hope I understood your question correctly and could help you with it?

    Regards
    /Peter

    In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.