This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/TMDXRM42HDK: Interrupt

Part Number: TMDXRM42HDK
Other Parts Discussed in Thread: HALCOGEN

Tool/software: Code Composer Studio

I running a while loop for a clock signal in the main() . But I want get into a interrupt routine with an short serial output when I push S1 (GIOA7) . I don't know how I can realise this when the processor is always in the while loop. How can I jump in the ISR and go back to the while clock loop?

  • Hello Marcel,

    You can enable GIO interrupt. Please use the HALCoGen to generate a project and import this project into CCS

    1. Open the HALCoGen project

    2. Check "Enable GIO driver" under "Driver Enable"

    3. Check GIOA under "PINMUX"

    4.  Check VIM channel 9 (GIO Int A) under "VIM channel 0-31"

    5.  Click "GIO" tab, check the Enable pf Bit 7

    6.Save project and generate code

    7. This is the generated GIO ISR

    /** @fn void gioHighLevelInterrupt(void)
    * @brief GIO Interrupt Handler
    *
    * High Level Interrupt handler for GIO pin interrupt
    *
    */
    #pragma CODE_STATE(gioHighLevelInterrupt, 32)
    #pragma INTERRUPT(gioHighLevelInterrupt, IRQ)

    /* SourceId : GIO_SourceId_011 */
    /* DesignId : GIO_DesignId_011 */
    /* Requirements : HL_SR35, HL_SR36 */
    void gioHighLevelInterrupt(void)
    {
    uint32 offset = gioREG->OFF1;

    /* USER CODE BEGIN (14) */
    /* USER CODE END */

    if (offset != 0U)
    {
    offset = offset - 1U;
    gioNotification(gioPORTA, offset);
    }

    /* USER CODE BEGIN (15) */
    /* USER CODE END */

    }

    8. Add your code in gioNotification(..) function

    #pragma WEAK(gioNotification)
    void gioNotification(gioPORT_t *port, uint32 bit)
    {
    /* enter user code between the USER CODE BEGIN and USER CODE END. */
    /* USER CODE BEGIN (19) */

       add your code here


    /* USER CODE END */
    }

  • The simplest way would be to enable interrupts on GIOA7. The interrupt will cause program execution to branch to the interrupt service routine (ISR). During the ISR for the GPIO interrupt, you could send the data on SCI.

    Interrupts can be configured using Halcogen. You have the choice to select either the gioLowLevelInterrupt (VIM channel 23) or the gioHighLevelInterrupt (VIM channel 09) . The interrupt assignment can be enabled under the appropriate tab (VIM Channel 0-31, VIM Channel 32-63, etc.) by closing the connection between the boxes for the associated channel.

    You will also need to enable the GPIOA7 interrupts under the GIO configuration tab by selecting enable and the high or low priority level.

    This will generate the notification function that will be called when the interrupt fires. You will need to define this function as an interrupt using a #pragma statement.

    Some examples on how to do this can be found in the Halcogen examples, even if they are not the GPIO interrupt, the process is similar.
  • Hi, ok understand this. Thank you. But what I have to call in main for interrupt before my while loop is called? BR
    Marcel