Siddmathur14 / ese5190-2022-lab2-into-the-void-star

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

University of Pennsylvania, ESE 5190: Intro to Embedded Systems, Lab 2A

SIDDHANT MATHUR
www.linkedin.com/in/siddhantmathur14
Tested on: HP PAVILION X360, WINDOWS 10 (WSL)

3 TALKING LEDs

3.2 PIO

Q) Why is bit-banging impractical on your laptop, despite it having a much faster processor than the RP2040?

  • PC-class processors keep hundreds of instructions in-flight on a single core at once, which has drawbacks when trying to switch rapidly between hard real time tasks. Thus, bit - banging is impractical on a laptop despite it having much higher processor speeds.

Q) What are some cases where directly using the GPIO might be a better choice than using the PIO hardware?

  • A PIO state machine gets a lot more done in one cycle than a Cortex-M0+ when it comes to I/O: for example, sampling a GPIO value, toggling a clock signal and pushing to a FIFO all in one cycle, every cycle. However , a PIO state machine is not remotely capable of running general purpose software.

Q)How do you get data into a PIO state machine?

  • The state machine needs to be told which GPIO to output to depending on which pin group would be used ( out pin in this case) . Also , the GPIO needs to be told that the PIO is in control of it. Lastly , make sure that the PIO is driving the output enable line high.

Q)How do you get data out of a PIO state machine?

  • The RP2040 has two PIO blocks, each of them with four state machines. Each PIO block has a 32-slot instruction memory which is visible to the four state machines in the block. We need to load our program into this instruction memory before any of our state machines can run the program. Once the program is loaded, we find a free state machine and tell it to run our program.

Q) How do you program a PIO state machine?

  • Programming a PIO state machine requires pushing data into the TX FIFO from which it will be transmitted to the state machine and then executed.

Q) In the example, which low-level C SDK function is directly responsible for telling the PIO to set the LED to a new color? How is this function accessed from the main “application” code?

  • The function pio_sm_put_blocking() writes data to the TX FIFO queue and blocks it if it is full.

Q)What role does the pioasm “assembler” play in the example, and how does this interact with CMake?

  • The assmebler compiles Assembly code into a human readable format. CMake function pico_generate_pio_header(TARGET PIO_FILE) invokes pioasm automatically and adding the generated header to the include path of the target TARGET.

3.3 FOLLOW THE FLOW

ANNOTATIONS FOR ws2812.c

  • The code for ws2812.c has been annotated with comments.

embedded_c1

embedded_c2

embedded_c3

embedded_c4

embedded_c5

ANNOTATIONS FOR ws2812.pio.h

  • The code for ws2812.pio.h has been annotated with comments.

embedded_h1

embedded_h2

embedded_h3

embedded_h4

embedded_h5

3.4 COLOR BY NUMBER

The Excel file containing all the register values can be accessed through the given link: Excel link

3.5 MODELING TIME

WhatsApp Image 2022-10-18 at 03 12 39

3.6 & 3.7 ZOOMING IN AND TIMING DIAGRAM

The Excel File contains timing data for packet transfer to the ws2812 module :Excel Link

4 HELLO BLINKENLIGHT

Hello_blinken_light.mp4

About

License:MIT License


Languages

Language:C 72.4%Language:CMake 23.1%Language:Python 4.4%