LoginSignup
0
1

More than 3 years have passed since last update.

PYNQ > [parthpower / axi_uartlite_pynq] @GitHub を試す > Analog Discovery 2で確認 (3.3V TTLレベル) + Block Design

Last updated at Posted at 2020-08-13
動作環境
Windows 10 Pro (v1909) 
PYNQ-Z1 (Digilent) (以下、PYNQと表記)
PYNQ v2.5 Image
Vivado v2019.1 (64-bit)
Analog Discovery 2 (以下、AD2)

概要

  • GitHubで公開されているAXI UART liteのbistreamとPythonスクリプトを試す
  • AD2でロジック電圧を確認
  • AD2でロジックをキャプチャ

PMOD

PMODのピン配置は下記を参考にした。

pmod_pins.jpg

GitHubコード

以下のファイルとフォルダを使った。srcにはPythonで定義したクラスがある。

  • uartlitetest.tcl
  • uartlitetest.bit
  • src/

接続

  • PMOD A:0 (RX)
  • PMOD A:1 (TX)

これはGitHubのコードによって決まっている。

Jupyter Notebook

from pynq import Overlay

ol = Overlay("/home/xilinx/jupyter_notebooks/base/uartlitetest.bit")
ol.download()
from pynq import MMIO
from pynq import Overlay

import sys
sys.path.insert(1, 'base/src_AXI_UART_LITE_200813')
from uartlite import *
# Address of the ip core
ADDRESS = 0x42c00000  
uart = UartAXI(ADDRESS)

# Setup AXI UART register
uart.setupCtrlReg()
import time

for idx in range(10):
    print(idx)
    uart.write('hello world\n')
    sleep(1)
結果
0
1
2
3
4
5
6
7
8
9

1秒ごとに出力されるので、その間にAD2でUART送信を確認する。

AD2 > Scope

AD2でScopeを用いて電圧を見た。
3.3V TTLレベルで動作している。

コメント 2020-08-13 091002.png

AD2 > Logic

AD2でLogicを用いて送信された文字をモニタした。

e585c51f4ea9a6d2.png

hello world<LF>が送信されていることを確認できた。

関連

Block Design

GitHubのtclファイルをsourceコマンド読み自動生成されたBlock DesignはPYNQ-Z2用なのか、bitstream生成時に失敗する(tclはVivado v2019.2用だった)

[Board 49-71] The board_part definition was not found for tul.com.tw:pynq-z2:part0:1.0. The project's board_part property was not set, but the project's part property was set to xc7z020clg400-1. Valid board_part values can be retrieved with the 'get_board_parts' Tcl command. Check if board.repoPaths parameter is set and the board_part is installed from the tcl app store.

代わりに一からBlock Designを生成した (Vivado v2019.1使用)。

  1. PYNQ-Z1のプリセットをロード
  2. UART 0の制約ファイルを下記のようにする (PMOD Aの0,1を設定)

で動いた。

制約ファイル(xdc)
set_property IOSTANDARD LVCMOS33 [get_ports rx]
set_property IOSTANDARD LVCMOS33 [get_ports tx]

set_property PACKAGE_PIN Y18 [get_ports rx]
set_property PACKAGE_PIN Y19 [get_ports tx]

Block Designは下記となっている。

コメント 2020-08-13 102356.png

UARTのアドレスはデフォルトのままとした (0x42c00000)。

コメント 2020-08-13 102852.png

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1