Skip to content
Snippets Groups Projects
Commit 2f514457 authored by Henrik Alsér's avatar Henrik Alsér
Browse files

Crystal cap calculation

parent a685fae0
Branches
No related tags found
No related merge requests found
...@@ -90,12 +90,15 @@ The microcontroller can boot in different modes, similar to how you can enter th ...@@ -90,12 +90,15 @@ The microcontroller can boot in different modes, similar to how you can enter th
### 6) Crystal ### 6) Crystal
The crystal will resonate at a specified frequency. Its waveform will be used as an input to the PLL (Phase Locked Loop) that will multiply the crystal’s frequency. This is the crystal that will be used: https://www.elfa.se/en/quartz-surface-mount-12mhz-iqd-lfxtal003210/p/17452154 The crystal will resonate at a specified frequency. Its waveform will be used as an input to the PLL (Phase Locked Loop) that will multiply the crystal’s frequency. This is the crystal that will be used: https://www.elfa.se/sv/kristall-ytmontering-16mhz-iqd-lfxtal029370/p/30131284
The crystal and its associated capacitors are part of a "Pierce oscillator" circuit connected to two special pins on the MCU - `PH0 - OSC_IN` and `PH1 - OSC_OUT`. To calculate value of the load capacitors required for proper operation, use the following formula:
`C = 2*(Cload - Cstray)` where `Cload` is the load capacitance value specified in the crystal's [datasheet](https://www.elfa.se/Web/Downloads/_t/ds/LFXTAL029370REEL_eng_tds.pdf) (18pF) and `Cstray` is the stray capaciatance on the PCB, usually in the range of 2-10pF (pick something in-between, like 6pF). This gives us a capacitance value of `2*(18 - 6) = 24pF`. The closest standard value would be `22pF`.
- Click on the Place component button. - Click on the Place component button.
- Find the device/Crystal. - Find the device/Crystal.
- Place it close to `PH0` and `PH1`, pin 5 and 6 (`RCC_OS_CIN` and `RCC_OSC_OUT`). - Place it close to `PH0 - OSC_IN` and `PH1 - OSC_OUT`, pin 5 and 6.
- Connect the component with wires to the mentioned pins. Value 12MHz. - Connect the component with wires to the mentioned pins. Value 16MHz.
- Connect one 22pF capacitor to each pin on the crystal and connect the other end of the capacitors to GND. - Connect one 22pF capacitor to each pin on the crystal and connect the other end of the capacitors to GND.
### 7) Serial Wire Debug (SWD) connector ### 7) Serial Wire Debug (SWD) connector
...@@ -128,7 +131,7 @@ Download the general [datasheet](https://www.pixart.com/products-detail/4/PMW338 ...@@ -128,7 +131,7 @@ Download the general [datasheet](https://www.pixart.com/products-detail/4/PMW338
For some components (like the PMW3389DM-T3QU) there might not exist a pre-made library, so you will now learn how to draw your own component. For some components (like the PMW3389DM-T3QU) there might not exist a pre-made library, so you will now learn how to draw your own component.
- Click on Tools/ Symbol Library Editor. - Click on Tools/ Symbol Library Editor.
- Create a new library for your project and click on Create New symbol inthe new library). - Create a new library for your project and click on Create New symbol in the new library).
- Component name ”PMW3389”. OK. - Component name ”PMW3389”. OK.
- Add pins and name them according to the datasheet. Remember to assign the correct pin number as well. - Add pins and name them according to the datasheet. Remember to assign the correct pin number as well.
- Make sure to set the ”Electrical type” on each pin according to usage (signal in/out, power in/out etc.) `X` marks a non connected pin. In our setting we don't use `GPO` so you can set it `X`. - Make sure to set the ”Electrical type” on each pin according to usage (signal in/out, power in/out etc.) `X` marks a non connected pin. In our setting we don't use `GPO` so you can set it `X`.
...@@ -139,7 +142,7 @@ Hint. Never, never ever, change the grid settings when placing the pins in the s ...@@ -139,7 +142,7 @@ Hint. Never, never ever, change the grid settings when placing the pins in the s
### 11) 1.9v Power Supply ### 11) 1.9v Power Supply
As you can see in the PWM3389DM-T3QU datasheet and reference schematics, the sensor requires a 1.9v power supply. This is much less common voltage for a fixed output LDO (try finding one from Elfa or rs-online and you will likely fail). As you can see in the PWM3389DM-T3QU datasheet and reference schematics, the sensor requires a 1.9v power supply. This is a much less common voltage for a fixed output LDO (try finding one from Elfa or rs-online and you will likely fail).
To that end, you can use an adjustable voltage regulator, such as [MIC5235YM5-TR](https://www.elfa.se/en/ldo-voltage-regulator-24-20v-sot-23-microchip-mic5235ym5-tr/p/30099685), which will let you set your desired output voltage using external resistors. To that end, you can use an adjustable voltage regulator, such as [MIC5235YM5-TR](https://www.elfa.se/en/ldo-voltage-regulator-24-20v-sot-23-microchip-mic5235ym5-tr/p/30099685), which will let you set your desired output voltage using external resistors.
...@@ -196,11 +199,11 @@ It is very important that the pin numbering on your component is correct to the ...@@ -196,11 +199,11 @@ It is very important that the pin numbering on your component is correct to the
### 17) Electric Rule Check (ERC) ### 17) Electric Rule Check (ERC)
ERC is a check that detects if you have any ”lose ends”, meaning that it will give you a warning if you have a net with only one connection. It will also give you a warning if you have drawn a net to a component but the net and the component haven’t connected. To get the ERC to work as intended, you have to mark all the unused pins with a Not-connected flag, found to the right. ERC is a check that detects if you have any ”loose ends”, meaning that it will give you a warning if you have a net with only one connection. It will also give you a warning if you have drawn a net to a component but the net and the component haven’t connected. To get the ERC to work as intended, you have to mark all the unused pins with a Not-connected flag, found to the right.
- 1. ”Perform electrical rules check” button (Ladybug button). - 1. ”Perform electrical rules check” button (Ladybug button).
- 2. Do a ERC. - 2. Do a ERC.
- 3. Fix errors.4. - 3. Fix errors.
- 4. Repeat point 1 until errors == 0 && warnings == 3. The GND net is not connected to a Power output, the 5 voltage neither and the capacitor connected to VCAP1 is not connected to a power output. - 4. Repeat point 1 until errors == 0 && warnings == 3. The GND net is not connected to a Power output, the 5 voltage neither and the capacitor connected to VCAP1 is not connected to a power output.
## First Submission ## First Submission
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment