yahboom
HomeLearn
Solution
Blog
Online Store
About Us
EN/中文
MSPM0 Smart Robot Car📖
1.Quick Start Guide
  • 1. Assembly Videos
  • 2. Quick Start Videos
  • 3. Battery charging
  • 4. Notes
2.Introduction to the MSPM0 Car
  • 1.About MSPM0
  • 2.Development board interface description
3.Development environment setup and usage
  • 1.CCS Theia development
  • 2.MDK Arm development
  • 3.Uniflash burning
  • 4.External crystal oscillator configuration
  • 5.Project Migration
4.MSPM0 basic course
  • 1. LED light control (GPIO)
  • 2. Buzzer Control (GPIO)
  • 3. Button Control (EXTI)
  • 4. Serial Port (UART)
  • 5. Voltage Detection (ADC)
  • 6. Temperature Detection (ADC)
  • 7. Independent Watchdog (WWDG)
  • 8. Window Watchdog (WWDG)
  • 9. Timer (TIM)
  • 10. Breathing LED (PWM)
  • 11. I2C Communication (I2C)
  • 12. External Flash (SPI)
  • 13. Internal Flash (Flash)
  • 14. DMA
  • 15. FreeRTOS
5.Sensor basic course
  • 1.Servo control
  • 2.Ultrasonic servo PTZ basic use
  • 3.Motor PID control
  • 4.OLED display photosensitive value
  • 5.Infrared avoid sensor
  • 6.1 Infrared line tracking sensor-8 channel infrared tracking sensor module
  • 6.2 Infrared line tracking sensor-4 channel infrared tracking sensor module
  • 7.Infrared remote control
  • 8.Ultrasonic ranging
  • 9.RGB light drive
  • 10.MPU6050 raw data acquisition
  • 11.MPU6050 data fusion
  • 12.K210 vision recognition module
  • 13.K230 vision recognition module
6.Smart car course
  • 1.1 Car line tracking-8 channel infrared tracking sensor module
  • 1.2 Car line tracking-4 channel infrared tracking sensor module
  • 2.1 Drawing a circle-8 channel infrared tracking sensor module
  • 2.2 Drawing a circle-4 channel infrared tracking sensor module
  • 3.Ultrasonic following
  • 4.Ultrasonic avoid
  • 5.Ultrasonic avoid(Servo PTZ)
  • 6.Infrared sensor avoid
  • 7.Light following
  • 8.Gyroscope calibration straight-line walk
  • 9.Infrared remote control
  • 10.Autonomous driving car
7.Vision application course
  • 1.K210 autonomous driving
  • 2.K210 color tracking
  • 3.K210 handwritten digit action
  • 4.K210 color response
  • 5.K210 road sign indication action
  • 6.K210 following machine code
  • 7.K210 QR code command
  • 8.K230 vision line tracking
  • 9.K230 color tracking
  • 10.K230 machine code tracking
  • 11.K230 QR code command
  • 12.K230 autonomous avoid
  • 13.K230 license plate tracking
  • 14.K230 face tracking
  • 15.K230 gaze direction tracking
  • 16.K230 palm tracking
  • 17.K230 target tracking
  • 18.K230 human body tracking
  • 19.K230 OCR character recognition
8.Extended application course (Sold separately)
  • 1.Voice interaction module communication
  • 2.Voice interaction control
  • 3.K230 road sign indication action(Voice)
  • 4.K230 color response(Voice)
  • 5.K230 gesture control(Voice)
  • 6.K230 rock-paper-scissors(Voice)
  • 7.8-channel grayscale color line tracking
  • 8.Bluetooth remote control
  • 9.K210 Scenario-based autonomous driving
  • 10.K230 Scenario-based autonomous driving
Download
  • Code
  • SCH
  • 3D Model File
  • MSPM0 Data Sheet
  • Voice firmware
  • Hardware interface manual
Download ZIP

Welcome to MSPM0 Smart Robot Car repository

13. Internal Flash (Flash)

On-chip Flash (Flash)

On-chip Flash (Flash)I. Learning ObjectivesII. Flash IntroductionIII. Hardware SetupIV. Software Environment SetupV. Code AnalysisVI. Experiment Phenomenon

I. Learning Objectives

  1. Learn and understand basic flash knowledge.
  2. Learn to read and write the flash of MSPM0G3507.

The DAP-LINK debugging tool used in this tutorial section needs to be prepared by yourself

II. Flash Introduction

First, we need to understand several unit terms

Sector: Sector (1KB)

BANK: A group of sectors that can be batch erased in a single operation; only one operation (read, program, erase, or verify) can run simultaneously on the same Bank, maximum 256 sectors

MSPM0G350x has flash memory with error correction code (ECC) and up to 128KB, where the first 32KB has 100,000 programming/erasing cycles (addresses 0x0000.0000 to 0x0000.8000), and up to 10,000 programming/erasing cycles can be performed on the remaining flash. Flash is used to store application code and data, device startup configuration, and parameters pre-programmed by TI from the factory. In this section, we will write specified data to flash starting from address 0x00001000 and then view it through simulation tools.

image-20251024155044879

image-20251024144150386

image-20251024151549373

 

III. Hardware Setup

This course requires connecting a debugging tool, using DAP-Link as an example. For details, please refer to [M0 Car Development Board Instructions] SWD Debug Interface

DAP-LINKMSPM0G3507
GNDGND
VDD or 3V33V3
SWCLK/CLKSWCLK(PA20)
SWDIO/DIOSWDIO(PA19)

image-20251024160848743

IV. Software Environment Setup

In this tutorial section, we will build based on the LED project. First, we open SWD through sysconfig, then save and generate code

image-20251024162006443

Configure the programmer, using DAP-LINK as an example here. Other programmers can be selected according to your own configuration.

image-20251024171925835

V. Code Analysis

xxxxxxxxxx
Flash writing process: Unprotect -> Erase Sector/Bank -> Write specified data
    /* Unprotect sectors in main memory (hardware generates ECC) */
    DL_FlashCTL_unprotectSector(
        FLASHCTL, TARGET_ADDRESS, DL_FLASHCTL_REGION_SELECT_MAIN);
    
    /* Erase sectors in main memory */
    gCmdStatus = DL_FlashCTL_eraseMemoryFromRAM(
        FLASHCTL, TARGET_ADDRESS, DL_FLASHCTL_COMMAND_SIZE_SECTOR);
    
        if (gCmdStatus == DL_FLASHCTL_COMMAND_STATUS_FAILED) {
        /* If command execution fails, set error flag */
        gErrorCode = ERROR_ERASE;
    }
​
    if (gErrorCode == NO_ERROR) {
        /* Perform 8-bit write to main memory flash */
        DL_FlashCTL_unprotectSector(
            FLASHCTL, TARGET_ADDRESS, DL_FLASHCTL_REGION_SELECT_MAIN);
            
        gCmdStatus = DL_FlashCTL_programMemoryFromRAM8WithECCGenerated(
            FLASHCTL, TARGET_ADDRESS, &gData8);
        if (gCmdStatus == DL_FLASHCTL_COMMAND_STATUS_FAILED) {
            /* If command execution fails, set error flag */
            gErrorCode = ERROR_8BIT_W;
        }
    }

VI. Experiment Phenomenon

After the program is flashed, write one byte, two bytes, three bytes, and four bytes of data to the specified position sequentially. After writing is completed, the MCU indicator light will flash once every 1 second. We can view the written values through debugging tools

image-20251024172422478

External Flash (SPI)
DMA

COMPANY

  • About us
  • Team Style
  • Blog

LEARNING & EXPLORATION

  • Tutorials
  • Edge AI hardware
  • Educational robots
  • Embedded intelligent hardware

WHERE TO BUY

  • Yahboom Online Store
  • Amazon
  • Alibaba
  • AliExpress
  • Mercado

TECHNOLOGY SUPPORT

  • Email: support@yahboom.com

BE A DISTRIBUTOR

  • Email: sales@yahboom.com
QR Code
QR Code

Copyright © 2017-2026 Yahboom. All Rights Reserved.

EN/中文