Bus Pirate - Community Firmware 7.0

Bus Pirate firmware and hardware development.

Re: Bus Pirate - Community Firmware 7.0

Postby USBEprom » Tue Nov 01, 2016 6:27 am

Hi guys.
Some personal thoughts about macro(2) failure.
Because I am babo and I do not know programming, I can not but note that it appears that in macro(2) there is no trigger to start it.
I mean, in macro(1) there is something like this

//Reset needs to start low

bbCS(0); //bpAuxLow();

bp_delay_us(0xff);

//RESET HIGH

bbCS(1);

//clock tick

bbClockTicks(1);

//reset low again

bbCS(0); //bpAuxLow();


that seems to prepare the start of the procedure, instead in macro(2) nothing.
I never saw and not even know if it is existed a firmware where macro(2) was working.
I know in firmware v4.2 macro(1) was working but macro(2) was not already in the time.
I have not the source code of v4.2, I have only the hexadecimal file, but I have the one of the official release v4.3 and is no trigger at all there for starting macro(2) inside it.
I believe some code is missing from the beginning.
I guess macro(1) and macro(2) are not so different.
More or less them perform the same task with macro(2) that is responsible for parsing the ATR string acquired.
By performing macro(1) without any card in the reader the result that can be obtained is something very similar to what is obtained with macro(2), does not matter if card is or is not inserted inside the reader.
This thing is instrumentally corroborated by logic analyzer and oscilloscope giving an evidence that actually no starting signal for the procedure is issued when performing macro(2).
Maybe it would be enough to simply copy and paste into macro(2) the same code that inside macro (1) is intended to prepare and start the procedure.
And more, maybe it would be also need to add the same or similar changes introduced to make macro(1) functioning, who knows.
I posted a similar text into github "2WIRE macros do not work #17" (https://github.com/BusPirate/Bus_Pirate/issues/17)

Thanks.

Be seeing you.

U.Sb
USBEprom
Full Member
Full Member
 
Posts: 174
Joined: Wed Mar 14, 2012 4:09 pm

Re: Bus Pirate - Community Firmware 7.0

Postby USBEprom » Tue Nov 01, 2016 4:17 pm

Hi guys.
Also macro(2) has been fixed by agatti, so now issue in 2WIRE menu is gone.
Thanks agatti!
Please take a look here:
https://github.com/BusPirate/Bus_Pirate/issues/17
Seems that mames for macros were wrong because related to ISO-7816 an not ISO-7813 as stated into the code.
About the possible reason because macro(2) does not have any trigger it is likely that it exists to listen for data on the bus when the ATR signal is being sent from something else, which in a way is just what the Bus Pirate was meant to be used for.

Thanks.

Be seeing you.

U.Sb
USBEprom
Full Member
Full Member
 
Posts: 174
Joined: Wed Mar 14, 2012 4:09 pm

Re: Bus Pirate - Community Firmware 7.0

Postby USBEprom » Fri Nov 04, 2016 5:43 pm

Hi guys.
By following the latest hints from agatti (https://github.com/BusPirate/Bus_Pirate/issues/7) I was able to reach my goal to make a firmware release for the Bus Pirate v3 able to allow up 256 characters for the command line and all the available features enabled, even BASIC scripting, although with reduced RAM room compared to standard release.
So here you go this very newest version that I just built starting from the latest Bus_Pirate-master (https://github.com/BusPirate/Bus_Pirate ... master.zip) that alread has all the improvements made by agatti, even the last 2WIRE fix.
In this release all the features are enabled, BASIC too, the command line allows up 256 characters, there are new speeds in SPI mode and macro(1) and macro(2) in 2WIRE mode are fixed (all improvements and fix made by agatti that I thank for).
I had to set 256 characters for the command line by change the line 502 into configuration.h, lines 496-505, in this way:

/**
* How big the serial command buffer can be, in bytes.
*
* @warning This must be set to a power of two, ie. 256, 128, 64, 32, etc.
*/
#ifdef BUSPIRATEV3
#define BP_COMMAND_BUFFER_SIZE 256
#else
#define BP_COMMAND_BUFFER_SIZE 256
#endif /* BUSPIRATEV3 */


In order to enable all the features into configuration.h I had to change lines 304-319 too in this way:

#ifdef BUSPIRATEV3
#define BP_ENABLE_1WIRE_SUPPORT

#define BP_ENABLE_BASIC_SUPPORT
#define BP_ENABLE_DIO_SUPPORT
#define BP_ENABLE_HD44780_SUPPORT
#define BP_ENABLE_I2C_SUPPORT
#define BP_ENABLE_JTAG_SUPPORT
#define BP_ENABLE_PIC_SUPPORT
#define BP_ENABLE_PC_AT_KEYBOARD_SUPPORT
#define BP_ENABLE_RAW_2WIRE_SUPPORT
#define BP_ENABLE_RAW_3WIRE_SUPPORT
#define BP_ENABLE_SMPS_SUPPORT
#define BP_ENABLE_SPI_SUPPORT
#define BP_ENABLE_SUMP_SUPPORT
#define BP_ENABLE_UART_SUPPORT
#endif /* BUSPIRATEV3 */


Then I had to set 512 into line number 105 of basic.h so that it has changed like this:

#define PGMSIZE 512

In this way I have got a firmware version for the Bus Pirate revision 3 where are allowed up 256 characters for the command line and all the available features are enabled, even BASIC scripting, althought with reduced RAM room compared to standard release (half room in this release by comparing standard line 105 in basic.h which is #define PGMSIZE 1024 before the change).
https://github.com/BusPirate/Bus_Pirate/issues/7
For me it works great (many thanks agatti!).

Thanks.

Be seeing you.

U.Sb
Attachments
FULL.zip
(127.17 KiB) Downloaded 203 times
USBEprom
Full Member
Full Member
 
Posts: 174
Joined: Wed Mar 14, 2012 4:09 pm

Re: Bus Pirate - Community Firmware 7.0

Postby joeblack » Sat Nov 05, 2016 7:25 am

Thanks for the "gold (Full)BP3version" works like a charm with all enabled, more SPI speed working macros and up to 256 characters for the command line.
Good job!
joeblack

Note: i only got the "busPirate.FULL_s.hex" working, the other one won´t be flashed in my BPV3.
something like checksum error....
joeblack
Newbie
Newbie
 
Posts: 8
Joined: Sat Oct 15, 2016 5:23 pm

Re: Bus Pirate - Community Firmware 7.0

Postby USBEprom » Sat Nov 05, 2016 1:33 pm

Hi joeblack.
Sorry, you are right, I am pretty babo!
Firmware compressed option "1" does not work because I have forgot to convert it uppercase, apologize me.
Here you go the correct one.
However it was not me, all the work was done by agatti and others, I only suggested the changes and provided the table of the prescalers for the new speeds in the SPI menu.
Thanks.

Be seeing you.

U.Sb
Attachments
busPirate.FULL_1.zip
(66.05 KiB) Downloaded 203 times
USBEprom
Full Member
Full Member
 
Posts: 174
Joined: Wed Mar 14, 2012 4:09 pm

Re: Bus Pirate - Community Firmware 7.0

Postby joeblack » Sat Nov 05, 2016 2:07 pm

I know, but nevertheless I would like to thank you all and specifically you and agatti for providing latest hex files,
especially more SPI speed is very useful for me....
most times now i use my Raspi for doing SPI stuff, but i love my smart swiss army knife (BPV3), it saved my life one year ago when i had to repair some defectiv Pogo E02 (damaged bootloader) and i learned a lot by using BP.
joeblack
joeblack
Newbie
Newbie
 
Posts: 8
Joined: Sat Oct 15, 2016 5:23 pm

Re: Bus Pirate - Community Firmware 7.0

Postby USBEprom » Thu Nov 10, 2016 4:04 pm

Hi guys.
By following the latest hints from agatti (https://github.com/BusPirate/Bus_Pirate/issues/16) I was able to build a firmware release for the Bus Pirate v3 where in DIO mode the message of start callback is silent.
This same release allow up 256 characters for the command line and all the available features are enabled, even BASIC scripting.
So here you go this very newest version that I just built starting from the latest Bus_Pirate-master (https://github.com/BusPirate/Bus_Pirate ... master.zip) that already has all the improvements made by agatti and others until now.
In this release all the features are enabled, BASIC too, the command line allows up 256 characters, there are new speeds in SPI mode, macro(1) and macro(2) in 2WIRE mode are fixed and in the end in DIO mode the message of start callback is silent (all improvements and fix made by agatti that I really thank for).
I had to set 256 characters for the command line by change the line 502 into configuration.h, lines 496-505, in this way:

/**
* How big the serial command buffer can be, in bytes.
*
* @warning This must be set to a power of two, ie. 256, 128, 64, 32, etc.
*/
#ifdef BUSPIRATEV3
#define BP_COMMAND_BUFFER_SIZE 256
#else
#define BP_COMMAND_BUFFER_SIZE 256
#endif /* BUSPIRATEV3 */


In order to enable all the features into configuration.h I had to change lines 304-319 too in this way:

#ifdef BUSPIRATEV3
#define BP_ENABLE_1WIRE_SUPPORT

#define BP_ENABLE_BASIC_SUPPORT
#define BP_ENABLE_DIO_SUPPORT
#define BP_ENABLE_HD44780_SUPPORT
#define BP_ENABLE_I2C_SUPPORT
#define BP_ENABLE_JTAG_SUPPORT
#define BP_ENABLE_PIC_SUPPORT
#define BP_ENABLE_PC_AT_KEYBOARD_SUPPORT
#define BP_ENABLE_RAW_2WIRE_SUPPORT
#define BP_ENABLE_RAW_3WIRE_SUPPORT
#define BP_ENABLE_SMPS_SUPPORT
#define BP_ENABLE_SPI_SUPPORT
#define BP_ENABLE_SUMP_SUPPORT
#define BP_ENABLE_UART_SUPPORT
#endif /* BUSPIRATEV3 */


Then I had to set 512 into line number 105 of basic.h so that it has changed like this:

#define PGMSIZE 512

It has not need to change anything else because agatti already has pushed all the upgraded files into the repository.
Just download and use them.
In this way I have got a firmware version for the Bus Pirate revision 3 where are allowed up 256 characters for the command line and all the available features are enabled, even BASIC scripting, althought with reduced RAM room compared to standard release (half room in this release by comparing standard line 105 in basic.h which is #define PGMSIZE 1024 before the change).
https://github.com/BusPirate/Bus_Pirate/issues/7
As always for me it works great.
Many, many thanks agatti!

Thanks.

Be seeing you.

U.Sb
Attachments
GOLDEN_DIO.zip
(127.06 KiB) Downloaded 156 times
USBEprom
Full Member
Full Member
 
Posts: 174
Joined: Wed Mar 14, 2012 4:09 pm

Re: Bus Pirate - Community Firmware 7.0

Postby USBEprom » Sat Nov 12, 2016 4:28 pm

Hi guys.
By following the latest hints from agatti (https://github.com/BusPirate/Bus_Pirate/issues/7) I was able to build a firmware for the Bus Pirate v3 using the new cleaned up repository (https://github.com/BusPirate/Bus_Pirate ... master.zip).
This release is the same as the previous I provided here into the forum (GOLDEN_DIO.zip) except that this one was built from the new cleaned repository which uses only configuration.h for the configuration.
So into configuration.h I changed lines from 304 to 319 for setting all the features I want.

#ifdef BUSPIRATEV3
#define BP_ENABLE_1WIRE_SUPPORT

#define BP_ENABLE_BASIC_SUPPORT
#define BP_ENABLE_DIO_SUPPORT
#define BP_ENABLE_HD44780_SUPPORT
#define BP_ENABLE_I2C_SUPPORT
#define BP_ENABLE_JTAG_SUPPORT
#define BP_ENABLE_PIC_SUPPORT
#define BP_ENABLE_PC_AT_KEYBOARD_SUPPORT
#define BP_ENABLE_RAW_2WIRE_SUPPORT
#define BP_ENABLE_RAW_3WIRE_SUPPORT
#define BP_ENABLE_SMPS_SUPPORT
#define BP_ENABLE_SPI_SUPPORT
#define BP_ENABLE_SUMP_SUPPORT
#define BP_ENABLE_UART_SUPPORT
#endif /* BUSPIRATEV3 */


Then I changed the line 405 too in this way in order to make room for BASIC scripting

#define BP_BASIC_PROGRAM_SPACE 512

Finally I had to set line 523 for up 256 characters into the command line by changing it in this way

/**
* How big the serial command buffer can be, in bytes.
*
* @warning This must be set to a power of two, ie. 256, 128, 64, 32, etc.
*/
#ifdef BUSPIRATEV3
#define BP_COMMAND_BUFFER_SIZE 256
#else
#define BP_COMMAND_BUFFER_SIZE 256
#endif /* BUSPIRATEV3 */


I have done this more than anything else to test the new repository and become familiar with the new setting.
For me it works great.
Thanks a lot to agatti for having fixed the repository!

Thanks.

Be seeing you.

U.Sb
Attachments
12112016.zip
(127.11 KiB) Downloaded 318 times
USBEprom
Full Member
Full Member
 
Posts: 174
Joined: Wed Mar 14, 2012 4:09 pm

Re: Bus Pirate - Community Firmware 7.0

Postby joeblack » Sun Jan 22, 2017 5:40 am

Hi USBEprom, i saw there were some small improvements (like on i2c) since your last compilation from above.
Would you be so kind, compile and share the latest version for BP V3 based on changelog 7.1:
https://github.com/BusPirate/Bus_Pirate ... ANGELOG.md

Thanks for your and agattis help to keep BPv3 allive
Joe black
joeblack
Newbie
Newbie
 
Posts: 8
Joined: Sat Oct 15, 2016 5:23 pm

Re: Bus Pirate - Community Firmware 7.0

Postby USBEprom » Sun Jan 22, 2017 3:01 pm

Hi joeblack.
Unfortunately due of something which is hard to identify after the applying of the improvements I2C does not work as expected.
agatti was able to produce a new code with which it is possible to enable I2C protocol via hardware, not only software.
Using his code I have built different firmware where unfortunately I2C protocol works for the hardware side but does not for the software.
When in hardware I2C then timings are right, when in software I2C then timings are too slow does not matching the code.
It seems that the culprit may be the patch #23 which was introduced in order to correct timings for the 1-WIRE protocol but that no one knows how it interferes with the I2C protocol.
agatti bought some specific hardware to solve the problem but for now there is not a solution.
At the moment is not possible build a new firmware omitting the patch #23.
Furthermore in order to unlock the hardware I2C protocol agatti introduced some workarounds (http://ww1.microchip.com/downloads/en/D ... 00470j.pdf) that do not make it safe to use the new firmware with all the Bus Pirate v3 due differences into the silicon layer of the PICs used.
For all this reason I can not share my new firmwares.
Take a look at these:

https://github.com/BusPirate/Bus_Pirate/issues/39
https://github.com/BusPirate/Bus_Pirate ... -269915680
https://github.com/BusPirate/Bus_Pirate/issues/23
https://github.com/BusPirate/Bus_Pirate ... -271163833

Thanks.

Be seeing you.

U.Sb
USBEprom
Full Member
Full Member
 
Posts: 174
Joined: Wed Mar 14, 2012 4:09 pm

Re: Bus Pirate - Community Firmware 7.0

Postby joeblack » Mon Jan 23, 2017 10:21 am

No problem, thanks for the infos, hope agatti will find a solution.
i will track the thread.
joe black
joeblack
Newbie
Newbie
 
Posts: 8
Joined: Sat Oct 15, 2016 5:23 pm

Re: Bus Pirate - Community Firmware 7.0

Postby mikeb » Thu Apr 06, 2017 2:41 am

Hopefully more people will discover about this project
mikeb
Newbie
Newbie
 
Posts: 40
Joined: Fri Sep 09, 2016 2:50 am

Re: Bus Pirate - Community Firmware 7.0

Postby USBEprom » Fri Apr 07, 2017 3:24 pm

Hi mikeb.
I agree.
Unfortunately until now no progress about problems into the SPI and I2C protocol.
Even using the latest repository SPI and I2C still do not work on Bus Pirate revision 3.
I wonder if Bus Pirate revision 4 has not them because I have read nothing about them related with Bus Pirate revision 4.
Hoping in the future.

Be seeing you.

U.Sb
USBEprom
Full Member
Full Member
 
Posts: 174
Joined: Wed Mar 14, 2012 4:09 pm

Re: Bus Pirate - Community Firmware 7.0

Postby USBEprom » Sat Apr 15, 2017 11:06 am

Hi guys.
agatti has recently fixed the problems with SPI and 2WIRE protocols (https://github.com/BusPirate/Bus_Pirate/issues/45) and (https://github.com/BusPirate/Bus_Pirate/issues/46).
So I was able to build new firmwares v7.1 for the Bus Pirate revision 3 using the new repository (https://github.com/BusPirate/Bus_Pirate ... master.zip).
I made two versions that i named SAFE_13042017 and UNSAFE_13042017.
Both of them have all the features enabled, BASIC too, the command line allows up 256 characters.
The first one (SAFE_13042017) simply it has all the fixes provided by agatti in order to make working again the SPI and 2WIRE protocols.
So into configuration.h I changed lines from 316 to 331 in order to enable all the features available, BASIC too.

#ifdef BUSPIRATEV3
#define BP_ENABLE_1WIRE_SUPPORT
#define BP_ENABLE_BASIC_SUPPORT
#define BP_ENABLE_DIO_SUPPORT
#define BP_ENABLE_HD44780_SUPPORT
#define BP_ENABLE_I2C_SUPPORT
#define BP_ENABLE_JTAG_SUPPORT
#define BP_ENABLE_PIC_SUPPORT
#define BP_ENABLE_PC_AT_KEYBOARD_SUPPORT
#define BP_ENABLE_RAW_2WIRE_SUPPORT
#define BP_ENABLE_RAW_3WIRE_SUPPORT
#define BP_ENABLE_SMPS_SUPPORT
#define BP_ENABLE_SPI_SUPPORT
#define BP_ENABLE_SUMP_SUPPORT
#define BP_ENABLE_UART_SUPPORT
#endif /* BUSPIRATEV3 */


Then I changed the line 417 too in this way in order to make room for BASIC scripting:

#define BP_BASIC_PROGRAM_SPACE 512

Finally I had to set line 535 for up 256 characters into the command line by changing it in this way:

/**
* How big the serial command buffer can be, in bytes.
*
* @warning This must be set to a power of two, ie. 256, 128, 64, 32, etc.
*/
#ifdef BUSPIRATEV3
#define BP_COMMAND_BUFFER_SIZE 256
#else
#define BP_COMMAND_BUFFER_SIZE 256
#endif /* BUSPIRATEV3 */


The result that I have achieved I have called it SAFE_13042017_1.hex and SAFE_13042017_s.hex.
SAFE_13042017_1.hex was obtained by using the compression option "1" of MPLAB, while instead for SAFE_13042017_s.hex I used compression option "s".
Compression option "1" assure right timing that option "s" may not ensure.
So the firmware to use is SAFE_13042017_1.hex, SAFE_13042017_s.hex was built only for test.
For me it works great.
Thanks a lot to agatti for having fixed the repository!

---------------------------------------------------------

The second one (UNSAFE_13042017) plus all the fixes provided by agatti in order to make working again the SPI and 2WIRE protocols, it has the HARDWARE mode unlocked for the I2C protocol.
Indeed in the recent past agatti taught how to free the HARDWARE mode inside I2C protocol (https://github.com/BusPirate/Bus_Pirate/issues/39).
Please read the above link carefully!
As agatti wrote:
"Dangerous Prototypes' original firmware did not use hardware I2C due to hardware bugs in PIC24FJ64GA004 chips with revision A3 or A4.
Now that hardware I2C is enabled again and the appropriate workarounds detailed here (http://ww1.microchip.com/downloads/en/D ... 00470j.pdf) have been applied, we need to test those on real hardware.

The catch: the code is experimental and it may or may not mess up with your hardware, just in case."
In order to build this new enhanced firmware into configuration.h I changed lines from 316 to 331 in order to enable all the features available, BASIC too.

#ifdef BUSPIRATEV3
#define BP_ENABLE_1WIRE_SUPPORT
#define BP_ENABLE_BASIC_SUPPORT
#define BP_ENABLE_DIO_SUPPORT
#define BP_ENABLE_HD44780_SUPPORT
#define BP_ENABLE_I2C_SUPPORT
#define BP_ENABLE_JTAG_SUPPORT
#define BP_ENABLE_PIC_SUPPORT
#define BP_ENABLE_PC_AT_KEYBOARD_SUPPORT
#define BP_ENABLE_RAW_2WIRE_SUPPORT
#define BP_ENABLE_RAW_3WIRE_SUPPORT
#define BP_ENABLE_SMPS_SUPPORT
#define BP_ENABLE_SPI_SUPPORT
#define BP_ENABLE_SUMP_SUPPORT
#define BP_ENABLE_UART_SUPPORT
#endif /* BUSPIRATEV3 */


Then I changed the line 417 too in this way in order to make room for BASIC scripting:

#define BP_BASIC_PROGRAM_SPACE 512

And then I had to set line 535 for up 256 characters into the command line by changing it in this way:

/**
* How big the serial command buffer can be, in bytes.
*
* @warning This must be set to a power of two, ie. 256, 128, 64, 32, etc.
*/
#ifdef BUSPIRATEV3
#define BP_COMMAND_BUFFER_SIZE 256
#else
#define BP_COMMAND_BUFFER_SIZE 256
#endif /* BUSPIRATEV3 */


Finally I had to put a remark sign ("//") inside line 382 and 391 in order to unlock the HARDWARE mode for the I2C protocol:

382 // #ifdef BUSPIRATEV4

391 // #endif /* BUSPIRATEV4 */

The result that I have achieved I have called it UNSAFE_13042017_1.hex and UNSAFE_13042017_s.hex.
UNSAFE_13042017_1.hex was obtained by using the compression option "1" of MPLAB, while instead for UNSAFE_13042017_s.hex I used compression option "s".
Compression option "1" assure right timing that option "s" may not ensure.
So the firmware to use is UNSAFE_13042017_1.hex, UNSAFE_13042017_s.hex was built only for test.

For me it works but you use it at your own risk, I do not take any responsibility about the possibility of damaging your Bus Pirate or whatever!
Attention please!
First to attempt to use this version of the firmware you have to evaluate what is the silicon revision of the PIC used in your device, paying much attention to the fact that you might damage your device or whatever!
For this reason the archive which contains this unsafe version of the firmware v7.1 is password protected.
The password is:


UNSAFE_FW

all uppercase.
You have to insert it in order to unpack the firmware.
By doing it you must to assume all the responsibility for your action.
You use it at your own risk, I do not take any responsibility about the possibility of damaging your Bus Pirate or whatever!


Thanks a lot to agatti for having fixed the repository and freed the HARDWARE mode inside of I2C protocol!

Be seeing you.

U.Sb
Attachments
SAFE_13042017.zip
(126.69 KiB) Downloaded 225 times
UNSAFE_13042017.zip
(113.5 KiB) Downloaded 116 times
Last edited by USBEprom on Mon Apr 17, 2017 5:25 am, edited 1 time in total.
USBEprom
Full Member
Full Member
 
Posts: 174
Joined: Wed Mar 14, 2012 4:09 pm

Re: Bus Pirate - Community Firmware 7.0

Postby A340 » Sun Apr 16, 2017 1:10 am

Hi USBEprom,

I am new to Bus Pirate. I will like to upgrade it to your 7.1 FW. Below are my current specification. I loaded 6.1 using Ds30 Loader.
However when I try to load your 7.1, I am not seeing the tick in the write program box and Ds30 is saying nothing to do.
Can you tell me how to get your 7.1 on my board please. Thanks.

Bus Pirate v3.5
Firmware v6.1 r1676 Bootloader v4.4
DEVID:0x0447 REVID:0x3046 (24FJ64GA002 B8)
http://dangerousprototypes.com
A340
Newbie
Newbie
 
Posts: 4
Joined: Sat Apr 01, 2017 11:28 pm

PreviousNext

Return to Bus Pirate Development