Skip to content

Commit e671f22

Browse files
committed
Pull request #1: Feature/ver1
Merge in MCU16CE/matlab-dspic33a-curiosity-i2cexample-mpu9250 from ~I52209/matlab-dspic33a-curiosity-i2cexample-mpu9250-ce:feature/ver1 to develop * commit 'bcd0cea32ac3f6d2b090c38032f8e48574194050': Copied for release (Commit: 63f6481924b4d8be4bd5b9276e1ff4b6cd0c51c4 16 March 2025, 11:15PM) Updating the changelog, main.json, jenkins and gitignore files
2 parents b36333e + bcd0cea commit e671f22

File tree

20 files changed

+158
-25
lines changed

20 files changed

+158
-25
lines changed

.citd/Jenkinsfilek8s

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ pipeline {
8080

8181
stage('Build') {
8282
steps {
83-
script {
83+
script {
84+
sh("npm install -g xml2js")
85+
sh("npm link xml2js")
8486
mplabxProjectBuild(
8587
sourceFilePath: "${env.MPLABX_PROJECT_SOURCE}"
8688
)

.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,19 @@
1919
#Excluding Files/Folders Auto-Generated by Test Harness
2020
.generated_files/
2121

22+
#Excluding Files/Folders Auto-Generated by Simulink
23+
*.X
24+
*.slx.autosave
25+
*.slx.original
26+
*.slxc
27+
*.mat
28+
*.tlc
29+
*.tlh
30+
*.xml
31+
*.tmw
32+
*.dmr
33+
*.l
34+
2235
# Excluding Netbeans specific build directories and file types
2336
~*.*
2437
.generated_files/

.main-meta/main.json

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,43 +4,45 @@
44
"content":{
55
"metaDataVersion":"1.0.0",
66
"name":"com.microchip.matlab.project.matlab-dspic33a-curiosity-i2cexample-mpu9250",
7-
"version":"x.x.x",
8-
"displayName":"xxxxxxxxxxxxxxx",
7+
"version":"1.0.0",
8+
"displayName":"MATLAB/Simulink Model for I2C Peripheral Demonstration on dsPIC33AK128MC106",
99
"projectName":"matlab-dspic33a-curiosity-i2cexample-mpu9250",
10-
"shortDescription":"xxxxxxxxxxxxxxx",
10+
"shortDescription":"MATLAB/Simulink Model for I2C Peripheral Demonstration on the hardware platform Curiosity Platform Development Board, dsPIC33AK128MC106 GP DIM and MPU9250 sensor on the MPU 9DOF Click Board",
1111
"simulationTool":{
1212
"name":"MATLAB/Simulink",
13-
"semverRange":">=2022"
13+
"semverRange":">=2024"
1414
},
1515
"addonPackages":[
1616
"MATLAB add on packages",
1717
"Simulink",
1818
"MPLAB Device blocks for Simulink",
19-
"Motor Control Blockset",
20-
"Embedded Coder",
21-
"Fixed-Point Designer"
19+
"Embedded Coder"
2220
],
2321
"compiler":{
24-
"name":"XC16",
25-
"semverRange":"^2.0.0"
22+
"name":"XCDSC",
23+
"semverRange":"^3.21"
2624
},
2725
"dfp":{
28-
"name":"xxxxxxxxxxxxxxx",
29-
"semverRange":">=x.x.x"
26+
"name":"dsPIC33AK-MC_DFP",
27+
"semverRange":">=1.1.109"
3028
},
3129
"device":{
3230
"metaDataVersion":"1.0.0",
3331
"category":"com.microchip.portal.contentRef",
3432
"content":{
3533
"metaDataVersion":"1.0.0",
3634
"category":"com.microchip.device",
37-
"name":"xxxxxxxxxxxxxxx",
35+
"name":"dsPIC33AK128MC106",
3836
"versionRange":"*"
3937
}
4038
},
4139
"keywords":[
42-
"GPIO",
43-
"UART"
40+
"Communication Module",
41+
"I2C",
42+
"I2C Protocol",
43+
"GPIO",
44+
"ADC",
45+
"PWM"
4446
]
4547
}
4648
}

README.md

Lines changed: 125 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,145 @@
11
<picture>
22
<source media="(prefers-color-scheme: dark)" srcset="images/microchip_logo_white_red.png">
3-
<source media="(prefers-color-scheme: light)" srcset="images/microchip_logo_black_red.png">
3+
<source media="(prefers-color-scheme: light)" srcset="images/microchip_logo_black_red.png">
44
<img alt="Microchip Logo." src="images/microchip_logo_black_red.png">
55
</picture>
66

7-
## matlab dspic33a curiosity i2cexample mpu9250
7+
# MATLAB/Simulink Model for I2C Peripheral Example: Curiosity Platform Development Board, dsPIC33AK128MC106 Curiosity GP DIM and MPU9250
88

9-
Board Image if any.
9+
## 1. INTRODUCTION
1010

11-
## Summary
11+
This document describes the setup requirements for demonstration of I2C communication on the hardware platform
12+
[EV74H48A](https://www.microchip.com/en-us/development-tool/EV74H48A) "Curiosity Platform Development Board" and [EV02G02A](https://www.microchip.com/en-us/development-tool/EV02G02A) "dsPIC33AK128MC106 General Purpose Dual In-Line Module (DIM)" using MPU9250 sensor on the MPU 9DOF Click Board.</p>
1213

14+
MPU-9250 is a multi-chip module (MCM) with 9-axis MotionTracking device that combines a 3-axis gyroscope, 3-axis accelerometer, 3-axis magnetometer and a Digital Motion Processor™ (DMP).
1315

14-
## Related Documentation
16+
## 2. SUGGESTED DEMONSTRATION REQUIREMENTS
1517

18+
### 2.1 MATLAB Model Required for the Demonstration
1619

17-
## Software Used
20+
To clone or download this MATLAB model on GitHub,
1821

22+
- MATLAB model can be cloned or downloaded as zip file from the Github repository ([link](https://github.com/microchip-pic-avr-solutions/matlab-dspic33a-curiosity-i2cexample-mpu9250)).
1923

20-
## Hardware Used
24+
### 2.2 Software Tools Used for Testing the MATLAB/Simulink Model
2125

26+
- MPLAB® X IDE **v6.25**
27+
- MPLAB® XC-DSC Compiler **v3.21**
28+
- MATLAB R2024b
29+
- Required MATLAB add-on packages
30+
- Simulink (v24.2)
31+
- Simulink Coder (v24.2)
32+
- MATLAB Coder (v24.2)
33+
- Embedded Coder (v24.2)
34+
- MPLAB Device blocks for Simulink (v3.59)
35+
- Motor Control Blockset (v24.2)
36+
> **_NOTE:_**
37+
>The software tools used for testing the model during release is listed above. It is recommended to use the version listed above or later versions for building the model.
2238
23-
## Setup
39+
### 2.3 Hardware Tools Required for the Demonstration
2440

41+
- Curiosity Platform Development Board [(EV74H48A)](https://www.microchip.com/en-us/development-tool/EV74H48A)
42+
- dsPIC33AK128MC106 General Purpose Dual In-Line Module [(EV02G02A)](https://www.microchip.com/en-us/development-tool/EV02G02A)
43+
- [MPU 9DOF CLICK](https://www.mikroe.com/mpu-9dof-click)
2544

26-
## Operation
45+
## 3. HARDWARE SETUP
46+
This section describes the hardware setup required for the demonstration.
47+
> **Note:** </br>
48+
>In this document, hereinafter Curiosity Platform Development Board is referred as **development board**.
2749
50+
1. Insert the **dsPIC33AK128MC106 Curiosity GP DIM** into the DIM Interface **connector J1** on the development board. Make sure the DIM is placed correctly and oriented before going ahead.
2851

52+
<p align="left" >
53+
<img src="images/dimconnected.png"width="500"></p>
2954

55+
2. Insert the **MPU 9DOF click** into the **mikro BUS A** interface **connector J13** on the development board. Make sure the click board is inserted correctly before going ahead.
56+
57+
<p align="left" >
58+
<img src="images/microbusA.png"width="500"></p>
59+
60+
3. The development board has an onboard programmer **PICkit™ On Board (PKoBv4)** , which can be used for programming or debugging the microcontroller or dsPIC DSC on the DIM. To use the onboard programmer, connect a micro-USB cable between the Host PC and **connector J24** on the development board.
61+
62+
The development board is also powered by this USB itself.
63+
64+
<p align="left">
65+
<img src="images/pkob4.png"width="500"></p>
66+
67+
## 4. BASIC DEMONSTRATION
68+
<p style='text-align: justify;'> Follow the below instructions step-by-step, to set up and I2C demo application:</p>
69+
70+
1. Launch MATLAB (refer the section [“2.2 Software Tools Used for Testing the MATLAB/Simulink Model"](#22-software-tools-used-for-testing-the-matlabsimulink-model)).</p>
71+
72+
2. Open the folder downloaded from the repository, in which MATLAB files are saved (refer the section ["2.1 MATLAB Model Required for the Demonstration"](#21-matlab-model-required-for-the-demonstration)).
73+
74+
<p align="left" >
75+
<img src="images/dem1.png"width="500"></p>
76+
77+
3. Double click on the I2C example Simulink model - **curiosity_i2c.slx**. This opens the Simulink model as shown below.
78+
79+
<p align="left">
80+
<img src="images/dem3.png"width="500"></p>
81+
</p>
82+
83+
> **Note:** </br>
84+
>This example demonstrates only the code generation to demostrate the I2C communication. The simulation is not possible in this case.
85+
86+
4. <p style='text-align: justify;'>From this Simulink model an MPLAB X project can be generated, and it can be used to run the I2C Communication using development board. <p style='text-align: justify;'>To generate the code from the Simulink model, go to the <b>"MICROCHIP"</b> tab, and enable the tabs shown in the figure below.
87+
88+
<p align="left">
89+
<img src="images/dem4.png"width="500"></p>
90+
</p>
91+
92+
5. <p style='text-align: justify;'> This model uses the <b>External Mode</b> debug option for real time data visualization. To configure the external mode click on <b>"Ext Mode Settings" </b> option under the <b>“Microchip”</b> tab. <p style='text-align: justify;'> This will open <b>External Mode Setup</b> window and enable the checkboxes as shown in the figure. Also select the <b> COM port </b> connected to the development board and <b>Baud Rate</b>.
93+
94+
<p align="left">
95+
<img src="images/dem5.png"width="500"></p>
96+
</p>
97+
98+
> **Note:** </br>
99+
>Two COM ports are available on the development board. Select the second COM port number for the external mode (if COM2 and COM3 are available on the development board, select COM3).
100+
101+
6. <p style='text-align: justify;'> To generate the code and run the I2C communication on hardware, click on <b>"Monitor & Tune" </b> option under the <b>Hardware</b> tab and ensure that <b>"Stop Time" </b> is set to <b>"inf"</b>.
102+
103+
<p align="left">
104+
<img src="images/dem6.png"width="500"></p>
105+
</p>
106+
7. <p style='text-align: justify;'> After compilation and programming the device. The external mode will be running on the dsPIC.
107+
108+
<p align="left">
109+
<img src="images/dem7.png"width="500"></p>
110+
111+
</p><p style='text-align: justify;'> The <b>General Purpose LED's</b> will be blinking.
112+
113+
<p align="left">
114+
<img src="images/debug_led.png"width="500"></p>
115+
</p>
116+
117+
8. <p style='text-align: justify;'> The <b> RGB LEB</b> will be glowing in different colors. To increase the brightness of the RGB LED, vary the <b>Potentiometer</b> on the development board.
118+
119+
<p align="left">
120+
<img src="images/led_rgb.png"width="500"></p>
121+
</p>
122+
123+
9. <p style='text-align: justify;'> To view the I2C communication from <b>"MPU9250" </b> double click on the scope. This opens the scope view. Tilt or turn the development board by hand to view variations in the signal from the <b>accelerometer, gyroscope and magnetometer sensors of MPU9250</b>.
124+
125+
<p align="left">
126+
<img src="images/dem9.png"width="500"></p>
127+
</p>
128+
129+
10. <p style='text-align: justify;'>Click on the <b>Stop</b> button to stop the I2C communication and external mode.
130+
131+
<p align="left">
132+
<img src="images/dem10.png"width="500"></p>
133+
</p>
134+
135+
136+
## REFERENCES:
137+
For more information, refer to the following documents or links.
138+
1. Curiosity Platform Development Board User's Guide [(DS70005562)](https://ww1.microchip.com/downloads/aemDocuments/documents/MCU16/ProductDocuments/UserGuides/Curiosity-Platform-Development-Board-Users-Guide-DS70005562.pdf)
139+
2. dsPIC33AK128MC106 General Purpose Dual In-Line Module (DIM) Information Sheet [(DS70005556)](https://ww1.microchip.com/downloads/aemDocuments/documents/MCU16/ProductDocuments/InformationSheet/dsPIC33AK128MC106-General-Purpose-DIM-Info-Sheet-DS70005556.pdf)
140+
3. dsPIC33AK128MC106 Family datasheet [(DS70005539)](https://ww1.microchip.com/downloads/aemDocuments/documents/MCU16/ProductDocuments/DataSheets/dsPIC33AK128MC106-Family-Data-Sheet-DS70005539.pdf)
141+
4. MPLAB® X IDE User’s Guide [(DS50002027)](https://ww1.microchip.com/downloads/en/DeviceDoc/50002027E.pdf) or [MPLAB® X IDE help](https://microchipdeveloper.com/xwiki/bin/view/software-tools/x/)
142+
5. [MPLAB® X IDE installation](http://microchipdeveloper.com/mplabx:installation)
143+
6. [MPLAB® XC-DSC Compiler installation](https://developerhelp.microchip.com/xwiki/bin/view/software-tools/xc-dsc/install/)
144+
7. [MPLAB Device Blocks for Simulink :dsPIC, PIC32 and SAM mcu](https://in.mathworks.com/matlabcentral/fileexchange/71892-mplab-device-blocks-for-simulink-dspic-pic32-and-sam-mcu)
145+
8. [External Mode Demo](https://www.microchip.com/en-us/about/media-center/videos/wuzLmORk1M0)

changelog.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# matlab-dspic33a-curiosity-i2cexample-mpu9250 v1.0.0
22
### Release Highlights
3-
3+
This is the first version of MATLAB Simulink model for I2C Communication Demonstration on hardware platform Curiosity Platform Development Board, dsPIC33AK128MC106 Curiosity GP DIM and MPU9250.
44

55

66
### Features Added\Updated

images/debug_led.png

698 KB
Loading

images/dem1.png

9.31 KB
Loading

images/dem10.png

57.2 KB
Loading

images/dem3.png

312 KB
Loading

images/dem4.png

44.9 KB
Loading

0 commit comments

Comments
 (0)