Giter Site home page Giter Site logo

pinterrupt's Introduction

Pinterrupt

Video tutorial/presentation for this project here: https://youtu.be/ikpliEVBN0k

The purpose of this project, developed for the Computer Architectures course (AY 2017/18) at Politecnico di Torino, is to estimate the time delay of an interrupt and its standard deviation, on a Raspberry Pi 3 board PC. The input triggering the interrupt is a square wave, exploiting the GPIO synchronous rising edge event detectors. At each interrupt occurrence, a GPIO pin is toggled. The code is fully bare metal, i.e. with no kernel nor OS. Really, the compiled code is put in place of the kernel, and the CPU loads it in RAM and executes it. This simplification minimizes the load on the processor core, minimizing the delay as well.

Both the input signal and the output are then displayed on the oscilloscope, in order to evaluate the delay and estimate the uncertainty. The result we got is (2.1 +/- 0.3) us. The interrupt is accurately handled for frequencies up to 470 kHZ.

Pin 6 is set as input, by writing on the the Function Select Register the appropriate value. Same for pin 16, which is the output. Then, as we need to capture the rising edge of the input, the "Rising Edge Detect Enable Registers" has been activated for pin 6. The interrupts are generated when the rising edge is detected, and a corresponding pin is set in the "Event Detect Status Register". In the handler, the pin state is checked in order to verify the source of the interrupt, since an additional timer IRQ is present to disturb the processor. Once everything's done, the interrupt is cleared by (re)setting the "Event Detect Status Register". At this point the interrupt can be handled, toggling pin 16. In order to do so, "Pin Level Register" is read and NOTed, then either "Pin Output Clear Register" or "Pin Output Set Register" are accessed, depending on the current value. The two registers allow us modification to the value of the output pin by either pulling it down or up.

A similar procedure is performed for the timer interrupt, on pin 19.

The processor will indefinitely run this piece of code, due to the final [while(1) continue].

WARNING:

  • Broadcom didn't release any datasheet for the Pi3 SoC (BCM2837). You'll have to refer to the BCM2835 datasheet, bearing in mind that the base address for peripherals is 0x3F000000 and NOT 0x7E000000.
  • You need arm-none-eabi toolchain to compile the code.
  • Rename the *.bin file to kernel7.img, otherwise the Pi won't boot it.
  • You also need 'start.elf' and 'bootcode.bin' in the microSD root. Get them from here https://github.com/raspberrypi/firmware/tree/master/boot

CONTACTS

pinterrupt's People

Contributors

enricorov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.