Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • master
1 result

Target

Select target project
  • samgra-7/e7020e_2021_hw
  • pln/e7020e_2021_hw
  • Frappe/e7020e_2021_hw
  • jonjac-6/e7020e_2021_hw
  • kalkyl/e7020e_2021_hw
  • alesun-6/e7020e_2021_hw
  • Klomega/e7020e_2021_hw
  • edwkll-7/e7020e_2021_hw
  • JosefUtbult/e7020e_2021_hw
  • CarlOsterberg/e7020e_2021_hw
  • rognda-6/e7020e_2021_hw
  • albgal-0/e7020e_2021_hw
  • caracn-0/e7020e_2021_hw
  • ka11i0/e7020e_2021_hw
14 results
Select Git revision
  • master
1 result
Show changes
Commits on Source (21)
# For PCBs designed using KiCad: http://www.kicad-pcb.org/
# Format documentation: http://kicad-pcb.org/help/file-formats/
# Temporary files
*.000
*.bak
*.bck
*.kicad_pcb-bak
*.kicad_sch-bak
*.kicad_prl
*.sch-bak
*~
_autosave-*
*.tmp
*-save.pro
*-save.kicad_pcb
fp-info-cache
# Netlist files (exported from Eeschema)
*.net
# Autorouter files (exported from Pcbnew)
*.dsn
*.ses
# Exported BOM files
*.xml
*.csv
\ No newline at end of file
{
"cSpell.ignoreWords": [
"aisler",
"datasheet",
"datasheets",
"leds",
"microcontroller",
"netlist",
"nrst",
"nucleo",
"pinout"
......
# CHANGELOG
2021-01-20, Added `.gitignore`
2021-01-18, Lab1 instructions and CHANGELOG.md
\ No newline at end of file
......@@ -4,28 +4,35 @@ In this course you will use Git extensively. To master Git and/or similar conten
If you are under Linux, you likely have Git installed by default (else use your Linux package manager to install it). If you are under Windows, then look at https://git-scm.com/downloads. If you get stuck, use the Telegram group to ask questions and help each other out.
In general, to pass lab assignments you will:
In general:
- Create a user on https://gitlab.henriktjader.com/
- Fork the lab repository
- Clone your repository to your local machine
- Discussions encouraged (use Telegram/Zoom etc.)
- Labs are done individually, it should be your "original" work
- Create a user on https://gitlab.henriktjader.com/ (if you don't have an account there already)
For each lab:
- Fork the lab repository (if not done already)
- Clone your repository to your local machine (if not done already)
- Solve the lab assignment(s)
- Commit your repository
- Submit link to your repo as a Canvas assignment (you will then be assigned two repos to review)
- Make review as Gitlab Issue(s)
- Submit links to the repos you have reviewed as a Canvas assignment.
- Submit link to your repository as a Canvas assignment (you will then be assigned two repositories to review)
- Make reviews as GitLab Issue(s)
- Submit links to the repositories you have reviewed as a Canvas assignment.
- Attend the reviews/issues you have received
- Submit link to you final repo as a Canvas assignment.
Pay strict attention to the deadlines (the course depends on everyone being on time, to give and get reviews etc.). If you get sick and due to that cannot complete an assignment in time, give us a heads up in Telegram, and we will try to find a solution.
Remember to commit often, this allows you to rollback to previous states. Name your commits so that it reflects the recent changes, then your git log will make much more sense, and will be easier to navigate.
Hint: Remember to commit often, this allows you to rollback to previous states. Name your commits so that it reflects the recent changes, then your git log will make much more sense, and will be easier to navigate.
Hint 2: This repository will be updated throughout the course, so make sure to "pull" the latest version. Check the CHANGELOG.md for update info.
---
## Lab 1 (Schematics)
The main topic of this lab is to give you a good understanding on how to use the information in Datasheets to draw components and connect them in the schematic view. This lab should be done individually.
The main topic of this lab is to give you a good understanding on how to use the information in _datasheets_ to draw components and connect them in the schematic view.
## Task 1
......@@ -52,14 +59,14 @@ Start ”KiCad” and follow the instructions:
### 2) Decoupling Capacitors
To stabilize the voltage at the pins to the MCU, decoupling capacitors are used. When assigning decoupling capacitors for a microcontroller running at 50-100MHz, 100nF ceramic capacitors are usually suitable for each power-pin.
To stabilize the voltage at the power pins on the MCU, decoupling capacitors must be provided. Use at least one small package SMD MLCC capacitor on each of the power supply pins, with a capacitance of at least 100nF.
However, this microcontroller needs additional decoupling capacitors for its internal voltage regulator and analog peripherals, you can find the datasheet by searching on internet (Hint: ”STM32F411 datasheet”).
This microcontroller also needs additional decoupling capacitors for its internal voltage regulator and analog peripherals, you can find the datasheet by searching on internet (Hint: ”STM32F411 datasheet”).
- Open the datasheet and look at the figure in section 6.1.6.
- Add capacitors to the power pins as the figure shows.
(Place component-button, click on sheet, device/C)
- Hoover over the capacitor, press ”V” and give the capacitor its value e.g.,100n.
- Hoover over the capacitor, press ”V” and give the capacitor its value e.g. 100n.
- Connect them to the microcontroller using the ”wire” button. (W key)
You should have at least 8 capacitors connected to the microcontroller.
......@@ -90,12 +97,18 @@ The microcontroller can boot in different modes, similar to how you can enter th
### 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.
- Find the device/Crystal.
- Place it close to `PH0` and `PH1`, pin 5 and 6 (`RCC_OS_CIN` and `RCC_OSC_OUT`).
- Connect the component with wires to the mentioned pins. Value 12MHz.
- 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 16MHz.
- 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
......@@ -115,7 +128,7 @@ One easy way to get power to your project is through USB. It can deliver up to 1
- Add a ”USBOTG” connector to your schematic. Already here you can think about how you should connect your mouse and use a suitable connector (mini, micro or even usb-c).
- Find the USB pinout for your connector.
### 9) 3.3v Power Supply
### 9) 3.3V Power Supply
The MCU wants to be powered from a 3.3V rail. To this end we will use a fixed LDO (low dropout) linear regulator, to convert a 5V input (from the USB connector) to a 3.3V output. We will use the [AP2125N-3.3TRG1](https://www.elfa.se/en/ldo-voltage-regulator-3v-360ma-sot-23-diodes-incorporated-ap2125n-3trg1/p/30041163) for this.
......@@ -137,13 +150,11 @@ For some components (like the PMW3389DM-T3QU) there might not exist a pre-made l
Hint. Never, never ever, change the grid settings when placing the pins in the symbol.
### 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).
### 11) 1.9V Power Supply
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.
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).
The circuit and equation for calculating the resistor values needed to acheive the desired the output voltage (1.9V) can be found in the [datasheet](https://www.elfa.se/Web/Downloads/_t/ds/MIC5235YM5-TR_eng_tds.pdf) for the regulator. Here you will also find information about input- and output capacitor values needed for proper operation.
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. The circuit and equation for calculating the resistor values needed to acheive the desired the output voltage (1.9V) can be found in the [datasheet](https://www.elfa.se/Web/Downloads/_t/ds/MIC5235YM5-TR_eng_tds.pdf) for the regulator. Here you will also find information about input- and output capacitor values needed for proper operation.
Once you have added the 1.9v power supply you can add a new power net, and connect that to your PMW3389 component.
......@@ -153,7 +164,9 @@ Now add a reset button. Suitable value for capacitor is found in the MCU data sh
### 13) Power LEDs and test points
In order to see that your system is correctly powered, it is common to add test points for easy probing. It is also recommended you add LEDs to your power rails so you can see they're powered up correctly. You can use an LED such as [](https://www.elfa.se/en/smd-led-645nm-0805-65cd-30ma-kingbright-kptd-2012surck/p/30118951), together with a suitable current limiting resistor. Aim for a forward current of about 2mA. You can use this [LED calculator](https://ohmslawcalculator.com/led-resistor-calculator) to calculate suitable resistor values for your LEDs. Use resistor values from the E12 series.
In order to see that your system is correctly powered and to have easy access to probing your signal lines etc, it is recommended to add test points to your board in form of exposed pads. Preferably use a pin header footprint for your GND test points however, so you can clip the scope probe's GND alligator clip to it. Provide at least one GND test point for each subcircuit block on your boards. You don't need to stuff them with pins by default during assembly, but it is nice to have the option to add those in when troubleshooting.
It is also recommended you add LEDs to your power rails so you can see they're powered up correctly. You can use an LED such as [this red one](https://www.elfa.se/en/smd-led-645nm-0805-65cd-30ma-kingbright-kptd-2012surck/p/30118951), together with a suitable current limiting resistor. The forward voltage drop of a red LED is around 1.8V, aim for a forward current of about 2mA. You can use this [LED calculator](https://ohmslawcalculator.com/led-resistor-calculator) to calculate suitable resistor values for your LEDs. Use resistor values from the E12 series.
### 14) SPI
......@@ -167,7 +180,7 @@ In order to allocate pins to peripherals there is a nice tool [STM32CubeMX](http
// sck - pb10,
// miso - pc2,
// mosi - pc3,
// ncs - pb4,
// ncs - pb12,
```
Decide on which pins you want to use, and connect the PMW3389 to your MCU. You can connect the `Motion` signal to a free GPIO (its used to generate an interrupt when the sensor detects a motion event, for allowing wake from sleep mode). Likely you don't need this but you can add it in any case.
......@@ -190,17 +203,18 @@ It is very important that the pin numbering on your component is correct to the
- Repeat for the crystal and SWD connector.
- MCU = HousingsQFP:LQFP-6410x10mmPitch0.5mm.
- USBOTG = Connect:USBMini-B (or to your liking)
- For the PMW3389 we will make a custom footprint later, so leave this one unassigned for now.
- Don’t forget to save!
Hint: Check that the numbering of the pins are correct! Hint 2: When you are working with your project later, you will probably not find all footprints in the standard library. There are good tutorials on youtube on how to draw your ownfootprints.
### 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).
- 2. Do a ERC.
- 3. Fix errors.4.
- 2. Do an ERC.
- 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.
## First Submission
......@@ -222,3 +236,132 @@ In Canvas look for Lab1-Review, and submit links to the repositories you have re
Address the raised issues, and commit your fixes. This is an iterative process, where you help each other coming up with a working solution by leading questions, hints etc. (Just giving the answer directly is not particularly fruitful, its a learning process right.)
Once you have addressed all issues, look in Canvas for Lab1-Final, and submit a link to your repository.
---
## Lab 2 (Layout)
The main topic of this lab is to give you a good understanding on how to place the components on the Printed Circuit Board (PCB) and route the traces.
## Task 2
Read the whole lab instruction before you start.
## 1) Creating a foot-print for the PMW3389DM
Most components come with a ready made KiCad footprint (in either the stock libraries or some 3rd party library, e.g. [snapeda](https://www.snapeda.com)). However, for the PMW3389DM you need to create your own. Check in the [data-sheet](https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&ved=2ahUKEwiHvuC1trXuAhXFk4sKHfqDA-cQFjAAegQIARAC&url=https%3A%2F%2Fwww.pixart.com%2F_getfs.php%3Ftb%3Dproduct%26id%3D4%26fs%3Dck2_fs_cn&usg=AOvVaw1A1rR533Pt-7EgnVSS-_ch), section 2,3 for detailed geometry. Use the footprint editor (`Edit PCB Footprints`) to make a [footprint](https://forum.kicad.info/t/tutorial-how-to-make-a-footprint-in-kicad-5-1-x-from-scratch/11092).
Set the grid to fit the spacing between the pins (1.78mm/0.070 inch) between pins, so a grid at 0.035 inch works. Notice, the sensor uses a skewed non standard offset between the rows (offset by 0.89mm/0.035 inch). Spacing between rows are 14.48mm/0.570 inch (unfortunately this won't match the grid though).
Once you have made the footprint save it and go back to the schematic and associate the PMW3389 to your newly made footprint.
## 2) Design rules
You will now create a layout for your project. This is where you physically place the components on the PCB and draw the copper traces to connect the components. Before you start placing the components you have to setup some "design rules" for the layout so the manufacturer can make the PCB.
We use Aisler, and their 2-layer "Beautiful Boards" with [specs](https://aisler.net/help/design-rules-and-specifications/specifications). Aisler directly accepts KiCad designs, which is great as we don't need to worry about exporting to other formats (such as Gerber). Moreover, there are ready made templates for setting up your KiCad project to fit their manufacturing process, [KiCad-Templates](https://github.com/sethhillbrand/kicad_templates).
KiCad uses text files both for storing configuration parameters and your actual design. (Normally its a bad idea to fiddle with machine generated files manually, but they are actually quite readable and fairly easy to understand/navigate.)
- Start KiCad and open your project.
- Open the schematic of the project and generate a netlist-file, see buttons at the top.
- Click on the button ”Run Pcbnew to layout printed circuit board”, (see buttons at the top).
- Make sure that the grid is set to ”mm” and change the grid size to 1,0mm.
- Click on the Read netlist button and select your newly generated netlist-file, click Read Current Netlist.
- Click on the menu File/Board Setup/Design Rules, you should set:
| Requirement | Value |
| -------------------- | ------- |
| Minimum track width | 0,2mm |
| Minimum via diameter | 0,4mm |
| Minimum via drill | 0,3mm |
| Minimum hole to hole | 0,25 mm |
(We don't use micro vias in our designs.)
- Under "Net Classes" we add a new class. Click on the ”Add” button to add a classes named Power, and set the track width to 0,5mm. We want this net to handle more current, hence we use a wider trace.
- Transfer GND, 1.9V, 3.3V and 5V to the (new) Power net class. Now you can close the Board Setup (and return to it later if you want to change some setting).
## 3) Place you components
- Select the layer `Edge.Cuts`, found to the right, and draw a rectangle 60mm x 40mm.
The 60mm x 40mm rectangle is your workspace for this lab. When you are working with your project you need to adopt it to fit into your mouse shell.
You will see that after reading in the netlist, your components are just lumped together so you will need to place your components in the yellow square that you crated earlier.
Rotate and move around the components and try to minimize
the crossed paths of the un-routed lines (gray lines). All components should fit inside the 60mm x 40mm rectangle.
Common practice for placing your components:
- Overall layout: Where you want your connectors, buttons etc. dictates the layout. For now, the USB and PWM3389 is important, later buttons/wheels, additional LEDs etc. need to be carefully considered. Check, e.g., how mice sensors are typically placed relative to the center/hand placement.
- Components are typically designed with layout in mind, consider the orientation/placement to reduce routing complexity. (E.g., inputs are grouped on one edge, outputs on another, analog pins on a third etc., to facilitate the routing and improve signal integrity.)
- Most datasheets will give an example layout for decoupling and interconnects, these are helpful to give an initial idea.
- Place your MCU and it’s decoupling capacitors first. The decoupling capacitors should always be near it’s pins, this is needed to eliminate power-noise to the MCU.
- Place other noise sensitive components, then finally the rest of the components.
Hint! You can uncheck unnecessary layers and just keep ”F/B.Cu”, ”F/B.SilkS” and Edge.Cuts. If you have the schematic window zoomed in next to the layout window, you can see which component you have selected and it will make it easier to know which is what.
## 4) Route the traces
You will now draw where the copper should be placed, red means top layer and green means bottom layer.
- Change the grid size to 0,1mm.
- Click on the button ”Route tracks”.
- Click on a pad you could like to connect, press ”V” if you need to do a via, route your way to the another pad.
- Do this for all gray lines. (Unconnected == 0)
Hint! While having the routing tool selected, right click/Routing options... and change between Shove and Walk around.
No more gray lines?
- Select front copper layer.
- Draw a filled zone in the rectangle, Associate it to the GND net.
- Do the same thing for the back layer.
You have now created two ground planes, one one each side of the PCB. Alternately you may have a power power plane and a ground plane. You may activate to `Show filled areas in zones`, to see where copper will be poured.
Placement and routing is an iterative process, you will likely need to try different options/approaches until you have your final layout.
## 5) Cut-out for the PMW3389DM
The sensor requires a cut-out, look in the data-sheet for exact dimensions. You can use the edge cut layer to make the cut out. Alternatively, you can make the edge cut a part of the footprint (but I have never done that, so not sure how hard it is, [see](https://forum.kicad.info/t/create-a-custom-shape-hole/12646)). A third alternative is to att the cut-out as a user layer in the footprint, just a guideline as to where to cut the PCB (in that case its just informative and does not have any meaning to KiCad.)
Activate to `Show filled areas in zones`, to see verify that you don't pour copper under the the sensor.
## 6) Design Rule Check (DRC)
The Design Rule Check gives you warnings if you don’t comply with the Design rules that you previously setup. It will give you warnings on short circuits, clearance issues etc..
- 1 Click on Tools/DRC, see that the options comply to the manufacturers specification.
- 2 Fix errors.
- 3 Repeat point 1 until errors == 0.
---
## First Submission Lab 2
In Canvas look for Lab2-First Submission, and submit a link to your repo there before the deadline.
## Review Lab 2
You will be assigned two repositories to review. Clone the repositories and compare to your solution.
Check each that each of the 6 steps has been correctly conducted, and comment on possible problems with the layout.
Make an issue in each repository that you review with detailed comments to the author/repo owner. Later follow up on those comments and close them when your issues have been addressed to your satisfaction.
In Canvas look for Lab2-Review, and submit links to the repositories you have reviewed before the corresponding deadline.
## Final Lab 2
Address the raised issues.
Once you have addressed all issues, look in Canvas for Lab2-Final, and submit a link to your repository.
\ No newline at end of file