Main Content

Configure Interrupts and Events Using Hardware Mapping

The Hardware Mapping tool allows you to configure the hardware interrupts tasks for the selected hardware board. With this tool, you can map the tasks in your software model to the available event sources and interrupts.

  1. Simulink® Toolstrip: On the Hardware tab, click Hardware Mapping.

    Alternatively, you can also launch it from the Hardware Interrupt block.

  2. Manually select the task in Browser > Tasks > CPU name (c28xCPU1, c28xCPU1 or CortexM4).

    Hardware Mapping

  3. Select the desired Interrupt group, Interrupt name and Event name for the corresponding task in the Hardware Interrupt block.

    • Interrupt group - the TI C2000™ peripheral and non-peripheral interrupts are classified into a various number of groups depending upon the peripheral causing the interrupt. The interrupt groups are populated depending upon the hardware board selected in the configuration parameters. Selecting an interrupt group changes the list of values in the Interrupt name parameter.

    • Interrupt name - corresponds to the specific entry in the processor's interrupt vector table. The available ISRs depend on the interrupt group.

    • The Event name lists all the events corresponding to the Interrupt group selected.

    • Event name - lists the events that causes the interrupts in the Interrupt name parameter. Additionally, you can configure Default event and Custom event for the interrupts having multiple events.

      • Custom event - This event can be used when interrupt is triggered using software. This is used to acknowledge interrupts which are triggered without peripheral intervention.

        In this event, neither interrupt flag check nor interrupt clearing is done. The code snippet for custom event will look like:

        // custom event
        
        interrupt void ISRNAME()
        {
        
        {
        //body of the event
        }
        
        //Acknowledge ISR
        
        }
        

      • Default event - This event is selected by default. In this event all the unselected events causing the interrupt is cleared. The subsystem corresponding to this event is executed only for the unselected events. If only default event is selected, no interrupt flag is checked.

        The code snippet for default event will look like:

        // Default event
        
        interrupt void ISRNAME()
        {
        
        if(selectedevents)
        {
        //body of the event;
        //clear selected events
        }
        if(nonselectedevents)
        {
        //body of the default event
        //clear all non selected events
        }
        //acknowledgeISR;
        }
        

    • Event Order - You can select multiple events for an interrupt. On the Hardware Interrupt block, for parameter Number of events to serve provide the number that you want to acknowledge.

      Specifying a value more than 1 in Number of events to serve parameter, will add that many out ports to the block. Each of the event can be configured in the hardware mapping. While configuring ensure the execution order is different for each event.

      The event order decides the execution order of the events in the ISR. The code snippet for multiple events will look like:

      interrupt ISRName()
      {
      //Execution order for event 1 is 1
      if(event1)
      {
      //subsystem1
      //clear event1;
      }
      //Execution order for event 1 is 2
      if(event2)
      {
      //subsystem2
      //clear event2;
      }
      ...
      //Acknowledge ISR
      }

    For example, to create an ISRNAME for multiple events with default event is selected, the code snippet will look like:

    interrupt ISRName()
    {
    //Execution order for event 1 is 1
    if(event1)
    {
    //code for the subsystem triggered by event1
    //clear event1;
    }
    //Execution order for event 1 is 2
    if(event2)
    {
    //code for the subsystem triggered by event2
    //clear event2;
    }
    //Default event
    if(event3)
    {
    //code for the subsystem triggered by default event
    //clear event3;
    }
    ...
    //Acknowledge ISR
    }

    Events configured

    The sources of events or interrupts depend on the choice of hardware board available in the model.

  4. Click the Apply Changes button in the toolstrip.

See Also

| |