Miten: Bussi Pirate V1, parannettu Universal Serial Interface

Käytämme bussipirataa liittämään uusi siru kirjoittamatta koodia tai luomalla PCB: n. Palautteesi perusteella ja kokemuksemme käyttämällä alkuperäistä väylää merirosvo osoittamaan eri osia, päivitimme suunnittelun uusilla ominaisuuksilla ja edullisemmilla komponenteilla.

Siellä on myös firmware-päivitys sekä väylän merirosvolaitteistoversioista, virheenkorjauksista ja PC: stä näppäimistödekooderiin. Tutustu New Hack A Day Bus Pirate -sivulta ja selaa bussipankkien lähdekoodi Google Code SVN: n arkistossa.

Kannatamme suunnittelun päivitykset ja liitämme digitaalisen analogisen muuntimen alla.

Konseptin yleiskatsaus

Bussipirate aloitti koodin fragmenttien kokoelman, jota käytimme uusien sirujen testaamiseen ilman rajattomat koostumukset. Olemme julkaisseet sen miten ja käytimme sitä osoittavan joukko sarjaliitäntää osat osat. Tämä viesti esittelee päivitetyn suunnittelun uusilla ominaisuuksilla ja joukko parannuksia.

Pinta-asennus

Pull-up vastukset kaikilla linja-linjoilla, joissa on ulkoinen jännitesähde

Ohjelmisto Resetable 3.3volt ja 5Volt Power Supplies

Kaikkien virtalähteiden jännitteen seuranta

Ulkoinen jännitemittauskoe

Halvemmat osat

Laitteisto

Napsauta täysikokoinen kaavamainen kuva (PNG). Piiri ja PCB luodaan Cadsoft Eaglen freeware-versiolla. Kaikki tämän projektin tiedostot sisältyvät artikkelin lopussa olevaan projektin arkistoon.

Mikrokontrolleri

Käytimme microchip PIC24FJ64GA002 28PIN SOIC-mikrokontrolleria (IC1) tässä projektissa. Teho-nastat ovat 0,1UF ohituskondensaattorit maahan (C1,2). 2.5voltin sisäinen säätö vaatii 10UF Tantalan kondensaattorin (C20). Siru on ohjelmoitu viiden PIN-otsikon (ICSP) kautta. MCLR-toiminnolle vaaditaan 2k-vetopään vastus (R1) PIN 1. Lue paljon enemmän tästä sirusta PIC24F-esittelyssä.

RS-232-lähetin-vastaanotin

Taloudellinen MAX3232CSE RS232-lähetinvastaanotin (IC2) Liitä valokuva PC: n sarjaporttiin. Tämä siru korvaa kalliit reiän MAX3223EEP +, jota käytetään bussipiratein edellisessä versiossa. Sarjaliitäntä toimii USB-> Sarja-sovittimen kanssa.

Väyläverkkovastukset

Alkuperäinen väylän merirosvo on 3.3volt-vedonvastukset 2 nastalla, mutta paljon testeistä vaaditaan muita ulkoisia vastuksia. Päivitetyssä rakenteessa on vetovastukset (R20-23) kolmessa pääbussi-signaalilla (data, data, kello) ja siru valitsemalla (CS) -tappi.

Hyppääjien rivi (SV5) yhdistää jokaisen vastuksen VEXXT-päätelaitteen (X4) kautta toimitetulle ulkoisella jännitteellä. Läpäiseviä vastuksia käytetään kuten jumper-johdot, jotta PCB on paljon helpompaa etsiä kotona.

Emme löytäneet hienostunutta tapaa hallita mielivaltaisen jännitteen vetovoiman vastuslajiketta 3.3volt-mikrokontrollerista. Jos sinulla on ideoita, jaa ne kommentteihin.

Virtalähde

VR1 on 3.3volt-tarjonta mikrokontrollerille ja RS232-lähetin-vastaanottimelle. VR2 on 5volt-tarjonta. Molemmat vaativat kahta 0,1UF ohituskondensaattoria (C3-C6). J1 on virtalähteen liitin yhteinen 2,1 mm DC-tynnyritin pistoke. 7-10volts DC on luultavasti optimaalinen virtalähde.

Alkuperäisellä väylän merirosvolla oli kaksi voiman tarvikkeita, 3.3volts ja 5volts, joten paljon ICS: tä voitaisiin liittää ilman ylimääräistä virtalähdettä. Merkittävä haitta oli kytkettyjen pelimerkkien virran palauttamisen puuttuminen. Jos väärinkäytetty IC tarvitsi olla voimankäyttöinen, meidän piti irrottaa lanka. Meillä on niin kulunut tästä rutiinista, jonka lisäsimme ohjelmiston ohjattu nollaus päivitettyyn muotoiluun.

VR3 (3.3voltit) ja VR4 (5VLTS) ovat TI TPS796XX -jännitteen säätimet, joissa on käyttöön kytkin. Korkea taso PIN 1 mahdollistaa säätimen. Vedä alas vastus (R13, R12) varmistaa, että säätimet ovat pois päältä, kun kuva ei ole aktiivisesti aja linjaa, kuten käynnistyksen alustuksen aikana. Datalehdelle määrittää suuren kondensaattorin tuloon (C23, C21) ja lähtö (C24, C22), käytimme samaa 10UF tantalumia kaikkialla. An additional, optional, 0.1uF capacitor (C12,C11) can improve regulation.

The switchable regulators are powered by VR2, a 5volt supply.  We did this because the maximum input for VR3 and VR4 is 6volts, leaving the device with a narrow 5.2-6volt power supply range. VR2 will work well above 10volts, and supplies an appropriate supply for the other regulators.

VR3 (3.3volts) has plenty of headroom to operate from a 5volt supply. VR4 (5volts) will lose about 0.2volts, but 4.8volts remains well within the acceptable range for a lot of 5volt chips. In practice, and under light loads, we see less than 0.1volts drop-out from VR4.

Voltage monitoring

Voltage monitoring is a new feature we’re really ecstatic about. has your project ever mysteriously stopped responding because of an accidental short circuit? The Bus Pirate’s power supplies are equipped with voltage monitoring that can discover a change in power levels.

Each monitored signal is connected to an analog to digital converter (ADC) through a resistor voltage divider. two 10K resistors (R10,R11 above) divide the input voltage in half, making it possible to measure up to 6.6volts with the 3.3volt photo microcontroller.

The Bus Pirate has four voltage monitors. The 3.3volt and 5volt power supplies are monitored, as is the external voltage fed to the pull-up resistors. A fourth monitor is connected to pin 9 of the output header to make a voltage probe.

PCB

Click for a full size placement diagram (PNG). The board is a supposedly single-sided design, we etched ours in the lab on a single-sided photo-resist PCB. At the top, near C13, two jumper wires meet at a single via; we soldered one jumper wire to the other on the back of the board.

Osa lista

Osa
Arvo

IC1
PIC24FJ64GA002 (SOIC)

IC2
MAX3232CSE (SOIC-N)

VR1
LD1117S33 3.3volt regulator (SOT223)

VR2
LD1117s50 5volt regulator (SOT223)

VR3
TPS79633 3.3volt regulator (SOT223-6)

VR4
TPS79650 5volt regulator (SOT223-6)

C1-13
0.1uF capacitor (0805)

C20-24
10uF tantalum capacitor (SMC A)

R1
2000 ohm resistor (0805)

R2,3
390 ohm resistor (0805)

R4-13
10000 ohm resistor (0805)

R20-23
2.2K–10K ohm resistor (through-hole)

LED1,2
LED (0805)

J1
2.1mm power jack

X2,X4
screw clamp (2 terminals) *untested

X3
db9 female serial port connector *untested

ICSP
0.1″ pin header, straight

SV4
0.1″ pin header or shrouded header

SV5
0.1″ pin header, straight

Firmware

The firmware is written in C using the complimentary demonstration version of the photo C30 compiler. learn all about working with this photo in our introduction to the photo 24F series.

The most current firmware is posted on the Hack a Day Bus Pirate page. the current source is in our Google Code SVN repository.

Using it

The diagram above shows the Bus Pirate pinout.

We made a cord with alligator clips on the end, and added labels to each wire so we don’t have to refer to this table whenever we interface a new chip.

If you know of any amazing connectors or cables, please link to them in the comments.

LTC2640 SPI digital to analog voltage converter

The Linear technology LTC2640-LZ8 is an 8bit digital to analog converter (DAC) programmed over SPI. A DAC is essentially a programmable voltage divider. They’re beneficial for recreating waveforms, such as audio signals. An 8bit DAC has 255 even intervals between 0 and the reference voltage, the L part we used has an internal 2.5volt reference.

The LTC2640 only comes in a small SOT223-8 package, so we made a breadboard adapter in the profile of a DIP-8 chip.  Our LTC2640 footprint is included in the project archive attached at the end of this article.

The schematic above shows our test circuit for the LTC2640. It requires a 2.7-5volt power supply, we used the Bus Pirate’s 3.3volt supply. C1 is a bypass capacitor between the power pin and ground. Pin 8 is an active-low reset pin, tie it high for normal operation. Pin 7 is the DAC output, connect the Bus Pirate voltage measurement probe (ADC) here.

Bussipirate
LTC2640 (pin #)

Mosi
SDI (3)

KELLO
SCK (2)

CS
CS/LD (1)

Adc
VOUT (7)

+ 3.3voltit
CLR (8 )

+ 3.3voltit
VDD (5)

Gnd
GND (4)

We connected the Bus Pirate to the LTC2640 as shown in the table. The LTC2640 doesn’t have a data output pin, this SPI connection remains unused.

The Bus Pirate’s hardware SPI library and software RAW3WIRE library are compatible with the LTC2640’s SPI interface. We used the SPI library; if you use the RAW3WIRE library be sure to choose normal pin output.

HiZ>m<–select mode 1. HIZ 2. 1-WIRE 3. UART 4. I2C 5. SPI 6. JTAG 7. RAW2WIRE 8. RAW3WIRE 9. PC AT KEYBOARD MODE>5<–SPI or RAW3WIRE 900 mode SET Set speed: 1. 30KHz 2. 125KHz 3. 250KHz 4. 1MHz SPEED>1 <–test at low speed ... 102 SPI READY SPI>

Press M for the Bus Pirate mode menu, choose 5 for SPI mode. There are a bunch of configuration options for the SPI module, use the default options for all of them. After SPI mode is ready we need to configure the power supply.

SPI>p<–power supply setup W/w toggles 3.3volt supply? 1. NO 2. YES MODE>2<–use 3.3volt supply W/w toggles 5volt supply? 1. NO 2. YES MODE>1<–don’t use 5volt supply 9xx supply CONFIGURED, use W/w TO TOGGLE 9xx VOLTAGE MONITOR: 5V: 0.0 | 3.3V: 0.0 | VPULLUP: 0.0 | SPI>

p opens the Bus Pirate power supply menu. We use the 3.3volt supply but not the 5volt supply. The voltage monitor verifies that the power supplies are off.

SPI>W<–capital W (silly CSS) enables power supply 9xx 3.3VOLT supply ON SPI>v<–voltage monitor 9xx VOLTAGE MONITOR: 5V: 0.0 | 3.3V: 3.3 | VPULLUP: 0.0 | SPI>

Capital ‘W’ enables any power supplies selected in the previous menu, a small ‘w’ disables them. V displays the supply voltage monitor, which now shows 3.3volts output from the 3.3volt supply.

Now that configuration is finished, we can send commands to the LTC2640 over the SPI bus. The LTC2640 has a 24bit (3byte) interface protocol. The first byte is a command, followed by two data bytes. The LTC2640 is available in 8,10, and 12bit versions; the 8bit version uses the first byte to set the DAC value, and ignores the second byte.

SPI>[0b00110000 255 0]<–set DAC to full 110 SPI CS ENABLED 120 SPI WRITE: 0x30<–write DAC command 120 SPI WRITE: 0xFF<–DAC value 120 SPI WRITE: 0x00<–don’t care 140 CS DISABLED SPI>

Every SPI command begins by enabling the chip select pin ([). The first byte is the command to update the DAC (0b00110000), followed by the value to output (255), and a third byte that’s ignored (0). The command ends by disabling chip select (]).

We used an 8bit DAC with 255 even voltage steps, output set to 255 is 100%. We can use the Bus Pirate voltage probe to measure the output.

SPI>d<–measure voltage 9xx VOLTAGE PROBE: 2.5VOLTS<–DAC output SPI>

D triggers a voltage measurement. The DAC output voltage is 100% (255/255) of the internal reference, 2.5volts.

SPI>[0b00110000 0 0] d
110 SPI CS ENABLED
120 SPI WRITE: 0x30<–write DAC command 120 SPI WRITE: 0x00<–DAC value 120 SPI WRITE: 0x00<–don’t care 140 CS DISABLED 9xx VOLTAGE PROBE: 0.0VOLTS<–DAC output SPI>

The same command with a DAC value of 0 outputs 0% (0/255) of 2.5volts; 0volts.

SPI>[0b00110000 128 0] d
110 SPI CS ENABLED
120 SPI WRITE: 0x30<–write DAC command 120 SPI WRITE: 0x80<–DAC value 120 SPI WRITE: 0x00<–don’t care 140 CS DISABLED 9xx VOLTAGE PROBE: 1.2VOLTS<–DAC output SPI>

A DAC value of 128 is about 50% (128/255) of the reference voltage, 1.2volts.

SPI>[0b01000000 0 0] d
110 SPI CS ENABLED
120 SPI WRITE: 0x40<–power down command 120 SPI WRITE: 0x00<–don’t care 120 SPI WRITE: 0x00<–don’t care 140 CS DISABLED 9xx VOLTAGE PROBE: 0.0VOLTS<–DAC off SPI>

The LTC2640 has a low power mode, triggered by the command 0b01000000 and two bytes that are ignored. After the power down command we can verify that there’s output from the DAC. write any DAC value to exit low power mode.

Taking it further

What’s the next step for the Bus Pirate? We’ll eventually make a final update to the design that includes USB on a professionally made, double-sided PCB. Power supply indicator LEDs were slated for this version, but didn’t get included. It would also be helpful to have an AT  keyboard connector for debugging without a PC. check out the roadmap and wishlists on the Hack a Day Bus Pirate page.

Download: buspirate.v1a.zip

Leave a Reply

Your email address will not be published. Required fields are marked *