1 of 63

MICROCONTROLLER AND ITS APPLICATIONS

2 of 63

3 of 63

  • To explain the architecture of RP2040 chip
  • To outline the features of cortex M0+ chip
  • To explore the peripherals in RP2040

COURSE OBJECTIVES

4 of 63

  • Describe the architecture of RP2040
  • Illustrate the bus fabric and single cycle I/O of RP2040
  • Use appropriate configurations of cortex M0+ in system design
  • Demonstrate the Programmable I/O in system design.
  • Categorize the peripherals for designing a system using RP2040

COURSE OUTCOME

5 of 63

COURSE OUTCOME

6 of 63

COURSE OUTCOME

7 of 63

Hands on!!!

COURSE PLAN

CIAT 1

ASSIGN 1

CIAT 2

ASSIGN 2

8 of 63

Hands on!!!

COURSE PLAN

CIAT 1

ASSIGN 1

CIAT 2

ASSIGN 2

Unit 1,2 and Half in Unit 3

Half in Unit 3, Unit 4 and 5

Simulation and Study

Project and product

9 of 63

COURSE MATERIALS

CIAT 1

ASSIGN 1

CIAT 2

ASSIGN 2

Unit 1,2 and Half in Unit 3

Half in Unit 3, Unit 4 and 5

Simulation and Study

Project and product

10 of 63

Raspberry Pi PICO

11 of 63

12 of 63

Input

Microprocessors

Output

Memory

Microcontroller

13 of 63

14 of 63

15 of 63

Let’s get our basics brushed

What is inside a microprocessor?

Millions of ICs?

What kinda ICs?

Analog IC | Digital IC

What is inside these ICs?

16 of 63

17 of 63

Let’s get our basics brushed

What is inside a microprocessor?

Millions of ICs?

What kinda ICs?

Analog IC | Digital IC

What is inside these ICs?

Transistors

What is inside these transistors?

Diodes? FETs?

18 of 63

What is inside a microprocessor?

Millions of ICs?

What kinda ICs?

Analog IC | Digital IC

What is inside these ICs?

Transistors

What is inside these transistors?

Diodes? FETs?

Let’s get our basics brushed

19 of 63

Let’s get our basics brushed

What is inside a microprocessor?

Millions of ICs?

What kinda ICs?

Analog IC | Digital IC

What is inside these ICs?

Transistors

What is inside these transistors?

Diodes? FETs?

20 of 63

Let’s get our basics brushed

Transistors

21 of 63

Let’s get our basics brushed

Transistors

Are transistors analog or Digital?

22 of 63

Let’s get our basics brushed

Transistors

23 of 63

RTL (Resistor-Transistor Logic)

TTL (Transistor-Transistor Logic)

DTL (Diode-Transistor Logic)

Components

Resistors and BJTs

BJTs for logic functions and amplification

Diodes for input logic, transistors for output amplification

Speed

Relatively slow

Faster than RTL and DTL

Slower than TTL but faster than RTL

Differences in the above two is, one is RTL, another is TTL and then there is also another formation DTL

24 of 63

Analyze

And find the GATE configuration

25 of 63

Analyze

26 of 63

  • Introduction
  • A system overview of the RP2040 chip
  • Pin Descriptions
  • GPIO Functions

27 of 63

Introduction

Introduction

4

0

28 of 63

Summary

Introduction

  • Dual Cortex M0+ processor cores, up to 133MHz
  • 264kB of embedded SRAM in 6 banks
  • 30 multifunction GPIO
  • 6 dedicated IO for SPI Flash (supporting XIP)
  • Dedicated hardware for commonly used peripherals
  • Programmable IO for extended peripheral support
  • 4 channel ADC with internal temperature sensor, 500ksps, 12-bit conversion
  • USB 1.1 Host/Device

16MHz

160MHz

240MHz

29 of 63

  • 30 multifunction GPIO

30 of 63

  • Dual Cortex M0+ processor cores, up to 133MHz

31 of 63

  • 264kB of embedded SRAM in 6 banks

32 of 63

  • 6 dedicated IO for SPI Flash (supporting XIP)

33 of 63

I2C vs SPI vs UART

  • Dedicated hardware for commonly used peripherals

34 of 63

  • Programmable IO for extended peripheral support

35 of 63

  • 4 channel ADC with internal temperature sensor, 500ksps, 12-bit conversion

36 of 63

37 of 63

38 of 63

Was ist das?

Und warum brauchen wir das?

39 of 63

How these registers are used in program?

1

2

3

4

5

A

B

C

XXXX

D

E

40 of 63

How these registers are used in program?

1

2

3

4

5

A

B

C

XXXX

D

E

00

04

08

10

14

A

B

0xd000000

GPIO IN

D

E

41 of 63

How these registers are used in program?

04

0xd000000

31

30

29

28

27

26

25

24

23

22

21

20

19

18

17

16

15

14

13

12

11

10

9

8

7

6

5

4

3

2

1

0

1

0

https://docs.micropython.org/en/latest/rp2/quickref.html

42 of 63

A system overview of the RP2040 chip

43 of 63

RP2040

IO

CLOCK

PERIPHERALS

BUS FABRIC

PROCESSOR

MEMORY

PIO

DMA

44 of 63

IO

CLOCK

PERIPHERALS

BUS FABRIC

PROCESSOR

MEMORY

PIO

DMA

Architecture of RP2040

45 of 63

IO

CLOCK

PERIPHERALS

BUS FABRIC

PROCESSOR

MEMORY

PIO

DMA

RP2040

Crystal is used to generate the clock pulse for the system.

In addition there is clock generation to enable the different clock values. Further PLL is provided to support the operation

46 of 63

RP2040

Access to the internal Serial Wire Debug multi-drop bus. Provides debug access to both processors, and can be used to download code

47 of 63

RP2040

General-purpose digital input and output. RP2040 can connect one of a number of internal peripherals to each GPIO, or control GPIOs directly from software.

26-29 - ADC

48 of 63

RP2040

  • ControlReset : Allows resetting the whole chip or individual peripherals to recover from faults.
  • Power-On State Machine: Initializes clocks and releases resets in sequence during power-up.
  • SYSCTRL: Manages system-level settings like clock sources, dividers, and subsystem enable/disable.
  • SYSINFO: Provides read-only chip identification and hardware information registers.
  • Watchdog: Resets the chip or triggers events if the system stops responding.

49 of 63

QSPI is a high-speed serial interface that uses four data lines to transfer data between a microcontroller and external flash memory.�It enables faster read/write operations than standard SPI, often supporting execute-in-place (XIP) so code can run directly from external flash.

50 of 63

This is the structure which controls the bus over the regions of the system.

51 of 63

RP2040

52 of 63

There are 2 processors which can be interrupted and has connection to SIO

53 of 63

Programmable input and output.

54 of 63

Memories in RP2040

55 of 63

RP2040

56 of 63

Pin Descriptions

Classify and detail the functions of various pins

57 of 63

Pin Descriptions

58 of 63

Pin Descriptions

59 of 63

Pin Descriptions

Name

Description

USB_VDD

Power supply for internal USB Full Speed PHY, nominal voltage 3.3V

ADC_AVDD

Power supply for analogue-to-digital converter, nominal voltage 3.3V

VREG_VIN

Power input for the internal core voltage regulator, nominal voltage 1.8V to 3.3V

VREG_VOUT

Power output for the internal core voltage regulator, nominal voltage 1.1V, 100mA max current

DVDD

Digital core power supply, nominal voltage 1.1V. Can be connected to VREG_VOUT, or to some other board-level power supply.

  • VREG_VIN: Input voltage for the internal voltage regulator circuit.
  • IOVDD: Voltage for the input/output pins used for external interfacing.
  • DVDD: Voltage for the digital core components like the processor and memory.

60 of 63

GPIO Functions

To select the functions, watch this video from 44th minute onwards.

://www.youtube.com/whttpsatch?v=Duel_Oaases&t=745s

https://docs.micropython.org/en/latest/rp2/quickref.html

61 of 63

GPIO Functions

Each individual GPIO pin can be connected to an internal peripheral via the GPIO functions defined below. Some internal peripheral connections appear in multiple places to allow some system level flexibility. SIO, PIO0 and PIO1 can connect to all GPIO pins and are controlled by software (or software controlled state machines) so can be used to implement many functions.

To select the function use func_sel register, see in page236 of the datasheet

Differentiate the General-Purpose Input Output pins in RP2040

62 of 63

#define  LED 1

unsigned int * gpioOut = (unsigned int*)0xd0000010;

void setup() {

  // put your setup code here, to run once:

  pinMode(LED, OUTPUT);

  pinMode(3,OUTPUT);

  pinMode(1,OUTPUT);

  pinMode(0,OUTPUT);

  pinMode(6,OUTPUT);

  pinMode(2,OUTPUT);

  pinMode(5,OUTPUT);

  pinMode(4,OUTPUT);

  pinMode(7,OUTPUT);

}

void loop() {

  *gpioOut = 0b11111111;

  delay(1000); // this speeds up the simulation

  *gpioOut = 0;

  delay(1000);

}

const int numLEDs = 8; // Number of LEDs

const int ledPins[numLEDs] = {0, 1, 2, 3, 4, 5, 6, 7}; // GPIO pins connected to LEDs

void setup() {

  for (int i = 0; i < numLEDs; i++) {

    pinMode(ledPins[i], OUTPUT); // Set LED pins as OUTPUT

  }

}

void loop() {

   for (int i = 0; i < numLEDs; i++) {

    digitalWrite(ledPins[i], HIGH); // Turn on all LEDs simultaneously

  }

  delay(500); // Wait for 500ms

 

  for (int i = 0; i < numLEDs; i++) {

    digitalWrite(ledPins[i], LOW); // Turn off all LEDs simultaneously

  }

  delay(500); // Wait for 500ms

}

63 of 63

https://wokwi.com/projects/372647917103864833

Register based programming to toggle LEDs

https://www.youtube.com/watch?v=Duel_Oaases&t=745s

https://docs.micropython.org/en/latest/rp2/quickref.html