Skip to content

Commit 8cae4c8

Browse files
committed
MPAE-15007: Readme update, images
1 parent 3a6f58a commit 8cae4c8

File tree

5 files changed

+49
-31
lines changed

5 files changed

+49
-31
lines changed

.main-meta/main.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"content": {
55
"metaDataVersion": "1.3.0",
66
"name": "com.microchip.mcu8.mplabx.project.avr64dd32-quadrature-decoder-mplab-mcc",
7-
"version": "1.0.1",
7+
"version": "1.0.2",
88
"displayName": "Core Independent Quadrature Decoder using the AVR64DD32 Microcontroller with MCC Melody",
99
"projectName": "avr64dd32-quadrature-decoder-mplab-mcc",
1010
"shortDescription": "Guide for using Core Independent Quadrature Decoder with AVR64DD32 Microcontroller using MCC Melody",
@@ -36,7 +36,7 @@
3636
"versionRange": "*"
3737
}
3838
},
39-
"author": "Bogdan-Alexadru Mariniuc",
39+
"author": "Bogdan-Alexandru Mariniuc",
4040
"peripherals": [
4141
"CCL",
4242
"UART",

README.md

Lines changed: 47 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,28 @@
22

33
# Core Independent Quadrature Decoder using the AVR64DD32 Microcontroller with MCC Melody
44

5-
<br>
6-
7-
Quadrature signals are the standard waveforms used as output for incremental encoders that come with motors. They provide information about motor direction and shaft position. There are two types of encoders - linear and rotary - and each can have two types of measurement: Absolute and incremental. There are also different technologies used for encoders: Magnetic, optical, inductive, capacitive, and laser.
5+
Quadrature signals are the standard output waveforms of incremental encoders that come with motors. They provide information about motor direction and shaft position. There are two types of encoders - linear and rotary - and each can have two types of measurement: Absolute and incremental. There are also different technologies used for encoders: Magnetic, optical, inductive, capacitive, and laser.
86

9-
The main categories of encoders are absolute and incremental. A rotary absolute encoder outputs a unique code for each position of the motor's shaft. If the power of this encoder is lost and the shaft is rotated, the encoder can return the correct position of the shaft. The rotary incremental encoder generates pulses while the shaft is rotated. If any pulse is missed, then the shaft position cannot be determined correctly anymore.
7+
The main categories of encoders are absolute and incremental. A **rotary absolute encoder** outputs a unique code for each position of the motor's shaft. If the power of this encoder is lost and the shaft is rotated, the encoder can return the correct position of the shaft. The **rotary incremental encoder** generates pulses while the shaft is rotated. If any pulse is missed, then the shaft position cannot be determined correctly anymore.
108
This application will use a rotary incremental encoder to show how to decode quadrature signals.
119

1210
The following image highlights the Clockwise (CW) and Counterclockwise (CCW) conditions on the quadrature signals A and B. When signal A leads signal B (on rising or falling edge), it will be a clockwise detection, otherwise, when signal B leads signal A (on rising or falling edge), it will be a counterclockwise detection.
1311

1412
<br><img src="images/cw_ccw.png" width="800">
1513

16-
The quadrature decoder uses the Configurable Custom Logic (CCL) to detect CW and CCW pulses. The following picture shows the output signals of the CCL implementation, CW and CCW, based on the quadrature signals A and B.
14+
The quadrature decoder uses the Configurable Custom Logic (CCL) on the AVR64DD32 to detect CW and CCW pulses. The following picture shows the output signals of the CCL implementation, CW and CCW, based on the quadrature signals A and B.
1715

1816
<br><img src="images/wavedrom.png" width="800">
1917

2018
Using the Event System (EVSYS) peripheral, the CW and CCW signals are linked to two TCB instances: One counts the CW pulses, the other one counts the CCW pulses.
2119

22-
<br>
23-
2420
## Related Documentation
2521

2622
More details and code examples on the AVR64DD32 can be found at the following links:
2723
- [Interfacing Quadrature Encoder using CCL with TCA and TCB](http://ww1.microchip.com/downloads/en/AppNotes/00002434A.pdf)
2824
- [Getting Started with CCL](http://ww1.microchip.com/downloads/en/AppNotes/TB3218-Getting-Started-with-CCL-90003218A.pdf)
2925
- [AVR64DD32 Product Page](https://www.microchip.com/wwwproducts/en/AVR64DD32)
3026
- [AVR64DD32 Code Examples on GitHub](https://github.com/microchip-pic-avr-examples?q=AVR64DD32)
31-
- [AVR64DD32 Project Examples in START](https://start.atmel.com/#examples/AVR64DD32CuriosityNano)
3227

3328
## Software Used
3429

@@ -37,19 +32,22 @@ More details and code examples on the AVR64DD32 can be found at the following li
3732
- [AVR-Dx Series Device Pack v2.1.152 or newer](https://packs.download.microchip.com)
3833
- [MPLAB® Code Configurator Melody core 2.1.13 or newer](https://www.microchip.com/en-us/tools-resources/configure/mplab-code-configurator/melody)
3934
- [MPLAB® Code Configurator Melody Drivers](https://www.microchip.com/en-us/tools-resources/configure/mplab-code-configurator/melody)
40-
- Logic Analyzer Software
41-
- Terminal software – Tera term, Real term, PuTTY, etc vXXX
35+
- [MPLAB® Data Visualizer v1.2.1160 or newer](https://www.microchip.com/en-us/tools-resources/debug/mplab-data-visualizer)
36+
- Logic analyzer software
4237

4338

4439
## Hardware Used
4540

46-
- The AVR64DD32 Curiosity Nano Development Board is used as a test platform.
47-
<br><img src="images/AVR64DD32.PNG" width="640"><br>
41+
- AVR64DD32 Curiosity Nano Development Board is used as a test platform.<br>
42+
43+
<br><img src="images/AVR64DD32.PNG" width="640"><br>
44+
<br>
4845
- Oscilloscope/Logic Analyzer
46+
4947
- Rotary encoder <br>
5048
<img src="images/rotor.jpg" width="300"><br>
5149

52-
*Note*: The setup can be made using **Rotary encoder** or **Motor with encoder**. In this example we use the **Rotary encoder**.
50+
*Note*: The setup can be made using **rotary encoder** or **motor with encoder**. In this example we use the **rotary encoder**.
5351

5452
- Motor with encoder
5553

@@ -63,7 +61,7 @@ To program the Curiosity Nano board with this MPLAB® X project, follow the step
6361

6462
## 1. Setup
6563

66-
The AVR64DD32 Curiosity Nano Development Board is used as test platform.
64+
The following peripheral and clock configurations are set up using MCC Melody for the AVR64DD32:
6765

6866
- System Clock - 4 MHz (default)
6967
- TCA0:
@@ -87,11 +85,15 @@ The AVR64DD32 Curiosity Nano Development Board is used as test platform.
8785
- Parity: None
8886
- Enable USART Transmit and Receive
8987
- Printf Support Enable
88+
- EVSYS:
89+
- Configuration described in the below schematic
90+
- CCL:
91+
- Configuration described in the below schematic
9092

91-
The following configurations must be made for this project:
93+
The following pin configurations must be made for this project:
9294

9395

94-
| Pin | Configuration | Semnification |
96+
| Pin | Configuration | Function |
9597
| :---: | :-----------------: | :-----------------: |
9698
| PA4 | Input | Phase A |
9799
| PA5 | Input | Phase B |
@@ -105,36 +107,52 @@ The internal connections and signals are presented in the following pictures:
105107

106108
<br><img src="images/quad_internal_connections.png" width="1200">
107109

108-
<br><img src="images/cases.png" width="800">
109-
110-
<br><br>
110+
<br><img src="images/cases.png" width="1000">
111111

112112
## 2. Demo
113113

114-
In this demo, the function `QEI_GetVelocity` is called every second and the return is printed on serial communication. The setup connections are presented in the following picture:
114+
In this demo, the function `QEI_GetVelocity` is called every second and the returned value is printed on the serial terminal. The hardware setup is presented in the image below:
115115

116-
<br><img src="images/portconn.jpg" width="960">
116+
<br><img src="images/portconn.jpg" width="1000">
117117
<br>
118118

119-
Every one second, the device sends a message through USART interface together with the counter value:
120-
<br><img src="images/serial-terminal.jpg">
119+
Every second, the device prints a message with the counter value through the USART interface:
120+
<br>
121+
<br><img src="images/serial-terminal.jpg" width="1000">
121122

122-
The signals are presented in the following picture. The values of counter are **8** and **-8**.
123-
<br><img src="images/Signals_Capture.jpg">
123+
**Note:** Follow the steps in the **How to use MPLAB® Data Visualizer** section to set up the Data Visualizer so that it can correctly show the text messages through USART0.
124124

125+
A snapshot of the different signals from the logic analyzer can be seen below. The CW and CCW pulses correspond to the counter values **8** and **-8**.
126+
<br>
127+
<br><img src="images/Signals_Capture.jpg" width="1000">
125128

126-
<br><br>
127129

128130
## 3. Summary
129131

130-
The quadrature decoder can detect and count clockwise and counterclockwise pulses on rising and falling edges of the quadrature signals.
132+
The quadrature decoder can detect and count clockwise and counterclockwise pulses on rising and falling edges of the quadrature signals. Read more about the implementation at https://www.microchip.com/en-us/about/blog/design-corner/quadrature-decoder.
133+
134+
135+
## How to use MPLAB® Data Visualizer
136+
137+
This section illustrates how to use the MPLAB® X Data Visualizer to send commands and receive information, but prior to programming the AVR64DD32 Curiosity Nano Board. This can be applied to any other projects.
138+
139+
### Operation
140+
141+
1. Open the software terminal in MPLAB® X IDE. Left click on the **Data Visualizer** button.
142+
<br><img src="./images/data_visualizer_button.png" width="1000"><br>
143+
144+
2. Select the **Input Source** corresponding to the AVR64DD32 in the right side.<br>
145+
146+
3. Identify the coresponding COMx that is represented by the AVR64DD32 Curiosity Nano Board and select it in the **Connections** tab in the left side.<br>
131147

132-
- [Back to Top](#core-independent-quadrature-decoder-using-the-avr64dd32-microcontroller-with-mcc-melody)<br><br>
148+
4. Set the specific **Baud Rate**, in this case **115200**.<br>
133149

150+
5. Press **Start streaming COMx button**. The text messages will appear in the **Terminal** tab.
151+
<br><img src="./images/data_visualizer_config.png" width="1000">
134152

135153
## How to Program the Curiosity Nano board
136154

137-
This chapter shows how to use the MPLAB® X IDE to program an AVR® device with an Example_Project.X. This can be applied for any other projects.
155+
This chapter shows how to use the MPLAB® X IDE to program an AVR® device with an Example_Project.X. This can be applied for any other projects.
138156

139157
- Connect the board to the PC.
140158

images/data_visualizer_button.png

76.2 KB
Loading

images/data_visualizer_config.png

241 KB
Loading

images/serial-terminal.jpg

45.7 KB
Loading

0 commit comments

Comments
 (0)