We use the Bus Pirate to interface a new chip without writing code or creating a PCB. based on your feedback, and our experience using the original Bus Pirate to demonstrate various parts, we updated the design with new features and more affordable components.

There’s also a firmware update for both Bus Pirate hardware versions, with bug fixes, and a PC AT keyboard decoder. check out the new Hack a Day Bus Pirate page, and browse the Bus Pirate source code in our Google code SVN repository.

We cover the design updates and interface a digital to analog converter below.

Concept overview

The Bus Pirate started as a collection of code fragments we used to test new chips without limitless compile-program-run development cycles. We released it in a how-to and used it to demonstrate a bunch of serial interface ICs in our parts posts. This post introduces an updated design with new features and a bunch of improvements.

Surface mount design

Pull-up resistors on all bus lines with external voltage source

Software resettable 3.3volt and 5volt power supplies

Voltage monitoring of all power supplies

An external voltage measurement probe

Cheaper parts

Hardware

Click for a full size schematic image (PNG). The circuit and PCB are created using the freeware version of Cadsoft Eagle. All the files for this project are included in the project archive linked at the end of the article.

Microcontroller

We used a Microchip PIC24FJ64GA002 28pin SOIC microcontroller (IC1) in this project. The power pins have 0.1uF bypass capacitors to ground (C1,2). The 2.5volt internal regulator requires a 10uF tantalum capacitor (C20). The chip is programmed through a five pin header (ICSP). A 2K pull-up resistor (R1) is required for the MCLR function on pin 1. read a lot more about this chip in our PIC24F introduction.

RS-232 transceiver

An economical MAX3232CSE RS232 transceiver (IC2) interfaces the photo to a PC serial port. This chip replaces the expensive through-hole MAX3223EEPP+ used in the previous version of the Bus Pirate. The serial interface will work with a USB->serial adapter.

Bus pull-up resistors

The original Bus Pirate has 3.3volt pull-up resistors on 2 pins, but a lot of of our tests required additional external resistors. The updated design has pull-up resistors (R20-23) on the three main bus signals (data in, data out, clock) and the chip select (CS) pin.

A row of jumpers (SV5) connects each resistor to an external voltage supplied through the Vext terminal (X4). Through-hole resistors are used like jumper-wires to make the PCB much easier to etch at home.

We couldn’t find an sophisticated way to control an arbitrary voltage pull-up resistor variety from a 3.3volt microcontroller. If you have any ideas, please share them in the comments.

Alimentare electrică

VR1 is a 3.3volt supply for the microcontroller and RS232 transceiver. VR2 is a 5volt supply. Both require two 0.1uF bypass capacitors (C3-C6). J1 is a power supply jack for a common 2.1mm DC barrel plug. 7-10volts DC is probably the optimal power supply range.

The original Bus Pirate had dual power supplies, 3.3volts and 5volts, so a lot of ICs could be interfaced without an additional power supply. A major nuisance was the lack of a power reset for connected chips. If a misconfigured IC needed to be power-cycled, we had to disconnect a wire. We got so worn out of this routine that we added a software controlled reset to the updated design.

VR3 (3.3volts) and VR4 (5volts) are TI TPS796XX voltage regulators with an enable switch. A high level on pin 1 enables the regulator. A pull-down resistor (R13,R12) makes sure that the regulators are off when the photo isn’t actively driving the line, such as during power-up initialization. The datasheet specifies a large capacitor on the input (C23, C21) and output (C24, C22) pins, we used the same 10uF tantalum we use everywhere. 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 1Rezistorii de 0k (R10, R11 de mai sus) Împărțiți tensiunea de intrare în jumătate, ceea ce face posibilă măsurarea până la 6,6 volumuri cu microcontrolerul foto 3.3Volt.

Piratul de autobuz are patru monitoare de tensiune. Sursele de alimentare 3.3 Volt și 5Volt sunt monitorizate, la fel ca și tensiunea externă alimentată la rezistențele de tracțiune. Un al patrulea monitor este conectat la PIN 9 din antetul de ieșire pentru a face o sondă de tensiune.

PCB.

Faceți clic pentru o diagramă de plasare completă (PNG). Consiliul este un design presupus cu o singură față, ne-am gravat în laborator pe un PCB foto-rezistent la o singură față. În partea de sus, lângă C13, două fire de jumper se întâlnesc la un singur VIA; Am lipit un fir de jumper la celălalt pe spatele tabloului.

Lista de materiale

Parte
Valoare

IC1.
PIC24FJ64GA002 (SOIC)

IC2.
MAX3232CSE (SOIC-N)

VR1.
LD1117S33 3.3 Regulator de volum (SOT223)

VR2.
LD1117S50 Regulator 5Volt (SOT223)

Vr3.
TPS79633 3.3 Regulator de vrăjit (SOT223-6)

VR4.
TPS79650 5Volt Regulator (SOT223-6)

C1-13
0.1UF condensator (0805)

C20-24.
10UF Tantalum condensator (SMC A)

R1.
2000 rezistor Ohm (0805)

R2,3
390 rezistor Ohm (0805)

R4-13.
10000 ohm rezistor (0805)

R20-23.
Rezistor de ohm de 2.2k-10k (prin orificiu)

LED1,2
LED (0805)

J1.
Mufă de putere de 2.1mm.

X2, X4.
clema cu șurub (2 borne) * netestate

X3.
Conector de port serial DB9 feminin * netestat

ICSP.
0.1 “pin antet, drept

Sv4.
0.1 “antet pin sau antet învăluit

SV5.
0.1 “pin antet, drept

Firmware

Firmware-ul este scris în C folosind versiunea demonstrației complementare a compilatorului foto C30. Aflați totul despre lucrul cu această fotografie în introducerea noastră în seria de fotografii 24F.

Firmware-ul cel mai actual este postat pe pagina Hack A Bus Pirate. Sursa curentă se află în depozitul nostru de cod Google SVN.

Folosind-o

Diagrama de mai sus arată pinul pirați al magistralei.

Am făcut un cablu cu clipuri de aligator la sfârșit și am adăugat etichete la fiecare fir, așa că nu trebuie să ne referim la acest tabel ori de câte ori interfațăm un nou cip.

Dacă știți despre orice conectori sau cabluri uimitoare, vă rugăm să le conectați la acestea în comentarii.

LTC2640 SPI digital la convertorul de tensiune analogic

Tehnologia liniară LTC2640-LZ8 este un convertor digital de 8bit pentru analog (DAC) programat peste SPI. Un DAC este, în esență, un divizor de tensiune programabil. Sunt benefice pentru recrearea formelor de undă, cum ar fi semnalele audio. Un DAC 8bit are 255 de intervale chiar între 0 și tensiunea de referință, partea L pe care am folosit-o are o referință internă 2.5Voltă.

LTC2640 vine doar într-un pachet mic Sot223-8, așa că am făcut un adaptor de panou în profilul unui cip DIP-8. Amprenta noastră LTC2640 este inclusă în arhiva proiectului atașată la sfârșitul acestui articol.

Schema de mai sus arată circuitul nostru de testare pentru LTC2640. Este nevoie de o sursă de alimentare de 2.7-5Voldă, am folosit furnizarea de 3.3Voltă a lui Pirate. C1 este un condensator de by-pass între știftul de alimentare și sol. PIN 8 este un pin de resetare activă, legați-l ridicat pentru funcționarea normală. PIN 7 este ieșirea DAC, conectați sonda de măsurare a tensiunii pirat de magistrală (ADC) aici.

Pirat de autobuz
LTC2640 (PIN #)

Mosi.
SDI (3)

CEAS
SCK (2)

CS.
CS / LD (1)

Adc.
Vout (7)

+ 3.3Volts.
CLR (8)

+ 3.3Volts.
VDD (5)

Gnd.
GND (4)

Am conectat pirat cu autobuzul la LTC2640, așa cum se arată în tabel. LTC2640 nu are un PIN de ieșire de date, această conexiune SPI rămâne neutilizată.

Biblioteca SPI de bibliotecă de bobină și software-ul Raw3Wire sunt compatibile cu interfața SPI a LTC2640. Am folosit biblioteca SPI; Dacă utilizați biblioteca Raw3Wire, asigurați-vă că alegeți ieșirea NORMAL PIN.

Hiz> m <-select modul 1. Hiz. 2. 1-sârmă 3. UART. 4. I2C. 5. Spi. 6. JTAG. 7. Raw2wire. 8. Raw3wire. 9. PC la tastatură MODE> 5 <-PI sau Raw3Wire Setul de moduri 900. Setarea vitezei: 1. 30 khz. 2. 125khz. 3. 250khz. 4. 1MHz. Viteză> 1 <-test la viteza redusă ... 102 spi gata Spi>

Apăsați M pentru meniul Mod Pirate cu autobuz, alegeți 5 pentru modul SPI. Există o grămadă de opțiuni de configurare pentru modulul SPI, utilizați opțiunile implicite pentru toate acestea. După ce modul spi este gata, trebuie să configuram sursa de alimentare.

SPI> P 2 <-Utilizați valoarea 3.3Voldă W / W Comutați la valoarea 5Volt? 1. No. 2. Da. MODE> 1 <-Don't Utilizați aprovizionarea cu 5 9xx furnizor configurat, utilizați w / w pentru a comuta Monitor de tensiune 9xx: 5V: 0,0 | 3.3V: 0,0 | VPULLUP: 0,0 | Spi>

P Deschide meniul sursei de alimentare cu bus pirat. Folosim alimentarea 3.3, dar nu sau de alimentare cu 5 volum. Monitorul de tensiune verifică dacă sursele de alimentare sunt oprite.

SPI> W <-Capital W (Silly CSS) permite alimentarea cu energie electrică 9xx 3.3 Venit SPI> V <- Monitor de tulpină Monitor de tensiune 9xx: 5V: 0,0 | 3.3V: 3.3 | VPULLUP: 0,0 | Spi>

Capitalul “W” permite sistemelor de alimentare selectate în meniul anterior, un mic “w” le dezactivează. V Afișează monitorul de tensiune de alimentare, care afișează acum ieșirea de 3,3 volum de la alimentarea 3.3.

Acum, această configurație este terminată, putem trimite comenzi la LTC2640 peste autobuzul SPI. LTC2640 are un protocol de interfață de 24 de biți (3byte). Prima octet este o comandă, urmată de doi octeți de date. LTC2640 este disponibil în 8,10 și 12bit versiuni; Versiunea 8bit utilizează primul octet pentru a seta valoarea DACe, 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