Skip to content

Commit df67892

Browse files
committed
Pull request #13: Code Maintenance Release v1.1.0
Merge in MCU16CE/dspic33ck-power-pwm-phase-shift from ~M91406/dspic33ck-power-pwm-phase-shift:code-maintenance to develop * commit 'd4597ba97b54131d8a6e15103729a75d38ee9d49': * Updated README file fixing data sheet links, toolchain versions and copyright dates * Updated Changelog with mode information about latest tool chain versions used Microchip Code Configurator Update * Updated MCC Plug-In version to require v5.3.7 or later * Updated mc3 file contents to work with core version 4.85.1 or later * Regenerated output * Updated deployment scripts * Changed label of PWM Module register set from P33C_PWM_SFRSET_t to P33C_PWM_MODULE_t * Removed obsolete vitrual folder from MPLAB X project explorer * Switched XC16 compiler version to v2.00 * Switched Device File Pack (DFP) to version 1.10.341 * Removed interrupt register bits, which are not supported by DFP versions v1.5.135 and later * Fixed typos in leading comment of main.c * Updated gitignore file filtering clutter of MPLAB X IDE 6.05 and later
2 parents 0baf3b1 + d4597ba commit df67892

File tree

12 files changed

+155
-89
lines changed

12 files changed

+155
-89
lines changed

.citd/Jenkinsfilek8s

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ pipeline {
2929
//This is the BitBucket source repo URL to be deployed
3030
BITBUCKET_SOURCE_URL = 'https://bitbucket.microchip.com/scm/mcu16ce/dspic33ck-power-pwm-phase-shift.git'
3131
//Files or folders to be excluded from deployment, if multiple files or folders use comma separator
32-
DEPLOY_EXCLUDE_FOLDER_FILE_LIST = 'mchp_private,.mchp_private,sandbox,.sandbox'
32+
DEPLOY_EXCLUDE_FOLDER_FILE_LIST = 'mchp_private,.mchp_private,mchpprivate,.mchp-private,sandbox,.sandbox, test, .test'
3333
//Branch(s) to be deployed, if multiple branches use comma separator. DEPLOY_BRANCH_LIST is the target branch of the PR.
3434
DEPLOY_BRANCH_LIST = "master"
3535
/*When using the main.json schema version 1.3.0 or higher, the PORTAL will first reject registration attempt when an unapproved keyword is found, but can be forced to accept.

.gitignore

+45-8
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,54 @@
11
# .gitignore file
22
#
3-
# Set up for Microchip/MPLAB X development
3+
# Set up for Microchip/MPLAB X® development
44
#
5-
# Default gitignore files for code examples, only removing/ignoring usual MPLAB X clutter
5+
# Default gitignore files for code examples, only removing/ignoring usual MPLAB X® clutter
66

7-
# Object files
7+
# Excluding object files
88
*.o
99
*.ko
1010
*.obj
1111
*.elf
1212

13-
# Executables
13+
# Excluding documentation output directories and file types
14+
docs/
15+
*.mp4
16+
.mchp_private/doxygen/doxylog.txt
17+
.mchp_private/doxygen/doxymsg.txt
18+
.mchp-private/doxygen/doxylog.txt
19+
.mchp-private/doxygen/doxymsg.txt
20+
mchp_private/doxygen/doxylog.txt
21+
mchp_private/doxygen/doxymsg.txt
22+
mchp-private/doxygen/doxylog.txt
23+
mchp-private/doxygen/doxymsg.txt
24+
25+
# Excluding archive and backup directories
26+
.archive/
27+
.backup/
28+
29+
# Excluding documentation input directories
30+
#_dox/
31+
#_dox/images/
32+
33+
# Excluding test output directories
34+
test/
35+
.test/
36+
37+
# Excluding SiMetrix/Simplis temporary simulation directories
38+
SIMPLIS_Data/
39+
TMP/
40+
41+
# Excluding any executables
1442
*.exe
1543

16-
# Netbeans specific
44+
#Excluding Files/Folders Auto-Generated by Test Harness
45+
.generated_files/
46+
node_modules/
47+
48+
# Excluding Netbeans specific build directories and file types
1749
~*.*
50+
.generated_files/
51+
queuelogs/
1852
nbproject/build/
1953
nbproject/dist/
2054
nbproject/private/
@@ -24,22 +58,25 @@ dist/
2458
private/
2559
disassembly/
2660
*.zip
61+
!code-templates.zip
2762
*.mk
2863
*.bash
64+
*.dump
2965
Makefile-genesis.properties
3066

31-
# MPLAB X Trace specific
67+
# Excluding MPLAB X® Trace files
3268
*.log
3369
*.inx
3470

71+
# VisualStudio Code specific
72+
buildLog/
73+
3574
# KDE specific
3675
.directory
3776

3877
# Misc
3978
.svn
4079
*.bak
41-
*.doc
42-
*.docx
4380

4481

4582

.main-meta/main.json

+9-9
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,25 @@
44
"content":{
55
"metaDataVersion":"1.3.0",
66
"name":"com.microchip.mplabx.project.dspic33ck-power-pwm-phase-shift",
7-
"version":"1.0.0",
7+
"version":"1.1.0",
88
"displayName":"dsPIC33CK/CH-MP PWM Configuration: Phase Shifted PWM Output",
99
"projectName":"dspic33ck-power-pwm-phase-shift",
1010
"shortDescription":"Phase Shifted PWM Output Configuration Example for dsPIC33CK-MP devices",
1111
"ide":{
1212
"name":"MPLABX",
13-
"semverRange":">=5.40.0"
13+
"semverRange":">=6.05.0"
1414
},
1515
"compiler":{
1616
"name":"XC16",
17-
"semverRange":"^1.50.0"
17+
"semverRange":"^2.00.0"
1818
},
1919
"dfp":{
2020
"name":"dsPIC33CK-MP_DFP",
21-
"semverRange":"^1.4.102"
21+
"semverRange":"^1.10.341"
2222
},
2323
"configurator": {
2424
"name": "MCC",
25-
"semverRange": ">=4.0.1"
25+
"semverRange": ">=5.3.7"
2626
},
2727
"device":{
2828
"metaDataVersion":"1.0.0",
@@ -37,10 +37,10 @@
3737
"keywords":[
3838
"dsc",
3939
"dspic",
40-
"power",
41-
"power-conversion",
42-
"power-supply",
43-
"smps"
40+
"power",
41+
"power-conversion",
42+
"power-supply",
43+
"smps"
4444
]
4545
}
4646
}

README.md

+30-20
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<p><a target="_blank" href="https://www.microchip.com" rel="nofollow"><img src="images/microchip.png" alt="MCHP" width="200";"></a></p>
44

55
# dsPIC33C High-Resolution PWM Configuration: Lab 4
6+
67
**Phase-Shifted PWM Waveform Generation**
78

89
<p><center><a href="https://www.microchip.com/MA330048" rel="nofollow">
@@ -11,46 +12,54 @@
1112
- - -
1213

1314
## Summary
15+
1416
Learning how to use the High Resolution PWM Module of dsPIC33C MP devices, Lab 4:
1517
Code example for dsPIC33CK and dsPIC33CH devices showing a basic configuration of the high-resolution PWM module using two PWM generator channels generating a Phase-Shifted PWM waveforms
1618

1719
- - -
1820

1921
## Related Documentation
20-
- [dsPIC33CK256MP508 Family Data Sheet](https://ww1.microchip.com/downloads/en/DeviceDoc/dsPIC33CK256MP508-Family-Data-Sheet-DS70005349G.pdf)
21-
- [dsPIC33CK256MP508 Family Silicon Errata and Data Sheet Clarification](https://ww1.microchip.com/downloads/en/DeviceDoc/dsPIC33CK256MP508-Family-Silicon-Errata-and-Data-Sheet-Clarification-DS80000796G.pdf)
22-
- [dsPIC33CH512MP508 Family Data Sheet](http://ww1.microchip.com/downloads/en/DeviceDoc/dsPIC33CH512MP508-Family-Data-Sheet-DS70005371D.pdf)
23-
- [dsPIC33CH512MP508 Family Silicon Errata and Data Sheet Clarification](http://ww1.microchip.com/downloads/en/DeviceDoc/dsPIC33CH512MP508-Family-Silicon-Errata-and-Data-Sheet-Clarification-DS80000805F.pdf)
22+
23+
- [dsPIC33CK256MP508 Family Data Sheet](https://www.microchip.com/70005349)
24+
- [dsPIC33CK256MP508 Family Silicon Errata and Data Sheet Clarification](https://www.microchip.com/80000796)
25+
- [dsPIC33CH512MP508 Family Data Sheet](http://www.microchip.com/70005371)
26+
- [dsPIC33CH512MP508 Family Silicon Errata and Data Sheet Clarification](http://www.microchip.com/80000805)
2427

2528
**Please always check for the latest data sheets on the respective product websites:**
29+
2630
- [dsPIC33CK256MP508 Family](https://www.microchip.com/dsPIC33CK256MP508)
2731
- [dsPIC33CH512MP508 Family](https://www.microchip.com/dsPIC33CH512MP508)
2832

2933
## Software Used
30-
- [MPLAB® X IDE v5.40](https://www.microchip.com/mplabx-ide-windows-installer)
31-
- [MPLAB® XC16 Compiler v1.50](https://www.microchip.com/mplabxc16windows)
32-
- [MPLAB® Code Configurator v4.01](https://www.microchip.com/mplab/mplab-code-configurator)
34+
35+
- [MPLAB® X IDE v6.05](https://www.microchip.com/mplabx)
36+
- [MPLAB® XC16 Compiler v2.00](https://www.microchip.com/xc16)
37+
- [MPLAB® Code Configurator v4.85](https://www.microchip.com/mcc)
3338

3439
## Hardware Used
40+
3541
- Digital Power Development Board, Part-No. [DM330029](https://www.microchip.com/DM330029)
3642
- dsPIC33CK Digital Power Plug-In Module (DP PIM), Part-No. [MA330048](https://www.microchip.com/MA330048)
3743
- Alternatively: dsPIC33CH Digital Power Plug-In Module (DP PIM), Part-No. [MA330049](https://www.microchip.com/MA330049)
3844

3945
## Supported Target Devices
46+
4047
- [dsPIC33CK256MP506](https://www.microchip.com/dsPIC33CK256MP506)
4148
- [dsPIC33CH512MP506](https://www.microchip.com/dsPIC33CH512MP506)
4249
- Code compatible with all Single and Dual Core dsPIC33C MP families of devices
4350

4451
- - -
4552

4653
## Setup
54+
4755
- Plug-In the dsPIC33CK or dsPIC33CH Digital Power Plug In Module into the Digital Power Development Board PIM socket J1
4856
- Open and compile the firmware and program the DSC
4957

5058
<br><center><img src="images/dm330029.jpg" width="400"></center><br>
5159

5260
## Operation
53-
After the device has been programmed and the MCU starts up, a 90 degrees phase shift between the two synchronized PWM Generators is generated see below screen capture. Both PWM Generator #1 and #3 are configured in complementary mode with 200 kHz frequency and 50% duty cycle waveform outputs. PWM Generator 1 output is available at PWM1H/L pins while PWM Generator 3 output is available at PWM3H/L pins.
61+
62+
After the device has been programmed and the MCU starts up, a 90 degrees phase shift between the two synchronized PWM Generators is generated see below screen capture. Both PWM Generator #1 and #3 are configured in complementary mode with 200 kHz frequency and 50% duty cycle waveform outputs. PWM Generator 1 output is available at PWM1H/L pins while PWM Generator 3 output is available at PWM3H/L pins.
5463

5564
<br><center><img src="images/pwm90phaseshift.png" width="400"></center><br>
5665
<br><center>*CH1(blue):PWM1H CH2(green):PWM1L CH3(red):PWM3H CH4(purple):PWM3L*</center><br>
@@ -60,41 +69,42 @@ By pressing the on-board push button *USER* on the Digital Power Development Boa
6069
<br><center><img src="images/pwm180phaseshift.png" width="400"></center><br>
6170
<br><center>*CH1(blue):PWM1H CH2(green):PWM1L CH3(red):PWM3H CH4(purple):PWM3L*</center><br>
6271

63-
6472
Please refer to section *FIRMWARE QUICK-START GUIDE* below for more information on the initialization process and code structure.
6573

6674
<br><center><img src="images/dm330029-pinmap.png" width="600"></center><br>
67-
75+
6876
- - -
6977

7078
## FIRMWARE QUICK-START GUIDE
7179

72-
This code example builds on previous code examples showing how to use Microchip Code Configurator (MCC) to set up device clock domains.
73-
Although MCC also supports configuration tools for the High Resolution PWM module, PWM configuration in this example builds on generic peripheral drivers to help users better understand the peripheral architecture and key aspects of specific configurations and operating modes.
80+
This code example builds on previous code examples showing how to use Microchip Code Configurator (MCC) to set up device clock domains.
81+
Although MCC also supports configuration tools for the High Resolution PWM module, PWM configuration in this example builds on generic peripheral drivers to help users better understand the peripheral architecture and key aspects of specific configurations and operating modes.
7482
In each PWM example code project the PWM configuration procedure is located in the user file pwm.c, where each register bit required to achieve/enable the specific function or mode of interest is set and its function described with comments.
7583
Once users are familiar with the architecture, features and capabilities, both configuration options (generic peripheral library or MCC) may be used.
7684

7785
#### a) Project Directory Structure <br/>
86+
7887
The project contains four sub-directories
88+
7989
1. config: location of all hardware abstraction header files
80-
2. common: location of generic peripheral drivers
90+
2. common: location of generic peripheral drivers
8191
3. MCC Generated Files: all device configuration files auto-generated by MCC
8292
4. root: application user code
8393

84-
On the hard drive, main.c/h are located in the MPLAB X project directory.
85-
All other user files, incl. peripheral drivers, are located in the sub-directory *sources*.
86-
Files generated by MCC are always located in their own sub-directory *mcc_generated-files*
94+
On the hard drive, main.c/h are located in the MPLAB X project directory.
95+
All other user files, incl. peripheral drivers, are located in the sub-directory *sources*.
96+
Files generated by MCC are always located in their own sub-directory *mcc_generated-files*
8797

8898
#### b) Using the generic PWM peripheral driver <br/>
89-
The PWM peripheral driver files p33c_pwm.c/h provide data structures representing the Special Function Register (SFR) sets of PWM generators and the PWM base module. These 'virtual' PWM objects are used to load, read and modify PWM generator configurations without the need for hard-coded instructions, which would make the code hard to migrate from one peripheral to another or even across devices.To simplify PWM configurations, in these examples, each register is reset to a known default state before the user configuration of interest is set. Thus, only the register setting which really matters for a certain features/function are shown.
99+
100+
The PWM peripheral driver files p33c_pwm.c/h provide data structures representing the Special Function Register (SFR) sets of PWM generators and the PWM base module. These 'virtual' PWM objects are used to load, read and modify PWM generator configurations without the need for hard-coded instructions, which would make the code hard to migrate from one peripheral to another or even across devices. To simplify PWM configurations, in these examples, each register is reset to a known default state before the user configuration of interest is set. Thus, only the register setting which really matters for a certain features/function are shown.
90101

91102
To learn more about the generic PWM driver, its supported features and intended use cases, please read the comments inside p33c_pwm.c.
92103

93104
#### c) Executing the Code Example <br/>
94-
This code has been written to automatically start up and perform the function of interest. Please read the demo instructions on top of file main.c to learn more about the code example, test points, expected signals and demo mode operation.
95-
96105

106+
This code has been written to automatically start up and perform the function of interest. Please read the demo instructions on top of file main.c to learn more about the code example, test points, expected signals and demo mode operation.
97107

98108
- - -
99109

100-
© 2020, Microchip Technology Inc.
110+
&copy; 2023, Microchip Technology Inc.

changelog.md

+29-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,38 @@
1+
# dspic33ck-power-pwm-phase-shift, release v1.1.0
2+
3+
### Release Highlights
4+
5+
Version 1.1.0 of this code example is a maintenance cycle release, which is required to keep the source code provided being fully supported by the most recent development tool chain. In this release no functional changes have been made in comparison with the previous version.
6+
7+
### Toolchain Updates
8+
9+
* Changed minimum MPLAB X IDE version to 6.05 and later - [Get latest Version](https://www.microchip.com/mplabx)
10+
* Changed minimum XC16 compiler version to v2.00 - [Get latest Version](https://www.microchip.com/xc16)
11+
* Changed minimum Device File Pack (DFP) version to 1.10.341
12+
* Microchip Code Configurator Update
13+
* Updated MCC Plug-In version to require v5.3.7 or later
14+
* Updated mc3 file contents to work with core version 4.85.1 or later
15+
16+
### Features Added\Updated
17+
18+
* Updated gitignore file filtering clutter of MPLAB X IDE 6.05 and later
19+
* Fixed typos in leading comment of main.c
20+
* Removed interrupt register bits, which are not supported by DFP versions v1.5.135 and later
21+
* Removed obsolete virtual folder from MPLAB X project explorer
22+
* Changed label of PWM Module register set from P33C_PWM_SFRSET_t to P33C_PWM_MODULE_t
23+
24+
&copy; 2023, Microchip Technology Inc.
25+
26+
---
27+
128
# dspic33ck-power-pwm-phase-shift, release v1.0.0
229

330
### Release Highlights
31+
432
This is the initial release demonstrating the basic configuration of a high-resolution PWM generator of the dsPIC33C family of devices.
533
This example is part of a series of code examples highlighting specific operating modes and features.
634

735
### Features Added\Updated
36+
837
In this intial version the on-board LED of the dsPIC33CK Digital Power Plug-In Module is toggled with a interval üperiod of 300 ms, when the controller is running at maximum speed of 100 MIPS.
938
After startup, 90 degrees phase shift will be generated between pwm generator #1 and pwm generator #3. By pressing the on-board push button *USER* on the Digital Power Develpoment Board, the phase shift is toggled between the initial 90 degrees and 180 degrees.
10-
11-

dspic33ck-power-pwm-phase-shift.X/device_setup.mc3

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<config configVersion="1.1" device="dsPIC33CK256MP506" coreVersion="4.85.0">
1+
<config configVersion="1.1" device="dsPIC33CK256MP506" coreVersion="4.85.1">
22
<usedClasses class="java.util.HashMap">
33
<entry>
44
<string>System Module</string>
@@ -12,14 +12,14 @@
1212
<string>INTERNAL OSCILLATOR</string>
1313
<string>class com.microchip.mcc.mcu16.systemManager.clk.Clock</string>
1414
</entry>
15-
<entry>
16-
<string>Pin Module</string>
17-
<string>class com.microchip.mcc.mcu16.pinManager.PinManager</string>
18-
</entry>
1915
<entry>
2016
<string>WATCHDOG</string>
2117
<string>class com.microchip.mcc.mcu16.systemManager.wdt.Wdt</string>
2218
</entry>
19+
<entry>
20+
<string>Pin Module</string>
21+
<string>class com.microchip.mcc.mcu16.pinManager.PinManager</string>
22+
</entry>
2323
<entry>
2424
<string>DMT</string>
2525
<string>class com.microchip.mcc.mcu16.systemManager.dmt.DMT</string>
@@ -13953,7 +13953,7 @@
1395313953
</entry>
1395413954
<entry>
1395513955
<file>mcc_generated_files\mcc.h</file>
13956-
<hash>da11287b3388692edf3d6f8bc0480caf872dee4057749d4c81df8faf03235ba1</hash>
13956+
<hash>829614197b747f6c720bd3301562e684ad254d6f74417c788fa916d1167995f1</hash>
1395713957
</entry>
1395813958
<entry>
1395913959
<file>mcc_generated_files\reset.c</file>
@@ -13983,14 +13983,14 @@
1398313983
<file>mcc_generated_files\system_types.h</file>
1398413984
<hash>5a950eea332589ea6dc66ce9c8aaf27ccaaf2623159a9deaed042055e43c9477</hash>
1398513985
</entry>
13986-
<entry>
13987-
<file>mcc_generated_files\pin_manager.c</file>
13988-
<hash>7a64d50b1ff548dc0574f61ded05cb96c27256f7cee6a36fde3b11589b3d9b19</hash>
13989-
</entry>
1399013986
<entry>
1399113987
<file>mcc_generated_files\system.h</file>
1399213988
<hash>0060fe1fb7298b89c45e013f472a9f4b996184788e2fd4462bf321204ae5163c</hash>
1399313989
</entry>
13990+
<entry>
13991+
<file>mcc_generated_files\pin_manager.c</file>
13992+
<hash>7a64d50b1ff548dc0574f61ded05cb96c27256f7cee6a36fde3b11589b3d9b19</hash>
13993+
</entry>
1399413994
<entry>
1399513995
<file>mcc_generated_files\system.c</file>
1399613996
<hash>6786bb8f8ac98a175fa85d7b2389824ac0c37afac965497d53c174820cd29422</hash>

dspic33ck-power-pwm-phase-shift.X/main.c

+4-3
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,13 @@
5454
*
5555
* Description:
5656
*
57-
* This code example shows the basic configuration of two sychronized, phase shifted
57+
* This code example shows the basic configuration of two synchronized, phase shifted
5858
* PWM generator channels. The initial phase shift between PWM generator
5959
* channel 1 and 3 after startup is set to 90 degrees.By pressing push button [USER],
60-
* the phase shift is stepped to 180 degrees. Bypressing [USER] again, the phase shift
60+
* the phase shift is stepped to 180 degrees. By pressing [USER] again, the phase shift
6161
* switches back to 90 degrees.Both channels are configured in complementary output mode.
62-
* The frequency and duty ratio of two PWM channels will always remain to 200Khz and 50% respectively
62+
* The frequency and duty ratio of two PWM channels will always remain to 200 kHz and
63+
* 50% respectively
6364
*
6465
* Please note:
6566
* This code example can be run on dsPIC33CK as well as on dsPIC33CH

dspic33ck-power-pwm-phase-shift.X/mcc_generated_files/mcc.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@
5353
#include "system_types.h"
5454
#include "reset.h"
5555

56-
#include "reset.h"
5756
#include "tmr1.h"
57+
#include "reset.h"
5858
#include "interrupt_manager.h"
5959
#include "traps.h"
6060
#include "watchdog.h"

0 commit comments

Comments
 (0)