Skip to content

Commit 52dbd94

Browse files
committed
Merge pull request #3 in MCU16CE/pic24f-lcd-usb-curiosity-lcd-power from develop to master
* commit 'fce61fd151025b300eb0c7518538da4ae834c935': Updated the board image and board link removed additionalData from main.json Call to SYSTEM_Initialize blowing away RTCC time. Call needed to initialize the SPI and associated pins so the TC77 can shutdown properly. fixing issue if starting in battery mode. Microchip and BoE not printed. USB mode working. Updated code Project updated Removed BSL entry from MC3 file Removed unwanted pin configurations Updated the project using MCC Generated files Addressed review comments Repo setup pic24f-lcd-usb-curiosity-lcd-power repository initial setup
2 parents 627a3f9 + fce61fd commit 52dbd94

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+45410
-0
lines changed

.citd/Jenkinsfilek8s

Lines changed: 262 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,262 @@
1+
pipeline {
2+
agent {
3+
kubernetes {
4+
label 'github_deployment'
5+
defaultContainer 'xc16-mplabx-sonar-fmpp-python'
6+
yamlFile '.citd/cloudprovider.yml'
7+
}
8+
}
9+
10+
11+
environment {
12+
NOTIFICATION_EMAIL = '[email protected]'
13+
//Branch to be deployed, if multiple branches use comma separated string
14+
//This is the BitBucket source repo URL to be deployed
15+
BITBUCKET_SOURCE_URL = 'https://bitbucket.microchip.com/scm/mcu16ce/pic24f-lcd-usb-curiosity-lcd-power.git'
16+
BITBUCKET_CREDENTIAL_ID = 'BITBUCKET_INTERNAL_TOKEN'
17+
GITHUB_PRODUCTION_DEPLOY_URL ='https://github.com/microchip-pic-avr-examples'
18+
GITHUB_TEST_DEPLOY_URL ='https://github.com/mchpTestArea'
19+
//Selects the deployment URL(production or test) based on the merge target branch, selects "microchip-pic-avr-examples" if target branch is "master" , if target branch is "test_deploy" selects "mchpTestArea" else null
20+
GITHUB_URL = getGitHubUrl("${GITHUB_PRODUCTION_DEPLOY_URL}","${GITHUB_TEST_DEPLOY_URL}")
21+
GITHUB_PRODUCTION_DEPLOY_CREDENTIAL_ID ='GITHUB_MICROCHIP_PIC_AVR_EXAMPLES_TOKEN'
22+
GITHUB_TEST_DEPLOY_CREDENTIAL_ID ='GITHUB_PIC_AVR_TEST_TOKEN'
23+
//Gets the Github credential id based on the deployment organization
24+
GITHUB_CREDENTIAL_ID = getGitHubCredentialId("${GITHUB_URL}","${GITHUB_PRODUCTION_DEPLOY_URL}","${GITHUB_TEST_DEPLOY_URL}","${GITHUB_PRODUCTION_DEPLOY_CREDENTIAL_ID}","${GITHUB_TEST_DEPLOY_CREDENTIAL_ID}")
25+
//Files or folders to be excluded from deployment, if multiple files or folders use comma separator
26+
DEPLOY_EXCLUDE_FOLDER_FILE_LIST = 'mchp_private'
27+
//Branch(s) to be deployed, if multiple branches use comma separator. ${env.BRANCH_NAME} is the target branch of the PR.
28+
DEPLOY_BRANCH_LIST = "${env.BRANCH_NAME}"
29+
CHANGE_LOG_PATH = 'changelog.md'
30+
SOURCE_PROJECT_META_DATA = '.main-meta/main.json'
31+
DEPLOY_TOOL_URL = 'https://bitbucket.microchip.com/scm/citd/tool-github-deploy.git'
32+
}
33+
34+
options {
35+
timestamps()
36+
timeout(time: 20, unit: 'MINUTES')
37+
}
38+
39+
stages {
40+
41+
stage('Checkout') {
42+
steps {
43+
checkout scm
44+
}
45+
}
46+
47+
stage('Build') {
48+
steps {
49+
script {
50+
execute("git clone https://bitbucket.microchip.com/scm/citd/tool-mplabx-c-build.git")
51+
execute("cd ./tool-mplabx-c-build && node buildLauncher.js sp=../ rp=./output genMK=true")
52+
}
53+
}
54+
}
55+
56+
// Cloning the tool used for GitHub deployment
57+
stage('GitHub tool clone'){
58+
when {
59+
anyOf {
60+
allOf {
61+
not { changeRequest() }
62+
anyOf {branch 'master'; branch 'test_deploy';}
63+
}
64+
}
65+
}
66+
steps{
67+
script{
68+
execute("git clone https://bitbucket.microchip.com/scm/citd/tool-github-deploy.git")
69+
execute("chmod +x ./tool-github-deploy/tool-github-deploy/tool-github-deploy.py")
70+
}
71+
}
72+
}
73+
74+
// Creating tag in Bitbucket repo
75+
stage('Bitbucket Tag Creation'){
76+
when {
77+
anyOf {
78+
allOf {
79+
not { changeRequest() }
80+
anyOf {branch 'master';}
81+
}
82+
}
83+
}
84+
steps{
85+
script{
86+
def jsonObj = readJsonObject();
87+
88+
withCredentials([usernamePassword(credentialsId: "${env.BITBUCKET_CREDENTIAL_ID}", passwordVariable: 'PASS', usernameVariable: 'USER_NAME')]) {
89+
execute("python tool-github-deploy/tool-github-deploy/tool-github-deploy.py -bto=true -rpn=\"${jsonObj.content.projectName}\" -bid=$USER_NAME -bpat=$PASS -bpn=MCU16CE -btv=\"${jsonObj.content.version}\" -bch=${env.GIT_COMMIT} -btd=\"${jsonObj.content.version}\"")
90+
}
91+
}
92+
}
93+
}
94+
95+
// GitHub repo creation
96+
stage('GitHub Repo Creation'){
97+
when {
98+
anyOf {
99+
allOf {
100+
not { changeRequest() }
101+
anyOf {branch 'master'; branch 'test_deploy';}
102+
}
103+
}
104+
}
105+
steps{
106+
script{
107+
def jsonObj = readJsonObject();
108+
109+
String [] topics = jsonObj.content.keywords
110+
def asString = topics.join(", ")
111+
Boolean visibility = true
112+
if(env.GITHUB_URL == env.GITHUB_PRODUCTION_DEPLOY_URL)
113+
{
114+
visibility = false
115+
}
116+
117+
withCredentials([usernamePassword(credentialsId: "${env.GITHUB_CREDENTIAL_ID}", passwordVariable: 'PASS', usernameVariable: 'USER_NAME')]) {
118+
execute("python tool-github-deploy/tool-github-deploy/tool-github-deploy.py -rpo=true -gpat=$PASS -rporg=${env.GITHUB_URL} -rpn=${jsonObj.content.projectName} -rpd=\"${jsonObj.content.shortDescription}\" -rpt=\"${asString}\" -rpp=${visibility}")
119+
}
120+
}
121+
}
122+
}
123+
124+
// Deploying the code to GitHub
125+
stage('GitHub Deploy Source'){
126+
when {
127+
anyOf {
128+
allOf {
129+
not { changeRequest() }
130+
anyOf {branch 'master'; branch 'test_deploy';}
131+
}
132+
}
133+
}
134+
steps{
135+
script{
136+
def jsonObj = readJsonObject();
137+
def gitHubUrl = "${env.GITHUB_URL}" + "/" + jsonObj.content.projectName
138+
gitHubUrl = gitHubUrl.replace(" ", "").replace("\n", "")
139+
140+
withCredentials([usernamePassword(credentialsId: "${env.GITHUB_CREDENTIAL_ID}", passwordVariable: 'PASS', usernameVariable: 'USER_NAME')]) {
141+
execute("python tool-github-deploy/tool-github-deploy/tool-github-deploy.py -deploy=true -gpat=$PASS -dgid=$USER_NAME -dburl=${env.BITBUCKET_SOURCE_URL} -dgurl=${gitHubUrl} -dbranch=${env.DEPLOY_BRANCH_LIST} -def=${env.DEPLOY_EXCLUDE_FOLDER_FILE_LIST}")
142+
}
143+
}
144+
}
145+
}
146+
147+
// Creating GitHub release
148+
stage('GitHub release'){
149+
when {
150+
anyOf {
151+
allOf {
152+
not { changeRequest() }
153+
anyOf {branch 'master'; branch 'test_deploy';}
154+
}
155+
}
156+
}
157+
steps{
158+
script{
159+
def jsonObj = readJsonObject();
160+
161+
withCredentials([usernamePassword(credentialsId: "${env.GITHUB_CREDENTIAL_ID}", passwordVariable: 'PASS', usernameVariable: 'USER_NAME')]) {
162+
execute("python tool-github-deploy/tool-github-deploy/tool-github-deploy.py -rlo=true -gpat=$PASS -rporg=${env.GITHUB_URL} -rpn=\"${jsonObj.content.projectName}\" -rltv=\"${jsonObj.content.version}\" -rltt=\"${jsonObj.content.version}\" -rlnp=${env.CHANGE_LOG_PATH}")
163+
}
164+
}
165+
}
166+
}
167+
168+
//Deploying the Github content to portal
169+
stage('Portal-Deploy') {
170+
when {
171+
allOf {
172+
not { changeRequest() }
173+
anyOf {branch 'master';}
174+
}
175+
}
176+
steps {
177+
script {
178+
def jsonObj = readJsonObject();
179+
def version = jsonObj.content.version
180+
def project = jsonObj.content.projectName
181+
182+
String[] splitPreTag = "${env.GITHUB_URL}".split("/")
183+
def gitHubOrg = (splitPreTag[splitPreTag.size() - 1])
184+
185+
def cmdArgs = "'{\"repoOwnerName\":\"$gitHubOrg\",\"repoName\":\"$project\",\"tagName\":\"$version\"}'"
186+
cmdArgs = cmdArgs.replaceAll("\"","\\\\\"")
187+
188+
execute("git clone https://bitbucket.microchip.com/scm/portal/bundles.git")
189+
execute("cd bundles && chmod 755 ./portal-client-cli-linux")
190+
execute("git clone https://bitbucket.microchip.com/scm/citd/tool-portal-client-launcher.git")
191+
execute("cd tool-portal-client-launcher && node portalLauncher.js -app=../bundles/portal-client-cli-linux -cmd=\"uploadGitHub ${cmdArgs}\"")
192+
}
193+
}
194+
}
195+
196+
}
197+
198+
post {
199+
success{
200+
script {
201+
if (!"${env.CHANGE_AUTHOR_EMAIL}".equalsIgnoreCase("null")) {
202+
archiveArtifacts artifacts: "tool-mplabx-c-build/output/**", fingerprint: true
203+
mail to: "${env.CHANGE_AUTHOR_EMAIL}, ${env.NOTIFICATION_EMAIL}",
204+
subject: "Successful Pipeline: ${currentBuild.fullDisplayName}",
205+
body: "Something is right with ${env.BUILD_URL}"
206+
} else {
207+
archiveArtifacts artifacts: "tool-mplabx-c-build/output/**", fingerprint: true
208+
mail to: "${env.NOTIFICATION_EMAIL}",
209+
subject: "Successful Pipeline: ${currentBuild.fullDisplayName}",
210+
body: "Something is right with ${env.BUILD_URL}"
211+
}
212+
}
213+
}
214+
failure {
215+
script {
216+
if (!"${env.CHANGE_AUTHOR_EMAIL}".equalsIgnoreCase("null")) {
217+
archiveArtifacts artifacts: "tool-mplabx-c-build/output/**", fingerprint: true
218+
mail to: "${env.CHANGE_AUTHOR_EMAIL}, ${env.NOTIFICATION_EMAIL}",
219+
subject: "Failed Pipeline: ${currentBuild.fullDisplayName}",
220+
body: "Pipeline failure. ${env.BUILD_URL}"
221+
} else {
222+
archiveArtifacts artifacts: "tool-mplabx-c-build/output/**", fingerprint: true
223+
mail to: "${env.NOTIFICATION_EMAIL}",
224+
subject: "Failed Pipeline: ${currentBuild.fullDisplayName}",
225+
body: "Pipeline failure. ${env.BUILD_URL}"
226+
}
227+
}
228+
}
229+
}
230+
}
231+
232+
def execute(String command) {
233+
if (isUnix()) {
234+
sh command
235+
} else {
236+
bat command
237+
}
238+
}
239+
240+
String readJsonObject() {
241+
def jsonObj = readJSON interpolate: true, file: "${env.SOURCE_PROJECT_META_DATA}"
242+
return jsonObj
243+
}
244+
def getGitHubUrl(String productionUrl, String testDeployUrl) {
245+
String branchName = "${env.BRANCH_NAME}";
246+
if(branchName == 'master') {
247+
return productionUrl;
248+
} else if(branchName == 'test_deploy') {
249+
return testDeployUrl;
250+
} else {
251+
return null
252+
}
253+
}
254+
def getGitHubCredentialId(String deployUrl, String productionDeployUrl, String testDeployUrl, String githubProductionDeployCredential, String githubTestDeployCredential) {
255+
if(deployUrl == productionDeployUrl) {
256+
return githubProductionDeployCredential;
257+
} else if(deployUrl == testDeployUrl) {
258+
return githubTestDeployCredential;
259+
} else {
260+
return null
261+
}
262+
}

.citd/cloudprovider.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
apiVersion: v1
2+
kind: Pod
3+
metadata:
4+
name: xc16-mplabx-sonar-fmpp-python
5+
spec:
6+
containers:
7+
- 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
9+
imagePullPolicy: Always
10+
command: ['cat']
11+
tty: true
12+
resources:
13+
requests:
14+
cpu: 1
15+
memory: 1Gi
16+
limits:
17+
cpu: 2
18+
memory: 2Gi

.main-meta/main.json

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"metaDataVersion":"1.0.0",
3+
"category":"com.microchip.ide.project",
4+
"content":{
5+
"metaDataVersion":"1.0.0",
6+
"name":"com.microchip.mplabx.project.pic24f-lcd-usb-curiosity-lcd-power",
7+
"version":"1.0.0",
8+
"displayName":"PIC24F LCD USB Curiosity Development Board LCD and Power Demo",
9+
"projectName":"pic24f-lcd-usb-curiosity-lcd-power",
10+
"shortDescription":"This is the LCD and Power demo software which runs on PIC24F LCD USB Curiosity Development Board.",
11+
"ide":{
12+
"name":"MPLABX",
13+
"semverRange":">=5.40.0"
14+
},
15+
"compiler":{
16+
"name":"XC16",
17+
"semverRange":"^1.50.0"
18+
},
19+
"dfp":{
20+
"name":"PIC24F_GL_GU_DFP",
21+
"semverRange":"^1.3.38"
22+
},
23+
"configurator": {
24+
"name": "MCC",
25+
"semverRange": ">=4.0.1"
26+
},
27+
"device":{
28+
"metaDataVersion":"1.0.0",
29+
"category":"com.microchip.portal.contentRef",
30+
"content":{
31+
"metaDataVersion":"1.0.0",
32+
"category":"com.microchip.device",
33+
"name":"PIC24FJ512GU410",
34+
"versionRange":"*"
35+
}
36+
},
37+
"peripherals":[
38+
"SPI",
39+
"LCD",
40+
"USB"
41+
],
42+
"keywords":[
43+
"PIC24F",
44+
"Segmented LCD",
45+
"LCD",
46+
"USB"
47+
]
48+
}
49+
}

LICENSE.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
© [2020] Microchip Technology Inc. and its subsidiaries
2+
3+
Subject to your compliance with these terms, you may use this Microchip software and any derivatives exclusively with Microchip products. You are responsible
4+
for complying with third party license terms applicable to your use of third party software (including open source software) that may accompany this Microchip
5+
software. SOFTWARE IS “AS IS.” NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT,
6+
MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, INCIDENTAL OR CONSEQUENTIAL LOSS,
7+
DAMAGE, COST OR EXPENSE OF ANY KIND WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE
8+
FORESEEABLE. TO THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP’S TOTAL LIABILITY ON ALL CLAIMS RELATED TO THE SOFTWARE WILL NOT EXCEED AMOUNT OF FEES, IF ANY, YOU
9+
PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.

README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
![image](images/microchip.jpg)
2+
3+
# PIC24F LCD USB Curiosity Development Board LCD and Power Demo.
4+
5+
## Summary
6+
7+
This is the demo software which runs on PIC24F LCD USB Curiosity Development Board (DM240018). The PIC24F LCD USB Curiosity Development Board is a cost-effective, fully integrated development platform targeted at first-time users, Makers, and those seeking a feature-rich rapid prototyping board. Refer to https://www.microchip.com/pic24flcdusbcuriosity for additional details about the board.
8+
9+
10+
## Related Documentation
11+
12+
- PIC24F GU/GL Low Power MCUs: https://www.microchip.com/PIC24F-GU-GL
13+
- PIC24FJ512GU410 microcontroller https://www.microchip.com/PIC24FJ512GU410
14+
15+
16+
## Hardware Used
17+
18+
- PIC24F LCD USB Curiosity Development Board (https://www.microchip.com/pic24flcdusbcuriosity)
19+
20+
## Software Used
21+
22+
- MPLAB® X IDE v5.40 or newer (https://www.microchip.com/mplabx)
23+
- MPLAB® XC16 v1.50 or newer (https://www.microchip.com/xc)
24+
- MPLAB® Code Configurator v4.0.1 (https://www.microchip.com/mplab/mcc)
25+
26+
27+
## Operation
28+
29+
This example has two main modes of operation
30+
1. USB powered mode
31+
2. Battery powered mode.
32+
33+
## USB Powered Mode
34+
35+
The display just toggles between the text "PIC24" and "LCD". This toggling is done automatically by the LCD module using the alternate display mode of the module. The core sets up the LCD module with the "PIC24" text in the main display memory and the "LCD" text in the alternate display memory and the LCD automatically toggles between the two texts.
36+
37+
38+
## Battery Powered Mode
39+
40+
If the USB power is disconnected, the board can run from a battery backup and will go into battery powered mode. In order to run in battery mode a CR2032 needs to be inserted in the B1 battery housing and jumper J9 needs a short between pins 2 and 3.
41+
42+
In battery powered mode the moon icon is displayed to indicate that it is in battery mode. The battery status icon indicates the current battery status.
43+
44+
The time will be displayed on the screen in this mode. The ":" blinks using the LCD modules blink feature. The CPU does not need to wake up to update the screen for the ":".
45+
46+
The CPU wakes up once a minute in this mode to update the time on the screen. LED LED1 will blink while the CPU is awake. The CPU will also wake up when the USB power is detected.
47+
48+
To measure the power consumption of the board, a meter can be placed between the pins 2 and 3 of jumper J9 (that goes to the battery housing. To measure the current of the CPU, cut the trace on the bottom of the board under jumper J1 and place a meter between the two pins.
49+
50+
![image](images/pic24f_lcdusbcuriosity.jpg)

0 commit comments

Comments
 (0)