内容介绍
内容介绍
在研究如何使用RP2040对FPGA进行编程,好处:
- RP2040有USB1.1端口
- RP2040有非常灵活的可编程IO,通过汇编编程,可以实现几乎任何一种端口逻辑
- RP2040一般会搭配比较大的串行Flash,SPI接口,这个可以同时用于存储FPGA的配置文件
- RP2040的MicroPython版本是将RP2040当成大容量存储器来使用,对于所有的操作系统都是免驱动
- 关键RP2040比较便宜,只要1美元的价格,即便搭配Flash也是一种成本非常低廉的解决方案。
先汇总一下目前网上有人尝试的结果:
PCB combining Raspberry Pi Pico and iCE40 FPGA
使用PICO模块对ICE40 HX芯片进行配置
演示程序为ICE40 HX驱动DVI显示器
使用的Python插件:
#!/usr/bin/env python3
# picoprog.py
#
# Copyright (C) 2021 Dan Rodrigues <danrr.gh.oss@gmail.com>
#
# SPDX-License-Identifier: MIT
import sys
import usb.core
import usb.util
# Expecting 1 argument with bitstream to load
if len(sys.argv) != 2:
print("Usage: picoprog.py <bistream>")
sys.exit(0)
# Find Pico programmer device
dev = usb.core.find(idVendor=0x2E8A, idProduct=0x0004)
if dev is None:
raise RuntimeError("Device not found")
cfg = dev.get_active_configuration()
intf = cfg[(2, 0)]
outep = usb.util.find_descriptor(
intf,
# First OUT endpoint
custom_match= \
lambda e: \
usb.util.endpoint_direction(e.bEndpointAddress) == \
usb.util.ENDPOINT_OUT)
inep = usb.util.find_descriptor(
intf,
# First IN endpoint
custom_match= \
lambda e: \
usb.util.endpoint_direction(e.bEndpointAddress) == \
usb.util.ENDPOINT_IN)
assert inep is not None
assert outep is not None
# Load bitstream to send
bitstream_path = sys.argv[1]
bitstream_file = open(bitstream_path, 'rb')
if bitstream_file is None:
raise ValueError("Failed to open bitstream file: {:s}".format(bitstream_path))
bitstream = bitstream_file.read()
bitstream_file.close()
# Send bitstream over USB
ctrl_request_type = 0x40
ctrl_request_prepare = 0x01
ctrl_request_finalize = 0x02
dev.ctrl_transfer(ctrl_request_type, ctrl_request_prepare, 0, 0)
outep.write(bitstream)
dev.ctrl_transfer(ctrl_request_type, ctrl_request_finalize, 0, 0)
第二篇文章:
Raspberry Pico powered Xilinx Virtual Cable - Xilinx JTAG Cable!
下一步尝试在Lattice的FPGA芯片ICE40UP5K和CrossLink-NX上实现一下。
团队介绍
评论
0 / 100
查看更多