Skip to content

Commit e722c9d

Browse files
initial commit
0 parents  commit e722c9d

File tree

9 files changed

+535
-0
lines changed

9 files changed

+535
-0
lines changed

README.md

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
<!-- Please do not change this logo with link -->
2+
3+
<a target="_blank" href="https://www.microchip.com/" id="top-of-page">
4+
<picture>
5+
<source media="(prefers-color-scheme: light)" srcset="images/microchip.png" width="350">
6+
<img alt="Microchip Technologies Inc." src="https://www.microchip.com/content/experience-fragments/mchp/en_us/site/header/master/_jcr_content/root/responsivegrid/header/logo.coreimg.100.300.png/1605828081463/microchip.png">
7+
</picture>
8+
</a>
9+
10+
## MTCH9010 Enhanced Configuration Using PowerShell®-Compatible Scripts
11+
12+
This repository contains two PowerShell®-compatible scripts for configuring the MTCH9010 through the Enhanced Configuration mode via a serial communication:
13+
- `send_param_basic.ps1`: Basic Configuration Script
14+
- `send_param_enh.ps1`: Enhanced Configuration Script
15+
16+
## Prerequisites
17+
- PowerShell 5.1 or newer
18+
19+
## Hardware Used
20+
- [MTCH9010 Evaluation Kit](https://www.microchip.com/en-us/development-tool/EV24U22A?utm_source=GitHub&utm_medium=TextLink&utm_campaign=MCU8_mtch9010&utm_content=mtch9010-configuration-scripts-github&utm_bu=MCU08)
21+
<br><img src="images/ev-kit.png" width="400">
22+
23+
## Concept
24+
Two PowerShell®-compatible scripts for configuring the MTCH9010 are provided in this repository:
25+
- `send_param_basic.ps1` - this script transmits a predefined configuration to the MTCH9010
26+
- `send_param_enh.ps1` - this script allows the user to transmit the desired configuration parameters
27+
## Usage
28+
Open a PowerShell terminal. From the command prompt, go to the directory where the scripts are
29+
located. Run one of the following commands, depending on which script you are using:
30+
31+
`.\send_param_basic.ps1` or `.\send_param_enh.ps1`
32+
## Configuration
33+
Before running the scripts, the device must be configured in Enhanced Configuration mode through the corresponding slide switch. The following configuration must be made on the MTCH9010:
34+
- <b> ECFG </b> configured to <b> ON </b>
35+
- <b> LOCK </b> configured to <b> OFF </b>
36+
37+
<br><img src="images/mtch-config.png" width="400">
38+
39+
To ensure proper communication with the hardware, verify the COM port assigned to the device before running the script, as incorrect port settings can lead to connection failures. The specific COM port for the MTCH9010 Evaluation Kit can be identified by checking the Ports section in Windows Device Manager.
40+
41+
The COM port used in these examples is COM37. Additionaly, the coresponding serial port must be configured as it is shown below.
42+
43+
`$port = New-Object System.IO.Ports.SerialPort COM37, 38400, None, 8, 1`
44+
- 38400: Baud rate of 38400 bits/second
45+
- None: No parity bit
46+
- 8: Eight data bits
47+
- 1: One stop bit
48+
49+
## Scripts Functionality
50+
`send_param_basic.ps1` transmits a predefined configuration to the MTCH9010. The following
51+
parameters are set in this example:
52+
- `Operation Mode`: Conductive (option `1`)
53+
- `Sleep period`: Four seconds (option `3`)
54+
- `Extended output mode`: Serial data enabled (option `1`)
55+
- `Extended output format`: Standard measurement and delta (option `2`)
56+
- Confirm the `reference value` provided (option `0`)
57+
- Provide the `threshold value`: `800`
58+
59+
60+
61+
`send_param_enh.ps1` allows the user to enter the desired parameters. A reset is needed to start configuring the device. After the configuration is done, the script displays a message, followed by the measurements made by MTCH9010. The configured parameters can be saved in the Nonvolatile Memory (NVM) and restored at every start-up. To enable this functionality, configure the MTCH9010 as follows :
62+
63+
- <b> LOCK </b> configured to <b> ON </b>
64+
- <b> ECFG </b> configured to <b> OFF </b>
65+
66+
The following table describes the available options when it comes to configuring application
67+
parameters through the Enhanced Configuration mode:
68+
69+
70+
| Parameter | Value | Configuration |
71+
|:------------------------------------------:|:-----: |:-------------------------------------------------: |
72+
| Operation Mode | 0 | Capacitive |
73+
| | 1 | Conductive |
74+
| Sleep Time | 0 | Wake-up on request |
75+
| | 1 | 1 second |
76+
| | 2 | 2 seconds |
77+
| | 3 | 4 seconds |
78+
| | 4 | 8 seconds |
79+
| | 5 | 16 seconds |
80+
| | 6 | 32 seconds |
81+
| | 7 | 64 seconds |
82+
| | 8 | 128 seconds |
83+
| | 9 | 256 seconds |
84+
| Extended Output Moode | 0 | Disabled |
85+
| | 1 | Enabled |
86+
| Extended Output Format | 0 | Delta measurement |
87+
| | 1 | Standard measurement |
88+
| | 2 | Both standard and delta measurements |
89+
| | 3 | MPLAB Data Visualizer Data Stream protocol format |
90+
| Capacitive/Conductive Reference Value | 0 | Set the standard measurement as Reference Value |
91+
| | 1 | Repeat the capacitive/conductive measurement |
92+
| | 2 | Set custom Reference Value |
93+
| Capacitive/Conductive Detection Threshold | 0 | Set custom Detection Threshold |
94+
95+
96+
Once the System Lock is enabled, the saved configuration will be used at power-up. The user can view the values acquired with the new configuration after applying a reset. The `send_param_enh.ps1` script will continue running until any key is pressed.
97+
98+
<b>Note</b>: A reset is required before sending the parameters to the MTCH9010 in both scenarios.
99+
100+
## Demo
101+
The next demonstation GIF presents a showcase of how to configure the MTCH9010 using the `send_param_enh.ps1` script.
102+
<br><img src="images/demo.gif" width="500">
103+
104+
## Summary
105+
These PowerShell®-compatible scripts are used for configuring the MTCH9010 through the Enhanced Configuration mode via a serial communication.
106+
107+
## Menu
108+
- [Back to Top](#mtch9010-enhanced-configuration-using-powershell®-compatible-scripts)
109+
- [Back to Prerequisites](#prerequisites)
110+
- [Back to Hardware Used](#hardware-used)
111+
- [Back to Concept](#concept)
112+
- [Back to Usage](#usage)
113+
- [Back to Concept](#concept)
114+
- [Back to Configuration](#configuration)
115+
- [Back to Scripts Functionality](#scripts-functionality)
116+
- [Back to Demo](#demo)
117+
- [Back to Summary](#summary)

images/demo.gif

3.57 MB
Loading

images/ev-kit.png

526 KB
Loading

images/mchp_logo_dark.png

21.6 KB
Loading

images/mchp_logo_light.png

22.8 KB
Loading

images/microchip.png

5.47 KB
Loading

images/mtch-config.png

855 KB
Loading

send_param_basic.ps1

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# Configure the serial port
2+
$port = New-Object System.IO.Ports.SerialPort COM37, 38400, None, 8, 1
3+
4+
function Send-SerialData($data){
5+
$port.WriteLine($data)
6+
$port.WriteLine("`r")
7+
Start-Sleep -Milliseconds 500
8+
}
9+
10+
# Configuration
11+
$opmode = 1
12+
$sleeptime = 3
13+
$global:outputmode = 1
14+
$outputformat = 2
15+
$referencevalue = 0
16+
$threshold = 800
17+
18+
$port.Open()
19+
$version = "1.0.0"
20+
Write-Host "MTCH9010 Basic Configuration Script version $version"
21+
Write-Host "Waiting for reset. Please apply a reset!"
22+
23+
do {
24+
$data = $port.ReadLine().Trim()
25+
}while ($data -ne "Firmware v1.2.1")
26+
27+
Write-Host "Reset received."
28+
Write-Host "$data"
29+
Write-Host("`n`r")
30+
31+
Write-Host "Sending configuration"
32+
Start-Sleep -Milliseconds 500
33+
34+
Write-Host "Operation Mode: $opmode"
35+
Send-SerialData $opmode
36+
Write-Host "Sleep Time: $sleeptime "
37+
Send-SerialData $sleeptime
38+
Write-Host "Extended Output Mode: $global:outputmode"
39+
Send-SerialData $global:outputmode
40+
if ($global:outputmode -eq 1){
41+
Write-Host "Extended Output Format: $outputformat"
42+
Send-SerialData $outputformat
43+
}
44+
45+
do {
46+
$global:baseline = $port.ReadLine().Trim()
47+
48+
}while ($global:baseline -notmatch '^(\d+)$')
49+
50+
Write-Host "Reference Value: $global:baseline"
51+
Write-Host "Confirm Reference Value: $referencevalue"
52+
Send-SerialData $referencevalue
53+
Write-Host "Detection Threshold: $threshold"
54+
Send-SerialData $threshold
55+
Write-Host("`n`r")
56+
Write-Host "Configuration Done! Press any key to exit."
57+
58+
$port.DiscardInBuffer()
59+
do {
60+
if ($port.BytesToRead -gt 0) {
61+
$data = $port.ReadLine().Trim()
62+
Write-Host "$data"
63+
}
64+
# Exit loop if any key is pressed
65+
if ([System.Console]::KeyAvailable) {
66+
Write-Host "Key pressed. Exit..."
67+
[void][System.Console]::ReadKey($true)
68+
break
69+
}
70+
Start-Sleep -Milliseconds 50
71+
} while ($true)
72+
73+
$port.Close()

0 commit comments

Comments
 (0)