Skip to content

Commit

Permalink
MPAE-18068: Add Curiosity Nano VBUS header description
Browse files Browse the repository at this point in the history
  • Loading branch information
Henrik Moe Arnesen authored and Henrik Moe Arnesen committed Nov 27, 2024
1 parent 2b345d8 commit 3943d5c
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ This example shows how to use the AVR DU microcontroller as a bridge to other pe
## Setup

### Physical Setup
The AVR DU Curiosity Nano Development Board has two USB-C® ports. One for programming the device via the on-board debugger and one connected directly to the AVR DU. While programming the device over the AVR DU's port is possible using bootloaders, this example uses the debugger port, so both ports need to be connected to the host computer. After programming, the debugger port is used for serial communication to close the loop and needs to remain connected. One of the AVR DU's USART peripherals is directly connected to the debugger CDC pins, allowing the entire bridge application to be showcased on the development board.
The AVR DU Curiosity Nano Development Board has two USB-C® ports. One for programming the device via the on-board debugger and one connected directly to the AVR DU. While programming the device over the AVR DU's port is possible using bootloaders, this example uses the debugger port, so both ports need to be connected to the host computer. After programming, the debugger port is used for serial communication to close the loop and needs to remain connected. One of the AVR DU's USART peripherals is directly connected to the debugger CDC pins, allowing the entire bridge application to be showcased on the development board.

The Curiosity Nano has an Adjustable Target Regulator that regulates voltage to 3.3V by default. Since the USB peripheral in the AVR64DU32 needs to run at 3.3V, it either needs a 3.3V supply connected on the VUSB pin or a 5.0V supply on VDD with the internal USB Voltage Regulator active. With the Curiosity Nano default settings, the VBUS pinheader on the board must be connected with the included jumper to supply 3.3V directly to VUSB.

### MCC Setup
This section shows how the example is set up in MPLAB using MCC. An overview of the complete MCC setup is shown in the image below:
Expand Down Expand Up @@ -63,7 +65,7 @@ All communication is sent over the data interface for this basic Virtual Serial
General settings for the USART can be seen below. The specific settings is not important, but must match what is set in the terminal session for the USART. If large amount of data is being transmitted the baud rate should match between the USART and CDC session to avoid buffer overflow.
<p><img src="images/mcc_usart_settings.jpg" width="500"/></p>

> 🛈 Info: The on-board debugger of the Curiosity Nano limits its baud rate to about 500 kbaud. Because of this it is also the limit for the AVR DU in this example. If implemented without the development board this limit is removed.
> 🛈 Info: The on-board debugger of the Curiosity Nano limits its baud rate to about 500 kbaud. Because of this, it is also the limit for the AVR DU in this example. If implemented without the development board this limit is removed.
USART hardware and interrupt settings should be set by the settings above but should for reference be like the picture below.
<p><img src="images/mcc_usart_hardware_settings.jpg" width="500"/></p>
Expand Down Expand Up @@ -91,13 +93,13 @@ In the V<sub>REF</sub> peripheral, the Voltage Reference is set to 2.048V.
#### Analog Comparator Setup (AC)
The Analog Comparator must be enabled by toggling Enable under Hardware Settings.

The positive input is set to the USB DETECT pin on the Curiosity Nano which is connected to Positive Pin 4 on the AC by default. The detection threshold is set using the Digital-to-Analog Comparator (DAC) reference (DACREF) which is selected as the negative input to the AC.
The positive input is set to the USB DETECT pin on the Curiosity Nano which is connected to Positive Pin 4 on the AC by default. The detection threshold is set using the internal reference voltage generator (DACREF) which is selected as the negative input to the AC.

To calculate the DACREF, use the formula from the data sheet:

*V_DACREF = (DACREF / 256) * V_REF*

If the desired threshold known, the built-in Requested Voltage feature of MCC can calculate it automatically. Due to the voltage divider present on the Curiosity Nano, a threshold of 0.32V is needed for this project. Inputting this value into the Requested Voltage field will populate the DACREF value.
Due to the voltage divider present on the Curiosity Nano, a threshold of 0.32V is needed for this project. Inputting this value into the Requested Voltage field in MCC can calculate the DACREF value automatically.

Refer to the [AVR64DU32 Curiosity Nano User Guide](https://ww1.microchip.com/downloads/aemDocuments/documents/MCU08/ProductDocuments/UserGuides/AVR64DU32-Curiosity-Nano-UserGuide-DS50003671.pdf) for more information on how the *USB DETECT* is implemented on the Curiosity Nano.

Expand All @@ -114,7 +116,7 @@ The RTC is configured to run on a 1 kHz clock with no prescaler.
The PIT is then set to trigger at every 32 clock cycles of the RTC clock. this gives an update rate of ~31 Hz.
<p><img src="images/mcc_rtc_interrupt_settings.jpg" width="600"/></p>

The application is set up to need five stable voltage readings before initiating the USB communication. This means that, with no voltage fluctuations and the settings above, the start-up time will be in the 0.16 s range.
The application is set up to need five stable voltage readings before initiating the USB communication. This means that, with no voltage fluctuations and the settings above, the start-up time will be in the 0.16s range.

### LED Setup
The on-board LED of the Curiosity Nano is used to indicate if the USB communications has failed. The LED is connected to the PF1 pin and can be selected as an output in the Pin Grid View as seen in the USART section of this guide. The pin is given a custom name in the Pins menu, as seen below. This makes the code easier to read with function generated using this name.
Expand Down Expand Up @@ -143,7 +145,7 @@ This example is set up for the USART peripheral, but the main application would
When the device is programmed, it will show up as a Virtual Serial Port on the host. The method varies between operating systems and the most common cases are listed below.

#### Windows®
In Windows, the easiest way to identify the port number is to go to Device Manager>Ports (COM and LPT) to easily identify the port number.. The device shows up as USB Serial Device (COM##), where ## is the number assigned by the host.
In Windows, the easiest way to identify the port number is to go to *Device Manager>Ports (COM and LPT)* to easily identify the port number.. The device shows up as USB Serial Device (COM##), where ## is the number assigned by the host.

Alternatively, the following commands will also list the devices in terminal.

Expand Down

0 comments on commit 3943d5c

Please sign in to comment.