- 
                Notifications
    
You must be signed in to change notification settings  - Fork 8.2k
 
TI MSPM0 Support #79673
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TI MSPM0 Support #79673
Changes from all commits
4227dad
              24e8378
              e8f2210
              48030a7
              4c0e81d
              d390b17
              cf5480f
              8d0d1fa
              d0c9952
              File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| # Copyright (c) 2024 Texas Instruments | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| 
     | 
||
| config BOARD_LP_MSPM0G3507 | ||
| select SOC_MSPM0G3507 | 
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| 
     | 
||
| include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake) | 
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| board: | ||
| name: lp_mspm0g3507 | ||
| vendor: ti | ||
| socs: | ||
| - name: mspm0g3507 | 
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,194 @@ | ||
| .. _lp_mspm0g3507: | ||
| 
     | 
||
| MSPM0G3507 LaunchPad | ||
| ######################## | ||
| 
     | 
||
| Overview | ||
| ******** | ||
| 
     | 
||
| MSPM0G350x microcontrollers (MCUs) are part of the MSP highly integrated, ultra-low-power 32-bit MCU | ||
| family based on the enhanced Arm® Cortex®-M0+ 32-bit core platform operating at up to 80-MHz frequency. | ||
| These cost-optimized MCUs offer high-performance analog peripheral integration, support extended temperature | ||
| ranges from -40°C to 125°C, and operate with supply voltages ranging from 1.62 V to 3.6 V. | ||
| 
     | 
||
| The MSPM0G350x devices provide up to 128KB embedded flash program memory with built-in error correction | ||
| code (ECC) and up to 32KB SRAM with a hardware parity option. These MCUs also incorporate a | ||
| memory protection unit, 7-channel DMA, math accelerator, and a variety of peripherals including | ||
| * Analog. | ||
| 
     | 
||
| * Two 12-bit 4-Msps ADCs. | ||
| 
     | 
||
| * Configurable internal shared voltage reference. | ||
| 
     | 
||
| * One 12-bit 1-Msps DAC. | ||
| 
     | 
||
| * Three high speed comparators with built-in reference DACs. | ||
| 
     | 
||
| * Two zero-drift zero-crossover op-amps with programmable gain. | ||
| 
     | 
||
| * Digital. | ||
| 
     | 
||
| * Two 16-bit advanced control timers. | ||
| 
     | 
||
| * Five general-purpose timers. | ||
| 
     | 
||
| * One 16-bit general-purpose timer for QEI interface. | ||
| 
     | 
||
| * One 32-bit high resolution general-purpose timer. | ||
| 
     | 
||
| * Two 16-bit timers with deadband support and up to 12 PWM Channels. | ||
| 
     | 
||
| * Two windowed-watchdog timers. | ||
| 
     | 
||
| * One RTC with alarm and calendar modes. | ||
| 
     | 
||
| * Data Integrity and Encryption. | ||
| 
     | 
||
| * One AES HW accelerator capable of CTR, CBC, and ECB modes. | ||
| 
     | 
||
| * One Cyclic Redundancy Check (CRC) accelerator. | ||
| 
     | 
||
| * One True Random Number Generator (TRNG). | ||
| 
     | 
||
| * Communication. | ||
| 
     | 
||
| * Four UARTs, one with support for advanced modes such as LIN and Manchester. | ||
| 
     | 
||
| * Two I2C supporting SMBUS/PMBUS and speeds up to FM+ (1Mbits/s). | ||
| 
     | 
||
| * Two SPI, one with max speed 32Mbits/s. | ||
| 
     | 
||
| * One CAN interface supporting CAN 2.0 A or B and CAN-FD. | ||
| 
     | 
||
| .. figure:: img/lp_mspm0g3507.webp | ||
| :align: center | ||
| :alt: MSPM0G3507 LaunchPad development board | ||
| 
     | 
||
| Zephyr uses the ``lp_mspm0g3507`` board configuration for building | ||
| the LP_MSPM0G3507 | ||
| 
     | 
||
| Features: | ||
| ========= | ||
| 
     | 
||
| - Onboard XDS110 debug probe | ||
| - EnergyTrace technology available for ultra-low-power debugging | ||
| - 2 buttons, 1 LED and 1 RGB LED for user interaction | ||
| - Temperature sensor circuit | ||
| - Light sensor circuit | ||
| - External OPA2365 (default buffer mode) for ADC (up to 4 Msps) evaluation | ||
| - Onboard 32.768-kHz and 40-MHz crystals | ||
| - RC filter for ADC input (unpopulated by default) | ||
| 
     | 
||
| Details on the MSPM0G3507 LaunchPad can be found on the `TI LP_MSPM0G3507 Product Page`_. | ||
| 
     | 
||
| Supported Features | ||
| ================== | ||
| 
     | 
||
| The MSPM0G3507 LaunchPad development board configuration supports the following hardware features: | ||
                
       | 
||
| 
     | 
||
| +-----------+------------+-----------------------+ | ||
| | Interface | Controller | Driver/Component | | ||
| +===========+============+=======================+ | ||
| | NVIC | on-chip | nested vectored | | ||
| | | | interrupt controller | | ||
| +-----------+------------+-----------------------+ | ||
| | SYSTICK | on-chip | system clock | | ||
| +-----------+------------+-----------------------+ | ||
| | UART | on-chip | serial | | ||
| +-----------+------------+-----------------------+ | ||
| | GPIO | on-chip | gpio | | ||
| +-----------+------------+-----------------------+ | ||
| | PINMUX | on-chip | pinctrl | | ||
| +-----------+------------+-----------------------+ | ||
| | CLOCKMUX | on-chip | clockctl | | ||
| +-----------+------------+-----------------------+ | ||
| 
     | 
||
| More details about the supported peripherals are available in `MSPM0G3507 TRM`_. | ||
| Other hardware features are not currently supported by the Zephyr kernel. | ||
| 
     | 
||
| Building and Flashing | ||
| ********************* | ||
| 
     | 
||
| Building | ||
| ======== | ||
| 
     | 
||
| Follow the :ref:`getting_started` instructions for Zephyr application development. | ||
| 
     | 
||
| For example, to build the blinky application for the MSPM0G3507 LaunchPad: | ||
| 
     | 
||
| .. zephyr-app-commands:: | ||
| :zephyr-app: samples/basic/blinky | ||
| :board: lp_mspm0g3507 | ||
| :goals: build | ||
| 
     | 
||
| The resulting ``zephyr.bin`` binary in the build directory can be flashed onto | ||
| MSPM0G3507 LaunchPad using the steps mentioned below. | ||
| 
     | 
||
| Flashing | ||
| ======== | ||
| 
     | 
||
| Open OCD is used to program the flash memory on the devices. It may be necessary in earlier versions to use a branch of open OCD onto the device. | ||
| 
     | 
||
| Before OpenOCD is public, one can clone `This Repo <https://github.com/nmenon/openocd/tree/mspm0>`_, and then this can be built with | ||
| 
     | 
||
| ``` | ||
| cd <cloned_OPENOCD_dir> | ||
| ./bootstrap (when building from the git repository) | ||
| ./configure --enable-xds110 | ||
| make | ||
| sudo make install | ||
| ``` | ||
| 
     | 
||
| Then after the build, it is possible to flash the device by passing additional arguments to the flash command | ||
| 
     | 
||
| ``` | ||
| west flash --openocd <path to cloned dir>/src/openocd --openocd-search <path to cloned dir>/tcl | ||
| ``` | ||
| 
     | 
||
| 
     | 
||
| `UniFlash`_ can also be used to program the flash memory if needed. The flash utility, | ||
| however, requires the use of 8-byte aligned words, so adding alignment to the linker file is necessary. | ||
| 
     | 
||
| Debugging | ||
| ========= | ||
| 
     | 
||
| The flashing method described above does not include symbols. Thus, debugging requires an additional step to load the symbols. | ||
| This section shows how to debug the MSPM0G3507 LaunchPad board using `CCS IDE`_. More information | ||
| on debugging using CCS can be found in `CCS User's Guide`_. | ||
| 
     | 
||
| In general, the steps for debugging in CCS are: | ||
| 
     | 
||
| 1. Open CCS | ||
| 2. Go to :menuselection:`Window --> Show View --> Target Configruation` | ||
| 3. Import target confguration by right clicking User Defined, selecting Import target configuration and pointing to the lp_mspm0g3507/support/MSPM0G3507.ccxml | ||
| 4. Launch target configuration by right clicking the new MSPM0G3507.ccxml file and clicking Launch target configuration | ||
| 5. Plug in the device and connect to it by going to :menuselection:`Run --> Connect Target` | ||
| 6. Go to :menuselection:`Run --> Load --> Load Symbols and load in the zephyr.elf file loaded` | ||
| 7. Use CCS to debug | ||
                
       | 
||
| 
     | 
||
| References | ||
| ********** | ||
| 
     | 
||
| TI MSPM0 MCU Page: | ||
| https://www.ti.com/microcontrollers-mcus-processors/arm-based-microcontrollers/arm-cortex-m0-mcus/overview.html | ||
| 
     | 
||
| TI MSPM0G3507 Product Page: | ||
| https://www.ti.com/product/MSPM0G3507 | ||
| 
     | 
||
| TI MSPM0 SDK: | ||
| https://www.ti.com/tool/MSPM0-SDK | ||
| 
     | 
||
| .. _CCS User's Guide: | ||
| https://software-dl.ti.com/ccs/esd/documents/users_guide/index.html | ||
| 
     | 
||
| .. _MSPM0G3507 TRM: | ||
| https://www.ti.com/lit/slau846 | ||
| 
     | 
||
| .. _TI LP_MSPM0G3507 Product Page: | ||
| https://www.ti.com/tool/LP-MSPM0G3507 | ||
| 
     | 
||
| .. _UniFlash: | ||
| http://processors.wiki.ti.com/index.php/UniFlash_v4_Quick_Guide#Command_Line_Interface | ||
| 
     | 
||
| .. _CCS IDE: | ||
| http://www.ti.com/tool/ccstudio | ||
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| /* SPDX-License-Identifier: Apache-2.0 */ | ||
| 
     | 
||
| /dts-v1/; | ||
| 
     | 
||
| #include <ti/mspm0g1x0x_g3x0x/mspm0g3507.dtsi> | ||
| #include <ti/mspm0g1x0x_g3x0x/mspm0g350x-pinctrl.dtsi> | ||
| #include <zephyr/dt-bindings/input/input-event-codes.h> | ||
| 
     | 
||
| / { | ||
| model = "TI LP_MSPM0G3507"; | ||
| compatible = "ti,mspm0g3507"; | ||
| 
     | 
||
| aliases { | ||
| led0 = &led0; | ||
| led1 = &led1; | ||
| sw0 = &btn0; | ||
| sw1 = &btn1; | ||
| }; | ||
| 
     | 
||
| chosen { | ||
| zephyr,sram = &sram0; | ||
| zephyr,flash = &flash0; | ||
| zephyr,console = &uart0; | ||
| zephyr,shell-uart = &uart0; | ||
| }; | ||
| 
     | 
||
| leds { | ||
| compatible = "gpio-leds"; | ||
| led0: led_2_b { | ||
                
       | 
||
| gpios = <&gpiob 22 GPIO_ACTIVE_HIGH>; | ||
| label = "Blue RBG LED"; | ||
| }; | ||
| led1: led_2_r { | ||
| gpios = <&gpiob 26 GPIO_ACTIVE_HIGH>; | ||
| label = "Red RBG LED"; | ||
| }; | ||
| led2: led_2_g { | ||
| gpios = <&gpiob 27 GPIO_ACTIVE_HIGH>; | ||
| label = "Green RBG LED"; | ||
| }; | ||
| led3: led_1 { | ||
| gpios = <&gpioa 0 GPIO_ACTIVE_LOW>; | ||
| label = "Red LED"; | ||
| }; | ||
| }; | ||
| 
     | 
||
| keys { | ||
| compatible = "gpio-keys"; | ||
| btn0: btn_0 { | ||
| gpios = <&gpiob 21 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; | ||
| label = "Switch 2"; | ||
| zephyr,code = <INPUT_KEY_0>; | ||
| }; | ||
| btn1: btn_1 { | ||
| gpios = <&gpioa 18 GPIO_ACTIVE_HIGH>; | ||
| label = "Switch 1"; | ||
| zephyr,code = <INPUT_KEY_1>; | ||
| }; | ||
| }; | ||
| }; | ||
| 
     | 
||
| &cpu0 { | ||
| clock-frequency = <DT_FREQ_M(80)>; | ||
| }; | ||
| 
     | 
||
| &clkmux { | ||
| clock-source = <&pll>; | ||
| clock-frequency = <DT_FREQ_M(80)>; | ||
| 
         
      Comment on lines
    
      +63
     to 
      +68
    
   
  There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. duplicate frequencies here?  | 
||
| uclk-div = <2>; | ||
| }; | ||
| 
     | 
||
| &gpioa { | ||
| status = "okay"; | ||
| }; | ||
| 
     | 
||
| &gpiob { | ||
| status = "okay"; | ||
| }; | ||
| 
     | 
||
| &uart0 { | ||
| status = "okay"; | ||
| current-speed = <115200>; | ||
| pinctrl-0 = <&uart0_tx_pa10 &uart0_rx_pa11>; | ||
| pinctrl-names = "default"; | ||
| }; | ||
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| identifier: lp_mspm0g3507 | ||
| name: LP_MSPM0G3507 | ||
| type: mcu | ||
| arch: arm | ||
| toolchain: | ||
| - zephyr | ||
| - gnuarmemb | ||
| - xtools | ||
| ram: 32 | ||
| flash: 128 | ||
| supported: | ||
| - gpio | ||
| - pinctrl | ||
| - uart | ||
| vendor: ti | 
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| 
     | 
||
| CONFIG_CORTEX_M_SYSTICK=y | ||
| 
         There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why is this needed? isn't DT enough?  | 
||
| 
     | 
||
| # Enable GPIO driver | ||
| CONFIG_GPIO=y | ||
| 
     | 
||
| # Enable UART driver | ||
| CONFIG_SERIAL=y | ||
| 
     | 
||
| # Enable Console | ||
| CONFIG_CONSOLE=y | ||
| CONFIG_UART_CONSOLE=y | ||
| 
     | 
||
| # Enable Clock Control | ||
| CONFIG_CLOCK_CONTROL=y | ||
| 
         
      Comment on lines
    
      +15
     to 
      +16
    
   
  There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. shouldn't drivers select this?  | 
||
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| source [find interface/xds110.cfg] | ||
| adapter speed 10000 | ||
| 
     | 
||
| source [find target/ti_mspm0.cfg] | 
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
| @@ -0,0 +1,17 @@ | ||||
| # TI MSPM0 Family | ||||
| 
     | 
||||
| # Copyright (c) 2024, Texas Instruments Inc. | ||||
| # SPDX-License-Identifier: Apache-2.0 | ||||
| 
     | 
||||
| config CLOCK_CONTROL_MSPM0 | ||||
| bool "TI MSPM0 clock" | ||||
| default y | ||||
| depends on SOC_FAMILY_TI_MSPM0 | ||||
| help | ||||
| This option enables the TI MSPM0 Clock Control Enabler | ||||
| 
         There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TRM calls it as   | 
||||
| 
     | 
||||
| config CLOCK_CONTROL_MSPM0_USE_PLL | ||||
| 
         There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. code consumes it by checking   | 
||||
| bool "TI MSPM0 Use PLL" | ||||
| default n | ||||
                
       | 
||||
| default n | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implemented spacing correctly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.