3748 views|4 replies

231

Posts

5

Resources
The OP
 

TI MSPM0L1306 LaunchPad Experience 10: Control Logic That Does Not Take Up CPU - Magical Event Module [Copy link]

 

Event module in MSPM0

The Event module in MSPM0 implements autonomous communication between two entities, which include peripherals, DMA or CPU.
Pay special attention to one point: the Event module can also be regarded as a special peripheral, so it can operate independently of the processor (similar to Timer, ADC, OPA, etc.).
The specific event mapping diagram is as follows:
Compared with the general M0 core, TI has integrated a bunch of complex communication modules between CPU, DMA and peripherals into the Event module, which is very convenient to use.
The specific connection examples are as follows:
It can be seen that the common combinations between modules are available. Therefore, common requirements such as timer triggering ADC sampling and UART triggering DMA transfer are all achievable.
Even the publisher and subscriber of an event can be the same type of peripheral. For example, one GPIO can publish an event and another GPIO can subscribe to it. This is the basis for the following case to be implemented.

A case

The main procedure of the case is as follows:
This code does not contain any business logic. It simply configures the board parameters and then enters an infinite loop WFI(). However, the LED can be turned on and off by pressing a button.
What’s even more amazing is that in debug mode, after the debugger triggers the processor to pause, the button’s function of controlling the LED is still valid.
Seeing is believing video demonstration:
01Event演示out

This is the function of the Event module: to enable communication between peripherals without processor control.
There are buttons and LEDs on the LaunchPad, all connected to the MSPM0L1306 via GPIO.
You can set the Event from the button to the LED, that is, the GPIO corresponding to the button acts as the Event publisher, and the GPIO corresponding to the LED acts as the Event subscriber.
The set publishers and subscribers will be listed under the EVENT module.
The logic of the button trigger can be rising edge and/or falling edge, here we choose rising edge. The action strategy of LED is to flip IO. Through simple configuration, the event binding between button trigger and LED action can be realized without going through the processor.
Since the Event module is independent of the CPU, the Event module can still operate when the CPU is in debug interrupt state.

summary

The Event module is a featured module of MSPM0. It implements event publishing and subscription through hardware, greatly relieving the burden of the CPU and helping to reduce system power consumption.

Complete code

LaunchPad Main Program

#include "ti_msp_dl_config.h"

int main(void)
{
    SYSCFG_DL_init();

    DL_SYSCTL_enableSleepOnExit();

    while (1) {
        __WFI();
    }
}

SysConfig Reference Code

/**
 * These arguments were used when this file was generated. They will be automatically applied on subsequent loads
 * via the GUI or CLI. Run CLI with '--help' for additional information on how to override these arguments.
 * @cliArgs --device "MSPM0L130X" --package "VQFN-32(RHB)" --part "Default" --product "mspm0_sdk@1.20.00.06"
 * [url=home.php?mod=space&uid=304333]@versions[/url] {"tool":"1.18.0+3266"}
 */

/**
 * Import the modules used in this configuration.
 */
const GPIO   = scripting.addModule("/ti/driverlib/GPIO", {}, false);
const GPIO1  = GPIO.addInstance();
const GPIO2  = GPIO.addInstance();
const SYSCTL = scripting.addModule("/ti/driverlib/SYSCTL");

/**
 * Write custom configuration values to the imported modules.
 */
GPIO1.$name                             = "GPIO_LEDS";
GPIO1.port                              = "PORTA";
GPIO1.portSegment                       = "Lower";
GPIO1.associatedPins[0].$name           = "USER_LED_1";
GPIO1.associatedPins[0].assignedPin     = "0";
GPIO1.associatedPins[0].subChanID       = 1;
GPIO1.associatedPins[0].subOutputPolicy = "TOGGLE";
GPIO1.associatedPins[0].initialValue    = "SET";

const Board = scripting.addModule("/ti/driverlib/Board", {}, false);

GPIO2.$name                              = "GPIO_SWITCHES";
GPIO2.port                               = "PORTA";
GPIO2.associatedPins[0].$name            = "USER_SWITCH_1";
GPIO2.associatedPins[0].direction        = "INPUT";
GPIO2.associatedPins[0].pubChanID        = 1;
GPIO2.associatedPins[0].internalResistor = "PULL_UP";
GPIO2.associatedPins[0].interruptEn      = true;
GPIO2.associatedPins[0].assignedPin      = "14";
GPIO2.associatedPins[0].polarity         = "RISE";
GPIO2.associatedPins[0].pin.$assign      = "PA14";

SYSCTL.clockTreeEn = true;

/**
 * Pinmux solution for unlocked pins/peripherals. This ensures that minor changes to the automatic solver in a future
 * version of the tool will not impact the pinmux you originally saw.  These lines can be completely deleted in order to
 * re-solve from scratch.
 */
GPIO1.associatedPins[0].pin.$suggestSolution = "PA0";
Board.peripheral.$suggestSolution            = "DEBUGSS";
Board.peripheral.swclkPin.$suggestSolution   = "PA20";
Board.peripheral.swdioPin.$suggestSolution   = "PA19";

This post is from MSPM0 MCU

Latest reply

Learned a lot, was educated, the content is rich, it is worth watching!   Details Published on 2023-11-28 21:57
 
 

6818

Posts

11

Resources
2
 

The control logic that does not occupy the CPU actually still needs to be occupied, just a little less.

This post is from MSPM0 MCU

Comments

The routine does not occupy CPU, Event is a peripheral. When it is actually used, it is usually not that simple, and some CPU is needed to process some data, so it will occupy CPU.  Details Published on 2023-11-13 18:56
 
 
 

231

Posts

5

Resources
3
 
lugl4313820 posted on 2023-11-13 16:00 The control logic that does not occupy the CPU actually still needs to be occupied, just a little less.

The routine does not occupy CPU, Event is a peripheral. When it is actually used, it is usually not that simple, and some CPU is needed to process some data, so it will occupy CPU.

This post is from MSPM0 MCU
 
 
 

718

Posts

4

Resources
4
 

Thanks for the technical sharing provided by the host. Learn first and then participate in the discussion. Thumbs up

This post is from MSPM0 MCU
 
 
 

409

Posts

0

Resources
5
 

Learned a lot, was educated, the content is rich, it is worth watching!

This post is from MSPM0 MCU
 
 
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list