2017-12-01から1ヶ月間の記事一覧

AXI Timerを2個使うテスト

ブロックダイアグラム Timer1のみのコード #include <stdio.h> #include "platform.h" #include "xil_types.h" #include "xtmrctr.h" #include "xparameters.h" #include "xil_io.h" #include "xil_exception.h" #include "xscugic.h" #include <stdbool.h> XScuGic InterruptCon</stdbool.h></stdio.h>…

Z-turn boardのまとめ

http://dora.bk.tsukuba.ac.jp/~takeuchi/?%E9%9B%BB%E6%B0%97%E5%9B%9E%E8%B7%AF%2Fz-turn%2F%E5%9F%BA%E6%9C%AC%E4%BA%8B%E9%A0%85

RailsでPOSTを受けたコントローラのアクションからJavaScriptを操作する

いつも忘れるのでメモ ハマったのがRailsでのjQueryの使い方 jQueryは標準で有効化されてないんだっけ? jQueryを有効にする Gemfile gem 'jquery-rails'application.js //= require jquery //= require jquery_ujs //= require rails-ujs //= require turbo…

SprinterのHEATER_DUTY_FOR_SETPOINTマクロ

定義 #define HEATER_DUTY_FOR_SETPOINT(setpoint) ((int)((187L*(long)setpoint)>>8)-27) シミュレーション function heater clear; close all; %x=0:65535; x=0:255; y=heater_duty_for_setpoint(x); plot(x,y,'b-'); title('HEATER DUTY FOR SETPOINT'); …

Xilinx SDKでmillis()の実装

https://0xstubs.org/measuring-time-in-a-bare-metal-zynq-application/ #include "xparameters.h" #include "xtime_l.h" uint32_t millis(void) { // unsigned int millis = ~TMR_MILLIS; XTime_GetTime(&tCurrent); u32 micros = 1.0 * (tCurrent) / (COU…

12ビットXADC向けのサーミスタLUTを作成する

createTemperature.pyを使う設定パラメータ r0=100000.0 (100kΩ:25℃でのサーミスタの抵抗値R25) t0=25(基準温度25℃) r1=0.0 (低温時の発熱損失を押さえるための分流抵抗→使用しない) r2=4700.0(4.7kΩ分圧抵抗) beta=4267(サーミスタの定数B:デー…

Sprinterのルックアップテーブルを利用した温度測定の原理

ここに記載がある http://hydraraptor.blogspot.jp/2007/10/measuring-temperature-easy-way.html基本的にはプルアップ抵抗R2だけでいい。R1は温度が低いときに抵抗が大きくなって発熱損失が大きくなるので、それを減らすためにつけてある。 →追記:ジュール…

Sprinterでサーミスタのルックアップテーブルの作成

本家のcreateTemperature.pyには--max-adcを引数として与えられるような記載があるが、オプション解析が実装されていない点に注意(10bitの1023から変更したい時はハードコードする必要あり)./createTemperatureLookup.py --r0=100000 --t0=25 --r1=0 --r2=…

ZYNQでADCの値に応じてPWM出力を調整

制約ファイル set_property IOSTANDARD LVCMOS33 [get_ports vauxn0] set_property IOSTANDARD LVCMOS33 [get_ports vauxp0] set_property IOSTANDARD LVCMOS33 [get_ports vauxn1] set_property IOSTANDARD LVCMOS33 [get_ports vauxp1] set_property IOSTA…

ZynqでPWM

このチュートリアルどおりにやった https://reference.digilentinc.com/learn/programmable-logic/tutorials/zybo-creating-custom-ip-cores/start IPパッケージ https://github.com/shohei/pwm_ip ブロックダイアグラム SDKプログラム #include "xparameter…

Xilinx SDKでdelay()する

usleep()を使う

2種類のXADCへのアクセス

XadcpsかXsysmonか AXIバス経由はXsysmon https://forums.xilinx.com/t5/Xcell-Daily-Blog/Adam-Taylor-s-MicroZed-Chronicles-Part-62-Answers-to-a-question/ba-p/553457 Should we want to interface via the DevC interface, the driver supplied by the…

Arty Z7-20のAnalogピン配置

Arty Z7-20のpmodピン配置

<pin index="11" name ="JA1" iostandard="LVCMOS33" loc="Y18"/> <pin index="12" name ="JA2" iostandard="LVCMOS33" loc="Y19"/> <pin index="13" name ="JA3" iostandard="LVCMOS33" loc="Y16"/> <pin index="14" name ="JA4" iostandard="LVCMOS33" loc="Y17"/> </pin></pin></pin></pin>

RaisでDBを使用しないCSVのアップロード

https://cre8cre8.com/rails/upload-image.htm <%= form_tag '/fileuploads', method: 'post', multipart: true do %> <label>ファイル</label> <%= file_field :fileupload, :file %> <%= submit_tag 'Send file' %> <% end %>

AXI XADCをSDKで使う

ボードはArty Z7-20 Vaux◯とAD◯ピンの対応表 例えばA0ピンにはVaux1が対応するブロックダイアグラム Arty Z7-20 のA0-A5は0.0-3.3Vがシングル入力できるように 分圧抵抗が入れてある。したがって、3.3Vを入れると1.0Vが計測結果となる。 制約ファイル set…

ZYNQのProcessing system IPがNot foundになるとき

特にTclスクリプトでブロックデザインを作成すると、ZYNQ PSが見つからないと言われる。 エラーログ(xapp1182を試した時のもの) [Synth 8-439] module 'xadc_wiz_ps_bd_processing_system7_0_0' not foundZYNQのPS IPが見つからないと言われると結構ビビる。…

AXI XADCを使う(xapp1182)

Zynq AXI XADC App Note http://www.wiki.xilinx.com/Zynq+AXI+XADC+App+Note xapp1182を試す

テストG-Codeを生成するPythonプログラム

import math r = 20 base = 0.5 spd = 4000.0 print("G28") print("G1 Z%f F%f" % (base,spd)) for h in range(20): z = base + h*0.1 for theta in range(360): rad = (theta*math.pi/180.0) x = r*math.cos(rad) y = r*math.sin(rad) print("G1 X%f Y%f Z%…

RepRapでChecksumの計算アルゴリズム

http://reprap.org/wiki/G-code#.2A:_Checksum擬似コード int cs = 0; for(i = 0; cmd[i] != '*' && cmd[i] != NULL; i++) cs = cs ^ cmd[i]; cs &= 0xff; // Defensive programming... テストコード #include <stdio.h> int main(){ int cs = 0; char *cmd = "N380 G</stdio.h>…

姫野ベンチ

http://accc.riken.jp/supercom/himenobmt/download/98-source/ wget http://accc.riken.jp/wp-content/uploads/2015/07/himenobmt.c.zipUbuntu16.04 mimax = 129 mjmax = 65 mkmax = 65 imax = 128 jmax = 64 kmax =64 cpu : 1.343832 sec. Loop executed f…

2to3でPython2コードをPython3コードに変換する

print "" -> print()に変換するのを自動化できて良い https://docs.python.org/2/library/2to3.html

Arty Z7-20でArduino Shield Pin10(IO10)をGPIOとして使う

現在のDigilentのboard_fileでは、IO10はSPIのSS用として使うためのピンとして割り当てられている https://github.com/Digilent/vivado-boards/commit/0f62c91caf77bb50b4a705cd491f19b0442d8ca3 GPIOとして使う時は、board_fileを以下のように修正してやる …

ArtyのシリアルUSBを常にmode 666にする

http://mondayboy.hatenablog.com/entry/2015/05/05/182610 sudo vim /etc/udev/rules.d/53-usb-serial-arty.rules KERNEL=="ttyUSB*", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6010", GROUP="dialout", MODE="0666"sudo /etc/init.d/udev restart

差動増幅回路の解析

以下の回路を解析したい(利得Vo/Viを求めたい) 等価回路は以下だと考えられる (%i4) A : matrix([-R0,0,0,1],[0,-R2,0,-1],[0,0,-R1,1],[1,-1,1,0]); [ - R0 0 0 1 ] [ ] [ 0 - R2 0 - 1 ] (%o4) [ ] [ 0 0 - R1 1 ] [ ] [ 1 - 1 1 0 ]逆行列 invert(A); (…

オペアンプ、反転増幅回路、イマジナリショート

わかりやすいオペアンプの基礎を宇宙一わかりやすく解説してみる http://www.yukisako.xyz/entry/operational-amplifier

同期機の3相交流励磁による合成磁束が円運動を行うことを示すシミュレーション

電動機・発電機の理論 pp.130-131を参考に。 http://energychord.com/children/publications/mg.html function simulator clear; close all; Phi0 = 1; w = 1;%[rad/s] t = linspace(0,20,100); PhiU = Phi0 * cos(w * t); PhiV = Phi0 * cos(w * t - 2*pi/3…

マクスウェル方程式

\nabla \cdot \vec B &= 0 \\ \nabla \times \vec E &= - \frac{\partial}{\partial t} \vec B \\ \nabla \cdot \vec D &= \rho \\ \nabla \times \vec H &= \vec J + \frac{\partial}{\partial t}\vec D 磁束保存の法則 ファラデーの法則 ガウスの法則 アン…

Minicomでlocal echoをONにする

Ctrl-A, Ctrl-EでLocal echoをONにできる https://www.linuxquestions.org/questions/linux-software-2/not-able-to-type-anything-in-minicom-main-screen-384637/

ArduZynqで使えるzynqのBSPライブラリ

https://github.com/shohei/arduino-bsp-library 上の動画で間違えた所 →TemplateをCで指定してしまった →Project templateはC++で作成する必要がある(上の動画の例だと、Cで作ってしまったのでヘッダファイルArduino.hをインクルードしないと、C/C++のMake…