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

Target

Select target project
  • pmrust/pmrust.pages.upb.ro
  • genan.omer/pmrust.pages.upb.ro
  • vladut.chintoiu/pmrust.pages.upb.ro
  • petru.nania/website-pmrust-fork
  • sofia.huzan/pmrust.pages.upb.ro
  • ionut.pruteanu2308/arcade-game
  • luana.militaru/pong-game
  • sebastian.scrob/project
  • matei.bejinaru/website-bejinaru-matei
  • adragomir2806/website-dragomir-alexandru
  • fatemehsadat/pmrust.pages.upb.ro
  • razvan.costea2205/pmrust.pages.upb.ro
  • darius_gabriel.iuga/pm-website
  • andrei.neagu1910/pmrust.pages.upb.ro
  • irina.chiorean/pmrust.pages.upb.ro
  • adrian_costin.lungu/pmrust.pages.upb.ro
  • andrei.salavastru/pmrust.pages.upb.ro
  • maria_elena.tudor/pmrust.pages.upb.ro
  • vlad.preda2503/electric-piano
  • delia_alexa.dragan/website-music-player
  • francisc.niss/automatic-guitar-tuner
  • mihnea.sandulache/pmrust.pages.upb.ro
  • dragos_andrei.rosu/pmrust.pages.upb.ro
  • armin.shafiei/the-tone-corrector
  • vladyslav.kiselar/pmrust.pages.upb.ro
  • carla_maria.rusu/pmrust.pages.upb.ro
  • razvan.beldie/pmrust.pages.upb.ro
  • lavinia.tudor0603/pmrust.pages.upb.ro
  • nicoleta.bumbacea/door-security-system
  • stefan_adrian.brai/proiect-pm
30 results
Show changes
Showing
with 9512 additions and 66 deletions
......@@ -2,15 +2,6 @@ import { defineMermaidSetup } from '@slidev/types'
export default defineMermaidSetup(() => {
return {
// theme: 'forest',
sequence: {
diagramMarginX: 30,
diagramMarginY: 10,
boxTextMargin: 5,
noteMargin: 10,
messageMargin: 3,
mirrorActors: true,
height: 50
}
theme: 'forest',
}
})
......@@ -5,50 +5,38 @@ class: text-center
highlighter: shiki
lineNumbers: true
info: |
## I2C & USB 2.0
## Exceptions and Interrupts
drawings:
persist: false
defaults:
foo: true
transition: slide-left
title: MA - 07 - I2C & USB 2.0
title: MA - 03 - Exceptions and Interrupts
mdc: true
layout: cover
themeConfig:
primary: '#0060df'
download: true
exportFilename: ma-07
exportFilename: ma-03
background:
---
# I2C & USB 2.0
Lecture 7
# Exceptions and Interrupts
Lecture 3
---
# I2C & USB 2.0
# Exceptions and Interrupts
used by RP2040
- Buses
- Inter-Integrated Circuit
- Universal Serial Bus v2.0
- Exceptions
- Interrupts
- Boot
<!-- I2C -->
<!-- Exceptions -->
---
src: ../../resources/i2c/slides.md
---
<!-- USB -->
---
src: ../../resources/usb/slides.md
---
<!-- Sensors -->
---
src: ../../resources/sensors_i2c/slides.md
src: ../../resources/exceptions/slides.md
---
---
......@@ -56,6 +44,6 @@ src: ../../resources/sensors_i2c/slides.md
# Conclusion
we talked about
- Buses
- Inter-Integrated Circuit
- Universal Serial Bus v2.0
- Exceptions
- Interrupts
- How the RP2040 boots and loads the software
......@@ -5,16 +5,16 @@ layout: section
Analog to Digital Converter
---
---
# Bibliography
for this section
**Raspberry Pi Ltd**, *[RP2040 Datasheet](https://datasheets.raspberrypi.com/rp2040/rp2040-datasheet.pdf)*
- Chapter 4 - *Peripherals*
- Chapter 4.9 - *ADC and Temperature Sensor*
- Subchapter 4.9.1
- Subchapter 4.9.2
- Subchapter 4.9.5
- Chapter 12 - *Peripherals*
- Section 12.4 - *ADC and Temperature Sensor*
- Subchapter 12.4.2
- Subchapter 12.4.3
- Subchapter 12.4.6
---
layout: two-cols
......@@ -46,7 +46,7 @@ Lower sample rates yield the *aliasing effect*.
</div>
---
---
# Nyquist–Shannon Sampling Theorem
<div grid="~ cols-2 gap-5">
......@@ -54,7 +54,7 @@ Lower sample rates yield the *aliasing effect*.
<div>
$$
sampling_f >= 2 \times max_{f}
sampling_f > 2 \times max_{f}
$$
*The **sampling frequency** has to be at least **two times higher** than the **maximum frequency** of the signal* to avoid frequency aliasing[^aliasing].
......@@ -72,6 +72,7 @@ $$
---
layout: two-cols
---
# Sampling
how the ADC works
......@@ -94,13 +95,13 @@ how the ADC works
</div>
There are different [types of ADCs](https://www.monolithicpower.com/en/analog-to-digital-converters/introduction-to-adcs/types-of-adcs) depending on the architecture.
The most common used is SAR ([*Successive Approximation Register*](https://en.wikipedia.org/wiki/Successive-approximation_ADC)) ADC, also integrated in RP2040.
The most common used is SAR ([*Successive Approximation Register*](https://en.wikipedia.org/wiki/Successive-approximation_ADC)) ADC, also integrated in RP2350.
---
layout: two-cols
---
# RP2040's ADC
# RP2350's ADC
<style>
.two-columns {
......@@ -110,13 +111,13 @@ layout: two-cols
| | |
|-|-|
| *channels* | 5 |
| *channels* | 4 or 8[^package] |
| *sampling rate* | 500 kHz |
| *resolution* | 12 bits |
| *V<sub>max</sub>* | 3.3 V |
- requires a 48 MHz clock signal
- channel 4 is connected to the internal temperature sensor
- channel 4 or 8[^package] is connected to the internal temperature sensor
$$
......@@ -131,16 +132,17 @@ $$
</div>
<div align="center">
<img src="../rp2040/rp2040_adafruit_pinout.png" class="rounded w-80">
<img src="../rp2350/pico2w-pinout.svg" class="rounded w-80">
</div>
[^package]: Depends on the RP2350 package
---
---
# ADC
in Embassy
```rust{all|1|3-5|7|8|10|13-14|15|15,16|17|12,13,15,17,18}
```rust{1|3-5|7|8|10|13-14|15|15,16|17|12,13,15,17,18|all}
use embassy_rp::adc::{Adc, Channel, Config, InterruptHandler};
bind_interrupts!(struct Irqs {
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
slides/lectures/resources/interrupts/rp2350_interrupts_1.png

120 KiB

---
layout: section
---
# Exceptions
for the ARM Cortex-M33 processor
---
---
# Bibliography
for this section
**Joseph Yiu**, *The Definitive Guide to ARM® Cortex®-M23 and Cortex-M33 Processors*
- Chapter 4 - *Architecture*
- Section 4.5 - *Exceptions and Interrupts*
- Subsection 4.4.1 - *What are exceptions*
- Chapter 8 - *Exceptions and Interrupts*
- Section 8.1 - *What are Exceptions and Interrupts*
- Section 8.2 - *Exception types+*
---
---
# Processor Exceptions
what happens if something does not work as required
![Exceptions](./exceptions.svg)
<!-- Just explain that MCU's have a special table where firmware can register functions that
the processor calls in case of several events. -->
---
---
# Standard ARM Cortex-M Exceptions
what happens if something does not work as required
![Exceptions](./cortex-m.svg)
---
---
# ARM Cortex-M Interrupts
some hardware device notifies the MCU
<div align="center">
<img src="./cortex-m-nvic.svg" class="rounded w-170">
</div>
<!-- Interrupts are exceptions that are usually triggered by hardware when
it needs attention.-->
---
---
# Exceptions and Interrupts in Embassy
- Embassy registers handlers for Exceptions
- Each of the Embassy drivers that you use provides interrupt handlers for the
peripheral they control
- Developers have to **bind** interrupts to the driver.
![RP2350 Interrupts 1](./rp2350_interrupts_1.png)
List of some of the RP2350's interrupts
<div grid="~ cols-2 gap-3">
<div>
Register the Interrupt
```rust {*}{lines: false}
bind_interrupts!(struct Irqs {
ADC_IRQ_FIFO => InterruptHandler;
});
```
</div>
<div>
Bind it to the driver
```rust {*}{lines: false}
let mut adc = Adc::new(p.ADC, Irqs, Config::default());
```
</div>
</div>
slides/lectures/resources/pwm/pwm_rp2040_pins.png

98 KiB

slides/lectures/resources/pwm/pwm_rp2040_registers.png

112 KiB

slides/lectures/resources/pwm/pwm_rp2350_pins.png

116 KiB

slides/lectures/resources/pwm/pwm_rp2350_registers.png

142 KiB

......@@ -5,13 +5,13 @@ layout: section
Pulse Width Modulation
---
---
# Bibliography
for this section
1. **Raspberry Pi Ltd**, *[RP2040 Datasheet](https://datasheets.raspberrypi.com/rp2040/rp2040-datasheet.pdf)*
- Chapter 4 - *Peripherals*
- Chapter 4.5 - *PWM*
1. **Raspberry Pi Ltd**, *[RP2350 Datasheet](https://datasheets.raspberrypi.com/rp2350/rp2350-datasheet.pdf)*
- Chapter 12 - *Peripherals*
- Section 12.5 - *PWM*
2. **Paul Denisowski**, *[Understanding PWM](https://www.youtube.com/watch?v=nXFoVSN3u-E)*
......@@ -83,28 +83,44 @@ $$
<img src="./pwm.svg" class="rounded w-150">
</div>
---
---
# Usage examples
<div grid="~ cols-2 gap-6">
<div>
- dimming an LED
<img src="./pwm_led.gif" class="rounded w-90">
</div>
<div>
- controlling motors
- controlling the angle of a stepper motor
- controlling the RPM of a motor
<img src="./pwm_voltage.gif" class="rounded w-90">
</div>
</div>
---
layout: two-cols
---
# RP2040's PWM
# RP2350's PWM
- generates square signals
- counts the pulse width of input signals
- 8 PWM units, each with 2 channels (A and B)
- each PWM channel is connected to a certain pin
- 8 or 12[^package] PWM slices, each A and B channels
- each PWM channel is linked to a fixed pin
- some channels are connected to two pins
- may be used as timers (`IRQ1_INTE`)
## Registers
......@@ -115,7 +131,7 @@ layout: two-cols
</style>
<div align="center">
<img src="./pwm_rp2040_registers.png" class="rounded w-150">
<img src="./pwm_rp2350_registers.png" class="rounded w-150">
</div>
:: right ::
......@@ -125,17 +141,19 @@ layout: two-cols
</div>
<div align="center">
<img src="./pwm_rp2040_pins.png" class="rounded w-150">
<img src="./pwm_rp2350_pins.png" class="rounded w-150">
</div>
<div align="center">
<img src="../rp2040//rp2040_adafruit_pinout.png" class="rounded w-70">
<img src="../rp2350/pico2w-pinout.svg" class="rounded w-70">
</div>
[^package]: Depends on the RP2350 package
---
# RP2040's PWM Modes
# RP2350's PWM Modes
<div grid="~ cols-2 gap-5">
......@@ -163,14 +181,14 @@ f = \frac{f_{sys}}{period} [Hz]_{SI}
$$
---
layout: two-cols
---
# Example
using Embassy
```rust{all|1|3|5|5,6|5,6,7|9-13|16|17|18,19|15,18,19,20}
```rust{1|3|5|5,6|5,6,7|9-13|16|17|18,19|15,18,19,20|all}
use embassy_rp::pwm::{Config, Pwm};
let p = embassy_rp::init(Default::default());
......
This diff is collapsed.
......@@ -53,7 +53,7 @@ Signal that what we actually generate
</div>
> Why we sill use it? Because after passing through an IC or a gate inside an IC - the signal si "rebuilt" and if the "digital discipline" described in the following is respected - we can preserve the information after numerous "passes". Thus, each element can behave with a large margin for error, yet the final result is correct.
> Why we still use it? Because after passing through an IC or a gate inside an IC - the signal is "rebuilt" and if the "digital discipline" described in the following is respected - we can preserve the information after numerous "passes". Thus, each element can behave with a large margin for error, yet the final result is correct.
---
---
......
slides/lectures/resources/timers/clocks.png

238 KiB

slides/lectures/resources/timers/rp2350_clocks.png

241 KiB