Skip to main content
Topic: Bus Pirate v4 hardware  (Read 72080 times) previous topic - next topic

Re: Bus Pirate v4 hardware

Reply #75
I've been trying to get the USB to enumerate with my minimal firmware. Windows says 'unknown usb device', which is something, but no success yet. That's usually a timing problem. I'm using a 24mhz external crystal and I'm pretty sure the config settings are correct. I'm going to take a break and I'll be back to work on it later.

The test code is in svn:
http://code.google.com/p/the-bus-pirate ... /source-v4

you'll need to get the USB framework on your own and drag this in. You also need to use the usb descriptor file one of the Microchip CDC demos. Code is also attached.
Got a question? Please ask in the forum for the fastest answers.

Re: Bus Pirate v4 hardware

Reply #76
I spent a while trying to get this going. I went back to a fresh copy of the Microchip USB stack demo and tried with the closest matching chip (24fj256GB106 (I'm testing with the 128)). Still no connection.

Quote
    _CONFIG1( JTAGEN_OFF & GCP_OFF & GWRP_OFF & COE_OFF & FWDTEN_OFF & ICS_PGx2)
    _CONFIG2( 0xF7FF & IESO_OFF & FCKSM_CSDCMD & OSCIOFNC_ON & POSCMOD_HS & FNOSC_PRIPLL & PLLDIV_DIV6 & IOL1WAY_ON)

I'm pretty sure these are the correct config words. I'm using a 24mhz external HS/PLL crystal /6 for a 4mhz reference. I don;t know why 0xf7ff, but Microchip saw fit to do it, so I did it too.

I double checked the hardware, it runs under debug, but it never makes a connection.
Got a question? Please ask in the forum for the fastest answers.

Re: Bus Pirate v4 hardware

Reply #77
Is it really a 24Mhz I did send? And is it working properly?

That message is displayed even when the resistor is in place to distinguish between low and hispeed.

Re: Bus Pirate v4 hardware

Reply #78
I don't know. It's marked Y24 and :48. It doesn't work with the /6 or /12 PLL, though /12 is out of spec for the PIC. The PIC does run, it runs and runs under debug. It's hard to see where the USB is having a problem because stepping the code messes up the timing too.

Maybe I'll just have to wait for my mouser order :(
Got a question? Please ask in the forum for the fastest answers.

Re: Bus Pirate v4 hardware

Reply #79
I tried to look over the oscilator docu. But it looks ok the things you did.

why did they make the oscillator this difficult :S Can you measure the freq on the oscillator?

Re: Bus Pirate v4 hardware

Reply #80
I don't have an oscope, but it the swing is enough I can measure with the OLS or the Bus Pirate frequency probe.
Got a question? Please ask in the forum for the fastest answers.

Re: Bus Pirate v4 hardware

Reply #81
[quote author="ian"]
I don't have an oscope, but it the swing is enough I can measure with the OLS or the Bus Pirate frequency probe.
[/quote]

Seems like we all need an oscilloscope for development.

Re: Bus Pirate v4 hardware

Reply #82
[quote author="ian"]I don't have an oscope, but it the swing is enough I can measure with the OLS or the Bus Pirate frequency probe.[/quote]Do you have the Saleae logic?  For some reason I thought you did.  You could possibly measure frequency with that, even though 48 MHz is technically too high.  Due to aliasing math, you could still confirm the frequency by sampling at different available rates and calculating the sum and difference.  This all assumes that the voltage swing is enough, in which case you could just use the BP.  The OLS certainly has a high enough sampling rate.  I just wanted to mention the trick for subsampling, since I've used it once to double-check a frequency.

Re: Bus Pirate v4 hardware

Reply #83
With the new crystal (12MHz) it works on the first try :) Time to whip together a test firmware.
Got a question? Please ask in the forum for the fastest answers.

Re: Bus Pirate v4 hardware

Reply #84
I guess there was a problem with that crystal I send you.

Sorry ;)

Re: Bus Pirate v4 hardware

Reply #85
Better to have something to try than just wait for the postman.
Got a question? Please ask in the forum for the fastest answers.

Re: Bus Pirate v4 hardware

Reply #86
Would it still be time to add (after component selection) something like this


in addition to / instead of the 3.3 / 5 selectable regulators ?
I haven't gone through all of the source code, but if I'm reading the PIC's datasheet
correctly it should be possible to use one PWM output on a spare pin, start it on device
initialization, and leave it running constantly while allowing the ratio to be selected
on demand. For low currents a small SOT23 transistor would be able to supply 100mA
at 3.3V and ~50mA down to 0 volts. Or use the next bigger size (SOT223-5) and enjoy
probably 1/2 to 1 W max power dissipation.

I know the schem I've shown restricts the max output voltage to about 4 - 4.3V, but
I figure someone needing 5V will just connect directly to +VUSB !! Full 0-5V range
would be possible but would require an additional drive transistor and a bunch of resistors.
Not a high cost, but it increases required PCB area...

Re: Bus Pirate v4 hardware

Reply #87
Great, I just lost the post I was typing, just because I tried to attach the wrong kind of file !!
Luckily, a memory dump allowed me to retrieve the precious text, in essence:


Here, I've gone forth and included my proposed software regulator in the PCB. I fit it instead of the secondary 3.3V regulator. However I only managed to fit in a SOT23 transistor. A SOT223-5 or SOT89 would possibly fit slightly lower and to the right of the current placement, I haven't tried.
Keep in mind this is very basic draft, and some testing would be required to make sure the circuit is stable and reliable. This kind of circuit can fall into oscillation if not designed properly - which currently is the case.

On a related note, I'd like to know what these are used for :
*VREGEN signal - that's just to turn on / off the regulators and save a few uA, right ?
*PUVSEL33 / PUVSEL50  signals - this is the selector to use either 3.3 or 5V ?
*VR3. This is the 5V regulator. What is its justification?

The USB bus should be an OK source of about 5V, give or take a little. Since VUSB is monitored on ADC5, I really don't see why one would need an additional 5V regulator. Especially considering this :
 + If VUSB is only slightly below 5.0+[dropout voltage], the regulator is totally useless as its pass element will be fully saturated in trying to maintain the impossible 5.
 + If the user needs a precise 5V source, relying on the USB power source to be >5V is not a great idea, and one would probably be better served with a precision reference mounted off-board.

Re: Bus Pirate v4 hardware

Reply #88
[quote author="fenugrec"]
On a related note, I'd like to know what these are used for :
*VREGEN signal - that's just to turn on / off the regulators and save a few uA, right ?[/quote]
Low quiescent current regulators only use a few µA when nothing is connected to their output.  If something is connected, then they could draw well over 100 mA.  The USB specification requires that a device not draw more than 100 mA until after it has reported to the host that it needs more and the host gives permission by selecting a configuration which lists a higher current.  Thus, it's a good idea for the PIC to have control over the non-critical supplies (these regulators) to keep current under control until the device is fully operational.  Otherwise, your computer's USB might burn out when you attach something (it still might, if you don't get everything right).

Quote
*PUVSEL33 / PUVSEL50  signals - this is the selector to use either 3.3 or 5V ?
Yes, this is for the pull-ups, which can be programmed for either voltage.

Quote
*VR3. This is the 5V regulator. What is its justification?

The USB bus should be an OK source of about 5V, give or take a little. Since VUSB is monitored on ADC5, I really don't see why one would need an additional 5V regulator. Especially considering this :
 + If VUSB is only slightly below 5.0+[dropout voltage], the regulator is totally useless as its pass element will be fully saturated in trying to maintain the impossible 5.
 + If the user needs a precise 5V source, relying on the USB power source to be >5V is not a great idea, and one would probably be better served with a precision reference mounted off-board.
Excellent questions/observations.

First of all, the MIC5205-5.0 will not work under all valid conditions.  According to the USB specification, it is perfectly legal for an unpowered hub to deliver as little as 4.01 V to a USB device.  That's a worst-case transient value, but the average is only a little higher, at 4.35 V.  But the MIC5205 requires that its Vin be greater than the desired Vout by at least 10 mV to 350 mV.  In other words, this part of the circuit would fail USB validation testing!

Second of all, an off-board source is not needed.  Boost regulators, such as the Maxim MAX1595, MAX682 or MAX1797, can produce a rather accurate 5.0 V source from relatively small voltages, and quite easily with 4 V.  All they require is a tiny SMD capacitor or inductor to achieve the boost.  The only caveat is that no part is 100% efficient, so some of the meager 0.5 W maximum that USB offers would be wasted.  i.e. Don't depend upon getting 500 mA at 5 V.  The MAX1595 is only rated at 125 mA output current, but it could take over 200 mA from the USB to achieve that.

P.S.  A precision (voltage) reference is not the same thing as a voltage regulator.  A reference cannot deliver significant current by any stretch.  A regulator is not very precise, and would not make a very good reference, e.g., for A/D.  You could combine the two such that the regulator provides the current and the reference keeps the regulator adjusted precisely.  Some regulators have a built-in reference, but a very high precision one could still be added via an op-amp feedback loop.

Re: Bus Pirate v4 hardware

Reply #89
Hi,

[quote author="rsdio"]
Low quiescent current regulators only use a few µA when nothing is connected to their output.  If something is connected, then they could draw well over 100 mA.  The USB specification requires that a device not draw more than 100 mA until after it has reported to the host that it needs more and the host gives permission by selecting a configuration which lists a higher current.  Thus, it's a good idea for the PIC to have control over the non-critical supplies (these regulators) to keep current under control until the device is fully operational.  Otherwise, your computer's USB might burn out when you attach something (it still might, if you don't get everything right).
[/quote]

You have a good point about the USB current draw. I was just accounting for the quiescent current; I don't have the MIC datasheet handy but it probably is <5mA.

....
Quote
First of all, the MIC5205-5.0 will not work under all valid conditions.  According to the USB specification, it is perfectly legal for an unpowered hub to deliver as little as 4.01 V to a USB device.  That's a worst-case transient value, but the average is only a little higher, at 4.35 V.  But the MIC5205 requires that its Vin be greater than the desired Vout by at least 10 mV to 350 mV.  In other words, this part of the circuit would fail USB validation testing!

That's my point - I was evaluating the necessity of having a 5V regulator on a board powered by... 5V !
The only times it would regulate would be when the USB bus is supplying appreciably more than 5V. In most cases I've dealt with though, the ~5V supplied by the USB port is quite good enough to act as a generic, low(ish) power supply for microcontrollers, small projects, etc.
So my question would rather be : who would need the onboard 5V regulator, and in which context ?
I'm thinking it possibly isn't needed by a vast majority of users ?

Or, if by design, BP is required to provide a stable 5V source, then as you mentioned a buck-boost converter would be needed to cater to the wide range of VUSB.