Bus Pirate - Community Firmware 7.0

Bus Pirate firmware and hardware development.

Re: Bus Pirate - Community Firmware 7.0

Postby USBEprom » Sun Nov 04, 2018 10:16 am

Hy guys.
Finally I was able to build a test firmware starting from the latest repository dated 04 November, 2018 released by Christopher Sam Soon (https://github.com/ChristopherSamSoon/Bus_Pirate).
For testing I built both SAFE (only I2C software) that UNSAFE (freed I2C hardware) firmwares and here in attachment are the results.
For me all it works fine, however I will continue the tests in order to assure there are not any sort of problem somewhere and then I will let you know.
Luckily in the end it seems that now everything is fine.

Many, many thanks to Christopher Sam Soon for having fix the whole matter, thank you sir!

Please pay attention to the fact that orange color for the caption about ~400kHz SOFTWARE mode does not mean it is working bad, simply that does not match the value into the menu.
Christopher Sam Soon has already explained there is a speed limit there so it may even be useful to change the value in the menu from ~400kHz to ~220kHz hence it would be full green as color.


https://github.com/BusPirate/Bus_Pirate/issues/23

Be seeing you.

U.Sb
Attachments
TEST.jpg
Screenshots taken with a logic analyzer
USBEprom
Full Member
Full Member
 
Posts: 172
Joined: Wed Mar 14, 2012 4:09 pm

Re: Bus Pirate - Community Firmware 7.0

Postby USBEprom » Mon Nov 05, 2018 4:35 pm

Hi guys.
Thanks to Christopher Sam Soon who has fixed and improved I2C, 2-WIRE and 3-WIRE protocol, agatti has built a new repository of the firmware v7.1 for the Bus Pirate (https://github.com/BusPirate/Bus_Pirate) so that I was able to build new firmwares v7.1 for the Bus Pirate revision 3 (https://github.com/BusPirate/Bus_Pirate/archive/master.zip).
I made two versions that i named S_1-05112018.hex and U_1-05112018.hex.
Both of them have all the features enabled, BASIC too, the command line allows up 256 characters.
The first one (S_1-05112018.hex), the so called SAFE version (S=SAFE), is built on the configuration.h changed as follow.
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

#undef BP_ENABLE_SMPS_SUPPORT
#define BP_ENABLE_SPI_SUPPORT
#define BP_ENABLE_SUMP_SUPPORT
#define BP_ENABLE_UART_SUPPORT
#endif /* BUSPIRATEV3 */


Please, pay attention that since recently the SMPS_SUPPORT for the Bus Pirate v3 has been removed, I left the line number 327 unchanged as #undef.

SMPS_SUPPORT is intended for the management of the SMPS_BOARD which is an abandoned or stalled board.
Exactly it is this:

http://dangerousprototypes.com/blog/200 ... y-6-parts/
http://dangerousprototypes.com/docs/Bus_Pirate_SMPS

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

#define BP_BASIC_PROGRAM_SPACE 512

Finally I had to set line 561 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 */


Delay code provided by Christopher Sam Soon to the main branch is currently enabled by default, but can be switched off by undefining BP_USE_HARDWARE_DELAY_TIMER in line 576 of configuration.h.

In order to match the real speeds now used for I2C SOFTWARE, 2-WIRE and 3-WIRE in messages_v3.s line 1553 I changed ~400kHz to ~220kHz and more in general I changed all the terms KHz, which is wrong as a unit of measure, in kHz which is the right word.

The result that I have achieved I have called it S_1-05112018.hex.
S_1-05112018.hex was obtained by using the compression option "1" of MPLAB so to be in fully accordance with the latest recommendations issued about the compilation of the new repositories using MPLAB in order to build new firmwares for the Bus Pirate v3 and v4.
Compression option "1" assure right timing that option "s" may not ensure.
For me it works great.
Thanks a lot to Christopher Sam Soon for having fixed the matter!

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

The second one (U_1-05112018.hex) is the same as S_1-05112018.hex but also 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."
U_1-05112018.hex, the so called UNSAFE version (U=UNSAFE) is built on the configuration.h changed as follow.
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

#undef BP_ENABLE_SMPS_SUPPORT
#define BP_ENABLE_SPI_SUPPORT
#define BP_ENABLE_SUMP_SUPPORT
#define BP_ENABLE_UART_SUPPORT
#endif /* BUSPIRATEV3 */


Please, pay attention that since recently the SMPS_SUPPORT for the Bus Pirate v3 has been removed, I left the line number 327 unchanged as #undef.

SMPS_SUPPORT is intended for the management of the SMPS_BOARD which is an abandoned or stalled board.
Exactly it is this:

http://dangerousprototypes.com/blog/200 ... y-6-parts/
http://dangerousprototypes.com/docs/Bus_Pirate_SMPS

Then I changed the line 425 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 561 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 */


Then 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 */

Delay code provided by Christopher Sam Soon to the main branch is currently enabled by default, but can be switched off by undefining BP_USE_HARDWARE_DELAY_TIMER in line 576 of configuration.h.

And finally in order to match the real speeds now used for I2C SOFTWARE, 2-WIRE and 3-WIRE in messages_v3.s line 1553 I changed ~400kHz to ~220kHz and more in general I changed all the terms KHz, which is wrong as a unit of measure, in kHz which is the right word.

The result that I have achieved I have called it U_1-05112018.hex.
U_1-05112018.hex was obtained by using the compression option "1" of MPLAB so to be in fully accordance with the latest recommendations issued about the compilation of the new repositories using MPLAB in order to build new firmwares for the Bus Pirate v3 and v4.
Compression option "1" assure right timing that option "s" may not ensure.

For me it works great, 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 U_1-05112018.hex (UNSAFE 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!
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 Christopher Sam Soon for having fixed the matter and agatti for having freed the HARDWARE mode inside of I2C protocol!

Please note that both S_1-05112018.hex and U_1-05112018.hex were compiled with MPLAB-X IDE v5.00 and the XC-16 v1.35 compiler on Ubuntu 18.04 computer because the latest repositories are not natively compatible with MPLAB-X IDE v4.xx and earlier and both of them require the new bootloader v4.5 in order to work completely (viewtopic.php?f=28&t=8498&start=75#p67056 and viewtopic.php?f=28&t=8498&p=67056#p67127).
Otherwise if do not, enter BOOTLOADER using command "$" will not work (https://github.com/BusPirate/Bus_Pirate/issues/58).
Actually it is not really a problem on the firmware side but rather of the bootloader.
In order to fix the matter it is need to upgrade the bootloader to the new revision v4.5:

viewtopic.php?f=28&t=619#p67037

viewtopic.php?f=28&t=8498&start=60#p67043

https://github.com/BusPirate/Bus_Pirate/issues/38

https://github.com/BusPirate/Bus_Pirate/issues/58

viewtopic.php?f=28&t=8498&p=67056#p67056


With the firmwares I also provide a pre configured environment that anyone can use with minimal changes to simplify the upgrade of the only firmware or together the bootloader and the firmware in a single step.
The archive also provides further improved instructions on how to use the whole thing under any operative system (Window, Linux and Apple), simply follow them :

"How to use UPGRADE_TO_BL_v4.5.bat.rtf" (specific instructions for Windows users)
"How to update with pirate-loader.rtf" (generic cross-platform instructions for Windows, Linux and Apple users)

Please note that the package is a 7z (7zip) archive because the maximum allowed size in the forum is 1 MiB.

Be seeing you.

U.Sb
Attachments
BPv3-bootloaderv4xtov45-update-vb_ENG-h.7z
Pre configured environment to simplify the upgrade of the only firmware or together the bootloader and the firmware in a single step.
Inside are instructions on how to use the whole thing under any operative system (Window, Linux and Apple):
"How to use UPGRADE_TO_BL_v4.5.bat.rtf" (specific instructions for Windows users)
"How to update with pirate-loader.rtf" (generic cross-platform instructions for Windows, Linux and Apple users)
(482.77 KiB) Downloaded 15 times
USBEprom
Full Member
Full Member
 
Posts: 172
Joined: Wed Mar 14, 2012 4:09 pm

Re: Bus Pirate - Community Firmware 7.0

Postby USBEprom » Sat Nov 10, 2018 8:32 am

Hi guys.
In the end I managed to test the functioning of the 1-WIRE protocol on the Pirate v3 Bus using the firmwares that I got from the current repository and therefore updated, concluding that everything works as expected.
For the tests I have followed the suggestion of agatti and I used an Arduino MEGA 2560 card borrowed from the usual friend of mine where was running a 1-WIRE SLAVE library.
Very sadly I have not in any way been able to test the 1-WIRE protocol with a real device, because despite all the attempts I made I could not read the iButton DS1990A-F5 I own.
I tried hard, I also purchased a real iButton socket probe reader provided with suppressor but no joy.
Maybe my DS1990A-F5 has something bad, even if it is weird because it is fully working using other than Bus Pirate, I do not know why it does not work with my Bus Pirate v3 which has the 2000ohm R20 pull-up resistor.
I would have liked to verify the 1-WIRE protocol with a real and not simulated device but in the end I had to resign myself to perform tests on devices emulated with Arduino.
The library that I used is here:

https://github.com/orgua/OneWireHub

It is the only one I could find that works with the Arduino MEGA 2560 board.
Among the other supported devices, the above library also manages the families DS1990, DS1990A and DS2401, so in the end, although only in emulation mode, I could virtually test the 1-WIRE protocol with the iButton DS1990A, because with the real one I own I have not succeeded.
For what I could see everything works correctly, even if I noticed a weirdness and could in my opinion be introduced some improvements.

(https://github.com/BusPirate/Bus_Pirate/issues/23)

Be seeing you.

U.Sb
Attachments
DS1990-DS1990A-DS2401.jpg
DS18B20.jpg
Arduino-1WIRE_SLAVE.jpg
DS2431_Arduino-1WIRE_SLAVE.jpg
USBEprom
Full Member
Full Member
 
Posts: 172
Joined: Wed Mar 14, 2012 4:09 pm

Previous

Return to Bus Pirate Development