BOOST ブレークアウト ボード パッケージに Texas Instruments DAC8568 があります。DAC8568 は、SPI インターフェイスを備えた 8 チャネル、16 ビット DAC です。BOOST パッケージには、ラズベリー パイに接続するためのヘッダーがあり、出力電圧に接続された LED があるため、コードが思ったとおりに動作しているかどうかを簡単に確認できます。DAC8568 の BOOST パッケージとデータシートへのリンクは、以下の Python コードにあります。
I have the package wired to the raspberry Pi with the 3.3V supply, the 5V supply (needed for LEDs), and ground. The DACs SCLK goes to Pi SCLK, DAC /SYNC (which is really chip select) goes to Pi CE1, DAC /LDAC goes to Pi Gnd, and DAC MOSI goes to Pi MOSI. I do not wire the DACs /CLR, but I can physically hook it to ground to reset the chip if I need to.
I believe my wiring is good, because I can light the LEDs with either a python script or from the terminal using: sudo echo -ne "\xXX\xXX\xXX\xXX" > /dev/spidev0.1
I learned the terminal trick from this video: https://www.youtube.com/watch?v=iwzXh2V1SP4
私の問題は、データシートによると、LEDが期待どおりに点灯していないことです. A を照らすべきなのに、B を照らす。B を照らすべきなのに、代わりに D を照らす。などなどデータシートに従って動作することを本当に期待しています。
以下は私のpythonスクリプトです。コメントで、送信するビットを探しているデータシートの場所について言及しました。私はアナログ コンポーネントの操作に非常に慣れておらず、EE ではないため、タイミングを正しく行っていないか、その他のばかげたエラーを犯している可能性があります。おそらく、誰かが実際にチップを手にしなくても、データシートを見て私のエラーを見ることができます。助けてくれてありがとう!
# -*- coding: utf-8 -*-
"""
Created on Sat Jul 8 16:33:05 2017
@author: pi
for texas instruments BOOST DAC8568
for BOOST schematic showing LEDs http://www.ti.com/tool/boost-dac8568
for DAC8568 datasheet: http://www.ti.com/product/dac8568
"""
import spidev
import time
spi = spidev.SpiDev() #create spi object
spi.open(0,1) #open spi port 0, device (CS) 1
#spi.bits_per_word = 8 does not seem to matter
#spi.max_speed_hz = 50000000 #does not seem to matter
#you have to power the DAC, you can write to the buffer and later power on if you like
power_up = spi.xfer2([0x04, 0x00, 0x00, 0xFF]) #p.37 Table11 in datasheet: powers all DACS
voltage_write = spi.xfer2([0x00, 0x0F, 0xFF, 0xFF ]) #p.35 Table11 in datasheet supposed write A--but lights B
voltage_write = spi.xfer2([0x00, 0x1F, 0xFF, 0xFF ]) #supposed write B--but lights D
voltage_write = spi.xfer2([0x00, 0x2F, 0xFF, 0xFF ]) #supposed write C--but lights F
voltage_write = spi.xfer2([0x00, 0x3F, 0xFF, 0xFF ]) #supposed write D--but lights H
voltage_write = spi.xfer2([0x00, 0x4F, 0xFF, 0xFF ]) #supposed write E--but does nothing
spi.close()
将来の読者のために、電源を入れるには内部リファレンスの電源を入れる必要があることに注意してください。
power_up = spi.xfer2([0x08, 0x00, 0x00, 0xFF]) #(p.37 datasheet