64Mb PSRAM 的简单驱动
本帖最后由 dcexpert 于 2021-5-27 15:41 编辑<p>64Mbit(8兆字节)的PSRAM让人兴奋,虽然速度不是最快,但是却很有用。</p>
<p> </p>
<p>**** Hidden Message *****</p>
<p> </p>
<p>example.py 显示了如何使用它,只需给它一个地址(范围0-8388607)和一个值(范围0-255),就可以将数据从 bytearray 转换为整数。</p>
<p> </p>
<pre>
<code class="language-python">
"""
mb_PSRAM_64Mb_SPI_example.py
Example MicroPython script for 64Mbit SPI PSRAM with RP2040 (Raspberry Pi Pico)
(Should work with other MicroPython-capable devices with hardware of software SPI)
Author: mark@marksbench.com
Version: 0.1, 2021-05-26
**NOTE: There is no guarantee that this software will work in the way you expect (or at all).
**Use at your own risk.
To use:
- Upload the mb_PSRAM_64Mb_SPI.py file to your board (the same location where your MicroPython scripts
run from, or the /lib folder if applicable).
- Connect the PSRAM to the Pi Pico (RP2040), for testing (and to use this example script
without modification) I suggest the following:
PSRAM | Pi Pico
1(/CE) | GP1 (Pin 2)
2(SO) | GP4, (SPI0 RX, Pin 6)
3(SIO)| NC
4(Vss) | GND, (Pin 38)
5(SI) | GP7, (SPI0 TX, Pin 10)
6(SCK) | GP6, (SPI0 SCK, Pin 9)
7(SIO)| NC
8(Vcc) | 3V3 OUT, (Pin 36)
- To write a value: memory.write_byte(address, value)
- To read a value: value = memory.read_byte(address)
- You should get an error if the address or value is out of range.
"""
from machine import Pin, SPI
import mb_PSRAM_64Mb_SPI
# Set up SPI with the pinout arrangement listed above
spi = SPI(0, sck=Pin(6), mosi=Pin(7), miso=Pin(4), polarity=0, phase=0, baudrate=2000000)
# Set a GP pin to use for /CS
cs = 1
# Create constructor to use driver
memory = mb_PSRAM_64Mb_SPI.mb_PSRAM_64Mb_SPI(spi, cs)
# Simple write test. Writing value of 38 to address 8388607 (highest address of this device)
memory.write_byte(8388607, 38)
# Write value 255 to address 0 (lowest address of the 23LC1024)
memory.write_byte(0, 255)
# Simple read test. Read the value from address 131071 and print it
read_value = memory.read_byte(8388607)
print("Retrieved: ", read_value)
# Now read from address 0 and print it
read_value = memory.read_byte(0)
print("Retrieved: ", read_value)</code></pre>
<p> </p>
<p>这个是用的什么芯片?</p>
<p>一般应用在哪里?</p>
<p>这个好</p>
<p>不错哦,下载下来看看</p>
<p>RP2040就是引脚少了点</p>
回复看看啊 <p>学习学习</p>
<p>看一下</p>
页:
[1]