Skip to content

Commit 920540a

Browse files
MCHP-Carlareiter128
authored andcommitted
Pull request #20: Code Maintenance Release v1.1.0
Merge in MCU16CE/dspic33ck-power-pwm-complementary from develop to master * commit 'f82537a66f0b9b8ddadc723ceb194b5d6191fa76': * Updated deployment files of this code example * Fixed typos in head comment of file main.c * Updated changelog file reflecting changes in version 1.1.0 * Updated tool chain versions, data sheet links and copyright date in README file * Switched XC16 C-Compilter version to v2.00 * Switched Device File Pack version to v1.10.341 * Set compiler code optimization to level #1 * Regenerated content using MCC Plug-In version 5.3.7 * Removed interrupt register bits not supported anymore by DFP versions 1.5 and later Updated gitignore file to filter new clutter generated by MPLAB X IDE 6.05 and later Fixed pipeline issue
2 parents bb3774b + f82537a commit 920540a

File tree

12 files changed

+868
-292
lines changed

12 files changed

+868
-292
lines changed

.citd/Jenkinsfilek8s

Lines changed: 208 additions & 195 deletions
Large diffs are not rendered by default.

.citd/cloudprovider.yml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,26 @@ metadata:
55
spec:
66
containers:
77
- name: xc16-mplabx-sonar-fmpp-python
8-
image: artifacts.microchip.com:7999/microchip/citd/bundles/xc16-mplabx-sonar-fmpp-python-yarn-node:1.50-5.40-4.2-0.9.16-3.x-1.17.3-12.x
8+
image: artifacts.microchip.com:7999/microchip/citd/bundles/xc16-mplabx-sonar-fmpp-python-yarn-node:latest
99
imagePullPolicy: Always
1010
command: ['cat']
1111
tty: true
1212
resources:
1313
requests:
14-
cpu: 1
15-
memory: 1Gi
14+
cpu: 500m
15+
memory: 1500Mi
1616
limits:
17-
cpu: 2
17+
cpu: 1
1818
memory: 2Gi
19+
- name: buildtools
20+
image: artifacts.microchip.com:7999/microchip/buildtools/doxygen:1.8.15-r0
21+
imagePullPolicy: Always
22+
command: ['cat']
23+
tty: true
24+
resources:
25+
requests:
26+
cpu: 500m
27+
memory: 750Mi
28+
limits:
29+
cpu: 1
30+
memory: 1Gi

.gitignore

Lines changed: 45 additions & 8 deletions
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

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,23 @@
22
"metaDataVersion": "1.0.0",
33
"category": "com.microchip.ide.project",
44
"content": {
5-
"metaDataVersion": "1.0.0",
5+
"metaDataVersion": "1.3.0",
66
"name": "com.microchip.mplabx.project.dspic33ck-power-pwm-complementary",
7-
"version": "1.0.0",
7+
"version": "1.1.0",
88
"displayName": "dsPIC33CK/CH-MP PWM Configuration: Complementary PWM Output",
99
"projectName": "dspic33ck-power-pwm-complementary",
1010
"shortDescription": "Complementary 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
"device": {
2424
"metaDataVersion": "1.0.0",
@@ -30,11 +30,6 @@
3030
"versionRange": "*"
3131
}
3232
},
33-
"peripherals": [
34-
"GPIO",
35-
"PWM",
36-
"Timer"
37-
],
3833
"keywords": [
3934
"dsc",
4035
"dspic",

README.md

Lines changed: 43 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
![image](images/microchip.png)
1+
![image](images/microchip.png)
22

33
# dsPIC33C High-Resolution PWM Configuration I
4+
45
**Complementary PWM Waveform Generation**
56

67
<p><center><a target="_blank" href="https://www.microchip.com/MA330048" rel="nofollow">
@@ -9,94 +10,106 @@
910
- - -
1011

1112
## Summary
12-
Learning how to use the High Resolution PWM Module of dsPIC33C MP devices
1313

14-
Lab 1: Complementary Waveform Generation
14+
Learn how to use the High Resolution PWM Module of dsPIC33C MP devices
15+
16+
**Lab 1: Complementary Waveform Generation**
1517
Code example for dsPIC33CK and dsPIC33CH devices introducing the basic configuration of the high-resolution PWM module using one PWM generator channel generating a single, complementary PWM waveform
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+
23+
- [dsPIC33CK256MP508 Family Data Sheet](https://www.microchip.com/DS70005349)
24+
- [dsPIC33CK256MP508 Family Silicon Errata and Data Sheet Clarification](https://www.microchip.com/80000796)
2225

2326
Alternative Controller Plug-In Module:
24-
- [dsPIC33CH512MP508 Family Data Sheet](http://ww1.microchip.com/downloads/en/DeviceDoc/dsPIC33CH512MP508-Family-Data-Sheet-DS70005371D.pdf)
25-
- [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)
27+
28+
- [dsPIC33CH512MP508 Family Data Sheet](http://www.microchip.com/70005371)
29+
- [dsPIC33CH512MP508 Family Silicon Errata and Data Sheet Clarification](http://www.microchip.com/80000805)
2630

2731
**Please always check for the latest data sheets on the respective product websites:**
32+
2833
- [dsPIC33CK256MP508 Family](https://www.microchip.com/dsPIC33CK256MP508)
2934
- [dsPIC33CH512MP508 Family](https://www.microchip.com/dsPIC33CH512MP508)
3035

31-
## Software Used
32-
- [MPLAB® X IDE v5.40](https://www.microchip.com/mplabx-ide-windows-installer)
33-
- [MPLAB XC16 Compiler v1.50](https://www.microchip.com/mplabxc16windows)
34-
- [Microchip Code Configurator v3.95](https://www.microchip.com/mplab/mplab-code-configurator)
36+
## Software Used
37+
38+
- [MPLAB&reg; X IDE v6.05](https://www.microchip.com/mplabx)
39+
- [MPLAB&reg; XC16 Compiler v2.00](https://www.microchip.com/xc16)
40+
- [MPLAB&reg; Code Configurator v4.85](https://www.microchip.com/mcc)
3541

3642
## Hardware Used
43+
3744
- Digital Power Development Board, Part-No. [DM330029](https://www.microchip.com/DM330029)
3845
- dsPIC33CK Digital Power Plug-In Module (DP PIM), Part-No. [MA330048](https://www.microchip.com/MA330048)
3946
- Alternatively: dsPIC33CH Digital Power Plug-In Module (DP PIM), Part-No. [MA330049](https://www.microchip.com/MA330049)
4047

4148
## Supported Target Devices
49+
4250
- [dsPIC33CK256MP506](https://www.microchip.com/dsPIC33CK256MP506)
4351
- [dsPIC33CH512MP506](https://www.microchip.com/dsPIC33CH512MP506)
4452
- Code compatible with all Single and Dual Core dsPIC33C MP families of devices
4553

4654
- - -
4755

4856
## Setup
57+
4958
- Plug-In the dsPIC33CK Digital Power Plug In Module into the Digital Power Development Board PIM socket J1
5059
- Open and compile the firmware and program the DSC
5160

52-
<br><center><img src="images/dm330029.jpg" width="400"></center>
61+
<p><center><img src="images/dm330029.jpg" width="500"></center></p>
5362

5463
## Operation
64+
5565
After the device has been programmed and the MCU starts up, PWM generator #3 is generating a 200 kHz complementary waveform at the PWM3H/PWM3L outputs.
5666

57-
<br><center><img src="images/pwm200kHz.png" width="400"></center><br>
67+
<p><center><img src="images/pwm200kHz.png" width="500"></center></p>
5868
*200 kHz Switching Frequency Output*
5969

6070
By pressing the on-board push button *USER* on the Digital Power Development Board, the switching frequency is toggled between the initial 200 kHz and 1 MHz.
61-
<br><center><img src="images/pwm1MHz.png" width="400"></center><br>
71+
<p><center><img src="images/pwm1MHz.png" width="500"></center></p>
6272
*1 MHz Switching Frequency Output*
6373

64-
6574
Please refer to section *FIRMWARE QUICK-START GUIDE* below for more information on the initialization process and code structure.
6675

67-
<br><center><img src="images/dm330029-pinmap.png" width="800"></center><br>
68-
76+
<p><center><img src="images/dm330029-pinmap.png" width="800"></center></p>
77+
6978
- - -
7079

7180
## FIRMWARE QUICK-START GUIDE
7281

73-
This code example builds on previous code examples showing how to use Microchip Code Configurator (MCC) to set up device clock domains.
74-
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.
82+
This code example builds on previous code examples showing how to use Microchip Code Configurator (MCC) to set up device clock domains.
83+
84+
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.
85+
7586
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.
7687
Once users are familiar with the architecture, features and capabilities, both configuration options (generic peripheral library or MCC) may be used.
7788

78-
*a) Project Directory Structure*
89+
### a) Project Directory Structure
90+
7991
The project contains two sub-directories
92+
8093
- config: location of all hardware abstraction header files
81-
- drivers: location of generic peripheral drivers
94+
- drivers: location of generic peripheral drivers
8295
- MCC Generated Files: all device configuration files auto-generated by MCC
8396
- root: application user code
8497

85-
On the hard drive, main.c/h are located in the MPLAB X project directory.
86-
All other user files, incl. peripheral drivers, are located in the sub-directory *sources*.
87-
Files generated by MCC are always located in their own sub-directory *mcc_generated-files*
98+
On the hard drive, main.c/h are located in the MPLAB&reg; X project directory.
99+
All other user files, incl. peripheral drivers, are located in the sub-directory *sources*.
100+
Files generated by MCC are always located in their own sub-directory *mcc_generated-files*
101+
102+
### b) Using the generic PWM peripheral driver
88103

89-
*b) Using the generic PWM peripheral driver*
90104
The PWM peripheral driver files p33c_pwm.c/h provide data structures representing the Special Function Register (SFR) sets of PWM generators and the PAM base module. These 'virtual' PWM objects are used to load, read and modify PWM generator configurations without the need to hard-coded instructions, which would make the code hard to migrate from one peripheral to another or even across devices.
91105
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 matter for a certain features/function are shown.
92106

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

95-
*c) Executing the Code Example*
96-
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.
97-
109+
### c) Executing the Code Example
98110

111+
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.
99112

100-
- - -
113+
- - -
101114

102-
© 2020, Microchip Technology Inc.
115+
&copy; 2023, Microchip Technology Inc.

changelog.md

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,38 @@
1+
# dspic33ck-power-pwm-complementary, 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 empty virtual folder 'config' from section Sources in 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-complementary, 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 initial 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, PWM generator #3 is generating a 200 kHz complementary waveform at the PWM3H/PWM3L outputs. By pressing the on-board push button *USER* on the Digital Power Development Board, the switching frequency is toggled between the initial 200 kHz and 1 MHz.
10-
11-

dspic33ck-power-pwm-complementary.X/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
* is added (100ns at rising edge of PWMxH and 150ns at falling edge of
6161
* PWMxH). The initial frequency after startup is set to 200 kHz. By
6262
* pressing push button [USER], the frequency is stepped to 1 MHz. By
63-
* pressing [USER] again, the frequency switches back to 200 khz,
63+
* pressing [USER] again, the frequency switches back to 200 kHz,
6464
* The duty ratio will always remain 25% of the switching period.
6565
*
6666
* Please note:

dspic33ck-power-pwm-complementary.X/mcc_generated_files/mcc.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@
5353
#include "system_types.h"
5454
#include "reset.h"
5555

56-
#include "reset.h"
56+
#include "watchdog.h"
5757
#include "tmr1.h"
58+
#include "reset.h"
5859
#include "interrupt_manager.h"
5960
#include "traps.h"
60-
#include "watchdog.h"
6161

6262
#warning "This file will be removed in future MCC releases. Use system.h instead."
6363

dspic33ck-power-pwm-complementary.X/mcc_generated_files/system.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@
131131
void SYSTEM_Initialize(void)
132132
{
133133
PIN_MANAGER_Initialize();
134-
INTERRUPT_Initialize();
135134
CLOCK_Initialize();
135+
INTERRUPT_Initialize();
136136
TMR1_Initialize();
137137
INTERRUPT_GlobalEnable();
138138
SYSTEM_CORCONModeOperatingSet(CORCON_MODE_PORVALUES);

dspic33ck-power-pwm-complementary.X/mcc_generated_files/traps.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -136,18 +136,6 @@ void ERROR_HANDLER _SoftTrapError(void)
136136
TRAPS_halt_on_error(TRAPS_NVM_ERR);
137137
}
138138

139-
if(INTCON3bits.DMT)
140-
{
141-
INTCON3bits.DMT = 0; //Clear the trap flag
142-
TRAPS_halt_on_error(TRAPS_DMT_ERR);
143-
}
144-
145-
if(INTCON3bits.DAE)
146-
{
147-
INTCON3bits.DAE = 0; //Clear the trap flag
148-
TRAPS_halt_on_error(TRAPS_DAE_ERR);
149-
}
150-
151139
if(INTCON3bits.DOOVR)
152140
{
153141
INTCON3bits.DOOVR = 0; //Clear the trap flag

0 commit comments

Comments
 (0)