Skip to main content
Topic: Bus Pirate firmware v6.0 development (Read 29049 times) previous topic - next topic

Bus Pirate firmware v6.0 development

Current todo:

[s:]*Enable OpenOCD[/s:]: Note: OpenOCD currently not available for BPv4 due to lack of new USB system support. Added to Docs here: http://dangerousprototypes.com/docs/Bit ... _JTAG_mode

*A bunch of bug fixes I have flagged in the forum:
[s:]http://dangerousprototypes.com/forum/viewtopic.php?f=4&t=1888[/s:]: Added advanced AUX control to I2C mode, documented here: http://dangerousprototypes.com/docs/I2C ... UX_command
[s:]http://dangerousprototypes.com/forum/viewtopic.php?f=4&t=2275[/s:] : Added frequency counter access to BBIO mode. documented here: http://dangerousprototypes.com/docs/Bit ... on_AUX_pin
[s:]http://dangerousprototypes.com/forum/viewtopic.php?f=28&t=2576[/s:]: Vt100 home and end keys patch. Committed.  Thanks to http://code.google.com/p/the-bus-pirate ... tail?id=62
[s:]http://dangerousprototypes.com/forum/viewtopic.php?f=28&t=2975&p=29257#p29243[/s:]
Updated servo position, no longer disables if value is given. New mode does not show the disabled PWM message unless S is pressed without a value.New mode also loops as requested, enter the value and hit enter to update the servo. Hit x or enter to exit. Documentation updated: http://dangerousprototypes.com/docs/Bus ... de#S_Servo
New server guide from the feature author (not complete) here:
http://dangerousprototypes.com/docs/Bus ... umentation
[s:]http://dangerousprototypes.com/forum/viewtopic.php?f=41&t=2629[/s:] AVR Dude 40x speed improvement  Documentation: http://dangerousprototypes.com/docs/SPI_(binary)#AVR_Extended_Commands

New features:
[s:]*replace 1-Wire routines[/s:]
[s:]*UART autobaud[/s:]

From Brent:
* Added all UART_GETBAUD functions from static 'bpWline' to BPMSGs
* Reformated base.h a bit (moved the defines to the top) and added BUSPIRATEV2GO that just defines v3 anyways; just for no chance of confusion. and enabled BP_USE_BASIC and keyboard on v4 only.
* Removed the color labels on the 'v'
* fixed the '?' and 'v' glitch
* Added a BPMSG for v4 users who press #, it says no software reset on v4 use button
Edit: a few more
* removed hardwarev4.h its not used and matches hardwarev4a.h with some lines added. so i could tell its just some obsolete file; so removed it from the projects and deleted from SVN (revision excists if it needs to be brought back + I have backups)
* Added k/K to the ? menu (c/C/k/K Aux select (A1/CS/A2/A3)
* Moved the k/K from bpWstring to the v4 translation file (matches c now "a/A/@ now controls AUX2" for example)
More:
*Fixes for UART/SPI mode PPS
*Defined PPS in hardware setup
*Fixes to SPI slave (sniffer) PPS
*AUX1/2/3 fix

Alpha version a6:
*fixed AVRDUDE binmode issues in v4
*Fixed SPI mode issues in all modes in v4
*Fixed UART maybe (untested) in v4
*Fixed HD44780 LCD mode in v4


Need to:
[s:]*move different RPx pins to hardware profile defines[/s:]
[s:]*Check AUXpin freq, PWM, and servo functions[/s:]
[s:]*Uart autobaud to v4 only (size limitations)[/s:]
*Document new v4 stuff
Got a question? Please ask in the forum for the fastest answers.

Re: Bus Pirate firmware v6.0-rc4 development

Reply #1
1-wire added and tested. Committing and making firmware now (with video!)
Got a question? Please ask in the forum for the fastest answers.

Re: Bus Pirate firmware v6.0-rc4 development

Reply #2
Nice work! Where is the vid??

Btw i saw you uploaded into the regular svn instead of the bp svn. intentional?

Re: Bus Pirate firmware v6.0 development

Reply #3
30 more minutes to render the video, another 30 to upload. I'm not happy with the first video but I learned a ton and tomorrow's will be better :)
Got a question? Please ask in the forum for the fastest answers.

Re: Bus Pirate firmware v6.0 development

Reply #4
Quote
In the Bus Pirate OpenOCD source there is a call to binOpenOCDTapShiftFast but no function. In the history, the last version has binOpenOCDTapShift and there is a function. I'm going to revert to that for now. Maybe that is why it was left out of the v5.10 compile?

OpenOCD re-enabled, but found this bug. Reverted to old code and compiled ok.
Got a question? Please ask in the forum for the fastest answers.

Re: Bus Pirate firmware v6.0 development

Reply #5
[s:]http://dangerousprototypes.com/forum/viewtopic.php?f=4&t=1888[/s:]: Added advanced AUX control to I2C mode, documented here: http://dangerousprototypes.com/docs/I2C ... UX_command
[s:]http://dangerousprototypes.com/forum/viewtopic.php?f=4&t=2275[/s:] : Added frequency counter access to BBIO mode. documented here: http://dangerousprototypes.com/docs/Bit ... on_AUX_pin
[s:]http://dangerousprototypes.com/forum/viewtopic.php?f=28&t=2576[/s:]: Vt100 home and end keys patch. Committed.  Thanks to http://code.google.com/p/the-bus-pirate ... tail?id=62
Got a question? Please ask in the forum for the fastest answers.

Re: Bus Pirate firmware v6.0 development

Reply #6
[s:]http://dangerousprototypes.com/forum/viewtopic.php?f=28&t=2975&p=29257#p29243[/s:]
Updated servo position, no longer disables if value is given. New mode does not show the disabled PWM message unless S is pressed without a value.New mode also loops as requested, enter the value and hit enter to update the servo. Hit x or enter to exit. Documentation updated: http://dangerousprototypes.com/docs/Bus ... de#S_Servo
New server guide from the feature author (not complete) here:
http://dangerousprototypes.com/docs/Bus ... umentation
Got a question? Please ask in the forum for the fastest answers.

Re: Bus Pirate firmware v6.0 development

Reply #7
I added Brent's baud rate detection, but it seems to hang when run/the exit does not work (unlisted UART macro 4). I have not tried it yet though. It is also not a good idea to poll the PC-side UART directly because it is not compatible with Bus Pirate v4. I will pick up here tomorrow. For now, where is update package for Bus Pirate v3 and v4.
Got a question? Please ask in the forum for the fastest answers.

Re: Bus Pirate firmware v6.0 development

Reply #8
[quote author="ian"]I added Brent's baud rate detection, but it seems to hang when run/the exit does not work (unlisted UART macro 4). I have not tried it yet though. It is also not a good idea to poll the PC-side UART directly because it is not compatible with Bus Pirate v4. I will pick up here tomorrow. For now, where is update package for Bus Pirate v3 and v4.[/quote]

A note on the exit routine; basicly how that works is the MCU will sit in a nothing loop waiting for the MISO pin to have some activity; during that sit it is possible to leave and exit the procedure/macro (seemed to work for me; but I could have used the wrong UART variable or somthing; im still learning the PIC stuff). but once activity happens we exit that loop; from there you cannot exit until the procedure has sampled I think 15 times. The reason I left being able to exit at that point is simply becuase I need as fast as possible (i know ASM ASM... this works) when I had the emergency exit routine on the sample loops; this caused more cycles needed per loop and mind you the LOOP is nothing; its just a waiting loop so it needs to be quick; very quick.

To me the easiest solution is to just tell the user; for an emergency exit; pull the plug or press reset. otherwise we could adjust the super simple formula and make it work; but then you also lose higher sample speeds (higher bauds will no longer be able to be detected; even though we are already cut off at 20m)

edit: Oh you know; you didnt test it with actual UART data on the MISO line did you; im guessing your MISO line was hanging? Yeah; i never thought of that... During my testing i was always hooked up to a UART line (no data or data; but thats naturally high; so my starting wait loop is waiting for it to go low; this mean if your hanging pin is low you skip the loop that allows exiting and jump straight into the next wait which is waiting for a high again; which wont come...

ok i understand, so simply put; your floating pin is subverting my 'activity wait' because its expecting a UART line which is high; but that floating pin is most likely low. so you basicly jump bast the loop that allows exiting straight into the sample stage that doees NOT allow exiting and get hung waiting for the pin to do somthing.

I know how I can fix that; I will send you an updated routine in a minute. As for this happening again for whatever reason; perhaps I can add a quick check that sees how far the timers gotten and its gotten to far exit the routine due to lack of activity; though again this is a very time sensitive routine.. i dont know how bad that IF and COMPARE statment will slow down the sampling....


Edit2: Does the MISO line have an external interrupt? I think perhaps some point in the near future a major overhaul of that function should be performed utilizing an external interrupt instead of just wait loops; this will allow for smarter routines and emergency exiting no problem...

Re: Bus Pirate firmware v6.0 development

Reply #9
I think the easiest fix would be to have two waits; wait for a high then a low. Which should work fine; and allow exiting on both those waits. this will assure even if the pin is in an unwanted or unknown state; we can exit.

Code: [Select]
        while(BP_MISO==0 && U1STAbits.URXDA==0) {       // Wait for activity (stabilize)
                asm( "nop" );                                                  // you can exit by hitting any key at this point.
        }

        while(BP_MISO==1 && U1STAbits.URXDA==0) {      // Wait for activity (stabilize)
                asm( "nop" );                                                  // you can exit by hitting any key at this point.
        }
       
        if (U1STAbits.URXDA==1) {                                      // Emergency Exit.
                i=U1RXREG;                                                              // Get rid of the char from queue
                UARTgetbaud_clrTimer();
                bpWline("nr** Early Exit...nr");
                return 0;
        }
       

That should work.. for now.

let me know if the miso line has an external interrupt and if its possible for me to use it...


so just add
Code: [Select]
       while(BP_MISO==0 && U1STAbits.URXDA==0) {       // Wait for activity (stabilize)
                asm( "nop" );                                                  // you can exit by hitting any key at this point.
        }

right below the IF(dataonly)==0{then say:"Awaiting Activity"}

right above its brother (only one char changed)

Re: Bus Pirate firmware v6.0 development

Reply #10
BTW: I got like 5 boxes today.. digikey, my itead gift, even my TI 5$ dev board.. I was so hoping one of those boxes was the BP but it wasnt :( soon though im sure)

Re: Bus Pirate firmware v6.0 development

Reply #11
Ok i just got back home from work and compiled that little update and tested; yep that floating pin sure did cause it to fall into the sample loop and get stuck. So with this little update its fixed; its acutally good because it gives the user time to connect the MISO pin if he has not already..

Code: [Select]
unsigned long UARTgetbaud(int DataOnly)
{
unsigned int i=0;
unsigned long CurrentSample=0,BitSample=0;

// CalculatedBaud define just for readability
#define CalculatedBaud BitSample

UART2Disable(); //Disable UART
BP_MISO=0;
BP_MISO_DIR=1;


if(DataOnly==0) {
bpWline("Awaiting Activity...nr(Notice: Any key to exit at this point only...)nr");
}

while(BP_MISO==0 && U1STAbits.URXDA==0) { // This first wait is incase the user has not yet connected the MISO pin to a UART
asm( "nop" ); // bus. If the user HAS connected it; then this wait will be skipped (miso=1)
}

while(BP_MISO==1 && U1STAbits.URXDA==0) { // Wait for activity (stabilize)
asm( "nop" ); // you can exit by hitting any key at this point.
}

if (U1STAbits.URXDA==1) { // Emergency Exit.
i=U1RXREG; // Get rid of the char from queue
UARTgetbaud_clrTimer();
bpWline("nr** Early Exit...nr");
return 0;
}

and you can  easily exit before the sampling stage by pressing any key. Now the strings just need to be setup in the translation ability way..

This function actually works pretty well

Quote
UART>(60)
Awaiting Activity...
(Notice: Any key to exit at this point only...)


Actual Calculated Baud Rate:    115942 bps (Estimated)
Nearest Common Baud Rate:      115200 bps

End of Function. Good bye.

UART>(60)
Awaiting Activity...
(Notice: Any key to exit at this point only...)


Actual Calculated Baud Rate:    115942 bps (Estimated)
Nearest Common Baud Rate:      115200 bps

End of Function. Good bye.

UART>(60)
Awaiting Activity...
(Notice: Any key to exit at this point only...)


Actual Calculated Baud Rate:    115942 bps (Estimated)
Nearest Common Baud Rate:      115200 bps

End of Function. Good bye.

I will forsure keep looking on ways to improve it and updated it as more ideas and ability appear. Perhaps I will test and see if I can get AutoBaud to work on bridge mode...

Re: Bus Pirate firmware v6.0 development

Reply #12
Also a small glitch upon reset; you get some scrabled chars

Quote
UART>#
REÿ
Bus Pirate v3b
Firmware v6.0-a4  Bootloader v4.4
DEVID:0x0447 REVID:0x3043 (24FJ64GA002 B5)
http://dangerousprototypes.com
HiZ>$

So I think that BPMSG1093; is not pointing to anyhting (I couldnt find the string attached to 1572 i think it was. So I commented that out and built it again to see if it went away; and the RE did (is RE supposed to be there?) but it still leaves the 'y'

Quote
HiZ>#ÿ
Bus Pirate v3b
Firmware v6.0-a4  Bootloader v4.4
DEVID:0x0447 REVID:0x3043 (24FJ64GA002 B5)
http://dangerousprototypes.com

Re: Bus Pirate firmware v6.0 development

Reply #13
Also why is 1wire_lib.c and m_1_wire_213.c there? Cant you delete the m_1_wire now?

Re: Bus Pirate firmware v6.0 development

Reply #14
Thanks for the update. I'll roll it in today and test out the code.

RE should be RESET, seems like a bug.

Yes, the old 1-wire can be deleted.
Got a question? Please ask in the forum for the fastest answers.