Skip to main content
Topic: Bus Pirate V4 external xtal (Read 4839 times) previous topic - next topic

Bus Pirate V4 external xtal

So....... Bus pirate v4 now has a crystal? 12Mhz if I remember. So that means the delay function is gonna be way off, more.

So what does that mean? Didnt the 3.5 run a [s:]35[/s:]32Mhz internal? but only got 16MIPS. So does that mean this version is ALOT slower then the old version or [s:]faster[/s:] still slower because its external and under 16Mhz?

and dont kill me. I am still confused as to why the 3.5 has a 32Mhz internal clock but runs at 16MIPS. So what does that mean with an external? AVRs I put a crystal on the board and thats my speed. If twelve means 6MIPS then that means we can basicly forget about Auto Baud detection on v4, just way to slow.

I understand the USB prolly called for a crystal but couldnt it be faster?

edit: oh crap. I just read that pic s 1/4 xtal speed!!!!!!!11111 to mips? is tat trueeee? perhaps the one the BP uses (atleast v3) is only 1/2 and thats why it ran at 16MIPS? What about the version 4?

My question comes down too; what kind of speeds can I expect on the version 4? and will the decrease in speed hurt any already developed features of the bus pirate?

Re: Bus Pirate V4 external xtal

Reply #1
You should really read the datasheet about the  different clocking options. The instructionrate (mips) highly depends on the used crystal and settings in the 'fuses' . Iirc there is also osccon register that provides software control to the clock.

I think usb needs to be clocked at 48mhz and I think the instruction clock is the same. I.m away from my dev pc so I can.t tell for sure.

Re: Bus Pirate V4 external xtal

Reply #2
Quote
You should really read the datasheet about the different clocking options

Seemd like a waste of my time as I will most likly never use the specific PIC in question in my life. Nor would I know the specific settings used on the v4 hardware. I was hoping a pic expert / DP crew man could tell me.


wait im calm now.

The PIC runs at 48MHz/24MIPS. A clock is supplied by an external 12Mhz quartz crystal (X1) and two 18pf capacitors (C7 and C8).

So we gained quite a bit of instructions per second. Thats great. So it seems the PIC used has some sort of crystal doubler system in it? run multiple instructions within one 'swing'? thats sweet.

Re: Bus Pirate V4 external xtal

Reply #3
[quote author="BrentBXR"]So it seems the PIC used has some sort of crystal doubler system in it? run multiple instructions within one 'swing'? thats sweet.[/quote]

The PIC has a PLL (Phase-locked loop) inside that "generates" the 48MHz for the USB and also the clock for the CPU. On pages 121 and 128 of the Datasheet you can see a Clock Diagram of the PIC24FJ256GB106.

Re: Bus Pirate V4 external xtal

Reply #4
It also says; Up to 16 MIPS performance. right on the first line on the pics page.

So I dont understand. If its making an internal 48 Mhz but you still see only 16MIPS. Why is there a 12Mhz crystal on the board?

Re: Bus Pirate V4 external xtal

Reply #5
As Sjaak said. Pic has internal PLL. That PLL can act as clock multiplier. But it needs reference clock. 12 Mhz is the reference for the pll.

The pic has internal PLL that runs at 96Mhz and 1/2 clock is fed to the USB core and "1/3 + controllable divider" is fed to PIC core.

see page 121 and 128 in the family datasheet. http://ww1.microchip.com/downloads/en/D ... 39897c.pdf

Re: Bus Pirate V4 external xtal

Reply #6
Again; the whole pic xtal vs MIPS is new to me. I get the clock. The clock source/options pages 121-128 don't seem to explain how the Mhz translates to MIPS with PICS. Infact even a search of MIPS only brings up 15 results.

I have read alot of different reports from PICS are 1/4 the clock speed; but then BP v3 is was 1/2.

This specific datasheet says the following:
Up to 16 MIPS Operation at 32 MHz

So quite simply; does the Bus Pirate version 4 run at its max performance of 16MIPS? Or does it run at 24MIPS as Ian stated? Or is that just the USB side of it?? What MIPS could I expect to see when writing a function in ee.c for example ( :) )

Re: Bus Pirate V4 external xtal

Reply #7
It takes some time for the CPU to finish instructions, Some are designed to handle 1instruction per cycle(AVR, some ARMs, etc) and some are not. Pics have most instructions 2cycle, so avg code will run at speed of ~16MIPS @ 32Mhz.

The cpu that is used in BP4 is 16MIPS max according to the datasheet

Re: Bus Pirate V4 external xtal

Reply #8
Sorry to be so late on this. I saw it several times when I managed wifi on my phone, but could not bring my self to tap out a message on the tiny keyboard (and it wouldn't make sense if I did because I'm so bad at it :D ).

**I was wrong on the BPv4 wiki and writeup. **

PIC clock is 12MHz, USB clock is 48MHz, core clock is 32MHz = 16MIPs with 2 clocks per cycle.

I wish I had a good excuse, but it was 11pm the night before the Tokyo trip and I was still finishing the writeup and I pulled the number out of the air instead of looking it up. My guess was based on other PICs.

18Fs need a 48MHZ clock for the USB. They get this by dividing the input clock (eg 20MHz) to get 4MHz (20MHz/5=4MHz) and then multiply 4MHz*24 to get 96MHz with a phase lock loop, then they divide that by 2 to get 48MHz. A PIC 18F has a 4cycle core so 48/4=12MIPS. Yes, it's unnecessarily complicated :D

I guessed - hey PIC crystal is 12MHz/3=4MHz*24=96MHz/2=48MHz. Then the processor speed was 48MHz/2=24MIPs. I actually knew this wasn't true when we wrote the draft, but I changed it in the late night edit because the math didn't make sense.

In reality the system clock is just handled by a whole other system. The actual speed is exactly the same as the v3, but more precise.

My apologies for the error and any frustration caused. In this case the design was solid, but my documentation fell a bit flat. I'll get it updated ASAP.
Got a question? Please ask in the forum for the fastest answers.

Re: Bus Pirate V4 external xtal

Reply #9
Alright this is good. So we shouldn't see a drastic (if any) change in the actual execution times? So hopfully that means the timing for the 1wire lib and calcs for autobaud dont need to be modified.

Re: Bus Pirate V4 external xtal

Reply #10
I imagine not, no.
Got a question? Please ask in the forum for the fastest answers.