SLAAEI9 December 2023 MSPM0C1103 , MSPM0C1103-Q1 , MSPM0C1104 , MSPM0C1104-Q1 , MSPM0G1105 , MSPM0G1106 , MSPM0G1107 , MSPM0G1505 , MSPM0G1506 , MSPM0G1507 , MSPM0G3105 , MSPM0G3105-Q1 , MSPM0G3106 , MSPM0G3106-Q1 , MSPM0G3107 , MSPM0G3107-Q1 , MSPM0G3505 , MSPM0G3505-Q1 , MSPM0G3506 , MSPM0G3506-Q1 , MSPM0G3507 , MSPM0G3507-Q1 , MSPM0L1105 , MSPM0L1106 , MSPM0L1228
The MSPM0 design flow is shown below. This example aims to use PWM to drive LED.
When the environment is ready, you can import code into CCS. As for this example, a timer is used to control PWM. The first thing to do is understand any differences between the timer modules between STM8 and MSPM0, and choose the similar example in SDK of MSPM0.
The closet example in the SDK is probably ” timx_timer_mode_pwm_center_stop”. Once a similar example is found, open CCS and import the code example by going to Project --> Import CCS Projects... and navigate it to the MSPM0 SDK example folder.
To see the SysConfig configuration, open the .syscfg file. Select TIMER-PWM section to generate PWM, as shown in Figure 2-42. Check the PWM’s clock configuration, like self frequency and duty cycle. In this case, PWM frequency is 2.7Hz and 75% duty cycle. You can change duty cycle easily through typing 50% in desired duty cycle, and then Counter compare Value changes automatically.
To further elaborate on each feature module, you can click “?” next to each item.
Also check the rest feature of TIMER-POWER module and pins being used by clicking the chip icon in the top right and checking the highlighted pins for the PWM.
When the project is saved and rebuilt, SysConfig updates the files in Figure 2-45. At this point, the example hardware configuration has been modified to match the full functionality of the original software being ported.
The only remaining effort is to check application-level software. This example generates PWM waves like SDK code, so there is no need to change the .c file.
Get LaunchPad plugged into the computer. According to pins configurations, use DuPont cables to connect the PA12 to the LED pins.
Start debug, by clicking debug icon. And you can set breakpoint by double-click the space before the line number or adding one line code __BKPT();
Try to use debug functions (detailed can be seen in Section 2.2.2.2) and verify the feasibility of the procedure. While debugging, LED can be toggled as code is running step by step.
The specific steps are shown in Figure 2-48. Go to the entrance of Ultra Librarian tool under MSPM0 device page (detailed can be seen in Section 2.2.5). Clink View options. Select your wanted CAD format and Pin ordering, then you can get the Altium design lib file.
As the lib have been downloaded, the next step is to run Altium Designer script and generate PCB lib and schematic library, as shown in Figure 2-49.
After completing the steps, the following new files are going to generated in the same source folder.
The final step is to import them into your AD lib, as shown in Figure 2-51. And based on this, a schematic and PCB can be designed.