Coder Social home page Coder Social logo

marksbench / mb_psram_64mb_spi_cp Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 9 KB

Very simple CircuitPython module to use a generic 64Mbit SPI PSRAM (ie Adafruit 4677) with a Raspberry Pi Pico (RP2040) or other CircuitPython compatible MCU.

License: MIT License

Python 100.00%
circuitpython circuitpython-library micropython micropython-driver psram

mb_psram_64mb_spi_cp's Introduction

mb_PSRAM_64Mb_SPI_CP

Very simple CircuitPython module/driver for Espressif/Generic 64Mbit SPI PSRAM (Adafruit prdoduct ID: 4677 or similar). Works with RP2040, should work with other CircuitPython boards that have SPI.

This module is intended to make using the PSRAM as simple as possible. It only accepts an address (range 0-8388607) and a value (range 0-255). Values read from the PSRAM are returned as an integer (range 0-255).

Author: [email protected]

Version: 0.1, 2021-06-11

**NOTE(1): There is no guarantee that this software will work in the way you expect (or at all). Use at your own risk.

**NOTE(2): Writing and reading 64Mib over SPI is not fast. If you're concerned about whether your program has crashed out over a long read or write loop, set up some sort of heartbeat - a periodically flashing LED, print statment, etc.

**NOTE(3): As this is PSRAM and not SRAM, do not exceed the maximum operating frequency or access the PSRAM outside its timing parameters as shown in the datasheet, or the PSRAM may not have enough time to do an internal refresh, causing a loss of data.

Prerequisites:

  • RP2040 silicon (tested with Raspberry Pi Pico), should work with other MCUs with hardware or software SPI
  • Tested with CircuitPython 6.2, 6.3, and 7.0.0-alpha.3
  • PSRAM connected to hardware SPI port0 or port1 pins, should also work with SW SPI
  • Dedicated /CS pin (can be any GP pin that's not already being used for SPI). Do not tie /CS to GND - the device requires state changes on /CS to function properly.

Usage:

  • Set up hardware or software SPI. Polarity and phase are both 0.
  • specify /CS pin (can be any GP pin that's not already being used for SPI): cs = GP#
  • Create constructor: thisMemoryChipDeviceName = mb_PSRAM_64Mb_SPI_CP.mb_PSRAM_64Mb_CP(spi, cs)
  • To write a single byte to an address: thisMemoryChipDeviceName.write_byte(address, value)
  • To read a single byte from an address: thisMemoryChipDeviceName.read_byte(address)
  • See mb_PSRAM_64Mb_SPI_CP_example.py

For more information, consult the Raspberry Pi Pico MicroPython SDK documentation at: https://datasheets.raspberrypi.org/pico/raspberry-pi-pico-python-sdk.pdf

and the CircuitPython documentation at: https://circuitpython.org

and the Adafruit 64Mbit PSRAM page and datasheet at: https://www.adafruit.com/product/4677

mb_psram_64mb_spi_cp's People

Contributors

marksbench avatar

Stargazers

 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.