Dangerous Prototypes

Dangerous Prototypes => Bus Pirate Development => Topic started by: ian on July 16, 2010, 09:41:18 am

Title: Firmware v5.4
Post by: ian on July 16, 2010, 09:41:18 am
This is the firmware v5.4 development thread. I don't have a major todo list for v5.4.

*Selectable CS?
*I2C clock stretching?
Title: Re: Firmware v5.4
Post by: Sjaak on July 16, 2010, 10:02:46 am
Time for me to add some things :) It is been a while since I added code to the BP..

[s:]- sending partial bytes in raw2wire and raw3wire (it won't make sense for bytewise protocols)[/s:]
- history and commandline editting? (need to look very wel into source if it is doable, can't promise anything)

As always subject to change ;)
Title: Re: Firmware v5.4
Post by: ian on July 17, 2010, 08:58:38 pm
Nice commit :)
Title: Re: Firmware v5.4
Post by: Sjaak on July 17, 2010, 09:08:28 pm
I just checked in rev [s:]442[/s:] 443.

- added partial read/write (less then 8 bits)
- added lsb/msb swap to send string
- fixed several minor bugs.
- compacted the infoscreen

I made a small goofup by reverting to much. rev 443 should be ok now.

partial read/write is invoked with adding ;[numbits] this is a persistent setting untill it is set again or the mode is exitted.

Code: [Select]
Bus Pirate v3a
Firmware v5.4RC (r443) Bootloader v4.1
DEVID:0x0447 REVID:0x3043 (B5)
http://dangerousprototypes.com
HiZ> m 6 1 1
R2W (spd hiz)=( 0 1 )
Ready
2WIRE> 0xaa
WRITE: 0xAA
2WIRE> 0xaa;4
WRITE: 0xAA;4
2WIRE> 0xaa
WRITE: 0xAA;4
2WIRE> 0x55:3
WRITE: 0x55;4 0x55;4 0x55;4
2WIRE> 0x55:4;2
WRITE: 0x55;2 0x55;2 0x55;2 0x55;2
2WIRE>

so : should be _before_ ; !

and the infoscreen is also displaying the number of bit read/written:

Code: [Select]
2WIRE> i
Bus Pirate v3a
Firmware v5.4RC (r443) Bootloader v4.1
DEVID:0x0447 REVID:0x3043 (B5)
http://dangerousprototypes.com
CFG1:0xF9DF CFG2:0x3F7F
*----------*
Pinstates:
1.(BR)  2.(RD)  3.(OR)  4.(YW)  5.(GN)  6.(BL)  7.(PU)  8.(GR)  9.(WT)  0.(Blk)
GND     3.3V    5.0V    ADC     VPU     AUX     SCL     SDA     -       -
P       P       P       I       I       I       O       O       I       I
GND     0.00V   0.00V   0.00V   0.00V   L       L       L       L       L
Power supplies OFF, Pull-up resistors OFF, Open drain outputs (H=Hi-Z, L=GND)
MSB set: MOST sig bit first, Number of bits read/write: 4
a/A/@ controls AUX pin
*----------*
2WIRE>

electrical characteristics, byteorder/bits, and auxilary on its own line.
Title: Re: Firmware v5.4
Post by: Sjaak on July 17, 2010, 09:10:20 pm
[quote author="ian"]
Nice commit :)
[/quote]

I'm sorry not to double check. I reverted raw2wire (because I thought i had nothing done her) but i shouldn't.

I left the CS for you :P
Title: Re: Firmware v5.4
Post by: ian on July 28, 2010, 12:16:54 pm
Quote
2WIRE> 0x55:4;2
WRITE: 0x55;2 0x55;2 0x55;2 0x55;2

This is really nice.

Does it make sense to clear the unused bits (0x01;2) or show the binary value (0b01) of partial writes?

I'm going to update the LCD library to the new adapter now. (picture attached)
Title: Re: Firmware v5.4
Post by: Sjaak on July 28, 2010, 12:38:58 pm
It would make sense to clear the unused bits, but the lsb/msb setting making a bit difficult (0x55 -> 0x40). I'll look into it.

I prefer to display the numbers as the user chooses.
Title: Re: Firmware v5.4
Post by: ian on July 28, 2010, 02:34:51 pm
Code: [Select]
LCD> (0)
 0.Macro menu
 1.LCD Reset
 2.Init LCD
 3.Clear LCD
 4.Cursor position ex:(4) 0
 6.Write test numbers ex:(6) 80
 7.Write test characters ex:(7) 80

LCD> (6)
01234567890123456789012345678901234567890123456789012345678901234567890123456789
LCD> (7)
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnop
LCD> (7)10
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnop
WRITE: 0x0A
LCD>

Got the new adapter working. It's SOOO much faster than the old one. The a whole screen refresh is instant. With the v1 you could watch each character pop up on the screen.

I didn;t make it multi-adapter compatible. I don;t think the v1 adapter has a large user base, and we save a bit of room by only doing the SPI adapter. The new adapter doesn't support reads, so all read stuff was removed.

I'm going to get a quote on this now to see how much cheaper it is than the v1.

I did notice that the macros don't consume the trailing value properly, they always use the default. The trailing value is interpreted as a value to write. Everything looked fine, I'm not sure why this happens. I added the 80 character default to both 6 and 7 for now, but that doesn't help much with 4.

I'll upload this code and a new nightly now.
Title: Re: Firmware v5.4
Post by: ian on July 28, 2010, 02:47:18 pm
I'm pleased with the current state of the RC, is there anything else you'd like to get in before a release? I'll prepare one for tomorrow.
Title: Re: Firmware v5.4
Post by: Sjaak on July 28, 2010, 03:19:45 pm
if you add an extra space after it?

Code: [Select]
(6) 80

I remember that code is a bit messy (the macro handler in procmenu.c together with the macro in lcd.c).

Shall I add userdefinable CS (:D) and partial writes?

Code: [Select]
0x55;2
write 0x01;2
Title: Re: Firmware v5.4
Post by: ian on July 28, 2010, 05:09:34 pm
I've been working on the PIC programmer buffer, and I could not figure out why nothing worked. It turns out numbits is initialized to 09. I added a =8 in bpinit and to the binmode I was working on. I think the buffer is really going to speed things up. I'm going to try to implement it for reads and writes tonight.
Title: Re: Firmware v5.4
Post by: ian on July 28, 2010, 06:36:24 pm
I'll get my new bulk commands tested and rolled into 5.4 too. The 18F version is done, it erases, programs, and verifies a 18F24J50 in 19.2seconds. That's a huge improvement over the previous method that
Title: Re: Firmware v5.4
Post by: Sjaak on July 28, 2010, 06:45:33 pm
[quote author="ian"]
I'll get my new bulk commands tested and rolled into 5.4 too. The 18F version is done, it erases, programs, and verifies a 18F24J50 in 19.2seconds. That's a huge improvement over the previous method that
[/quote]

Cool!

(looks like you press post too early ;) I'm wondering how long it used to take :D)
Title: Re: Firmware v5.4
Post by: ian on July 28, 2010, 06:47:58 pm
Minutes :)
Title: Re: Firmware v5.4
Post by: Sjaak on July 28, 2010, 08:14:48 pm
[quote author="ian"]
Minutes :)
[/quote]

I noticed it in the picprog topic. :D

Just checked in rev. 449. Changelog:

- selectable CS in SPI and raw3wire
- fixed macro bug in LCD

Code: [Select]
HiZ> m 7
Set speed:
 1. ~5KHz
 2. ~50KHz
 3. ~100KHz
 4. ~400KHz

(1)> 1
CS:
 1. CS
 2. /CS *default

(2)> 2
Select output type:
 1. Open drain (H=Hi-Z, L=GND)
 2. Normal (H=3.3V, L=GND)

(1)> 2
Ready
3WIRE> [
/CS ENABLED
3WIRE> i
Bus Pirate v3a
Firmware v5.4RC (r449) Bootloader v4.1
DEVID:0x0447 REVID:0x3043 (B5)
http://dangerousprototypes.com
CFG1:0xF9DF CFG2:0x3F7F
*----------*
Pinstates:
1.(BR)  2.(RD)  3.(OR)  4.(YW)  5.(GN)  6.(BL)  7.(PU)  8.(GR)  9.(WT)  0.(Blk)
GND     3.3V    5.0V    ADC     VPU     AUX     CLK     MOSI    CS      MISO
P       P       P       I       I       I       O       O       O       I
GND     0.00V   0.00V   0.00V   0.00V   L       L       L       L       L
Power supplies OFF, Pull-up resistors OFF, Normal outputs (H=3.3v, L=GND)
MSB set: MOST sig bit first, Number of bits read/write: 8
a/A/@ controls AUX pin
*----------*
3WIRE> ]
/CS DISABLED
3WIRE> i
Bus Pirate v3a
Firmware v5.4RC (r449) Bootloader v4.1
DEVID:0x0447 REVID:0x3043 (B5)
http://dangerousprototypes.com
CFG1:0xF9DF CFG2:0x3F7F
*----------*
Pinstates:
1.(BR)  2.(RD)  3.(OR)  4.(YW)  5.(GN)  6.(BL)  7.(PU)  8.(GR)  9.(WT)  0.(Blk)
GND     3.3V    5.0V    ADC     VPU     AUX     CLK     MOSI    CS      MISO
P       P       P       I       I       I       O       O       O       I
GND     0.00V   0.00V   0.00V   0.00V   L       L       L       H       L
Power supplies OFF, Pull-up resistors OFF, Normal outputs (H=3.3v, L=GND)
MSB set: MOST sig bit first, Number of bits read/write: 8
a/A/@ controls AUX pin
*----------*
3WIRE> m 7 1 1 2
R3W (spd csl hiz)=( 0 0 0 )
Ready
3WIRE> [
CS ENABLED
3WIRE> i
Bus Pirate v3a
Firmware v5.4RC (r449) Bootloader v4.1
DEVID:0x0447 REVID:0x3043 (B5)
http://dangerousprototypes.com
CFG1:0xF9DF CFG2:0x3F7F
*----------*
Pinstates:
1.(BR)  2.(RD)  3.(OR)  4.(YW)  5.(GN)  6.(BL)  7.(PU)  8.(GR)  9.(WT)  0.(Blk)
GND     3.3V    5.0V    ADC     VPU     AUX     CLK     MOSI    CS      MISO
P       P       P       I       I       I       O       O       O       I
GND     0.00V   0.00V   0.00V   0.00V   L       L       L       H       L
Power supplies OFF, Pull-up resistors OFF, Normal outputs (H=3.3v, L=GND)
MSB set: MOST sig bit first, Number of bits read/write: 8
a/A/@ controls AUX pin
*----------*
3WIRE> ]
CS DISABLED
3WIRE> i
Bus Pirate v3a
Firmware v5.4RC (r449) Bootloader v4.1
DEVID:0x0447 REVID:0x3043 (B5)
http://dangerousprototypes.com
CFG1:0xF9DF CFG2:0x3F7F
*----------*
Pinstates:
1.(BR)  2.(RD)  3.(OR)  4.(YW)  5.(GN)  6.(BL)  7.(PU)  8.(GR)  9.(WT)  0.(Blk)
GND     3.3V    5.0V    ADC     VPU     AUX     CLK     MOSI    CS      MISO
P       P       P       I       I       I       O       O       O       I
GND     0.00V   0.00V   0.00V   0.00V   L       L       L       L       L
Power supplies OFF, Pull-up resistors OFF, Normal outputs (H=3.3v, L=GND)
MSB set: MOST sig bit first, Number of bits read/write: 8
a/A/@ controls AUX pin
*----------*
3WIRE>

And for the lcd macro:

Code: [Select]
3WIRE> m
1. HiZ
2. 1-WIRE
3. UART
4. I2C
5. SPI
6. 2WIRE
7. 3WIRE
8. KEYB
9. LCD
x. exit(without change)

(1)> 9
This mode requires an adapter
Ready
LCD> (0)
 0.Macro menu
 1.LCD Reset
 2.Init LCD
 3.Clear LCD
 4.Cursor position ex:(4) 0
 6.Write test numbers ex:(6) 80
 7.Write test characters ex:(7) 80

LCD> (6) 20
01234567890123456789
LCD> (7) 5
!"#$%
LCD>

I didn't change the printing of partial bytes (yet). I'm planning reworking on that later on.
Title: Re: Firmware v5.4
Post by: Sjaak on July 29, 2010, 09:01:12 pm
I just updated the svn with a minor update. It displays the settings in a simular way when setting the mode and parameters from the commandline:

Code: [Select]
HiZ> m 7 1 2 2
R3W (spd csl hiz)=( 0 1 0 )
Ready
3WIRE>

you can (re)view this settings with the 'i' command:

Code: [Select]
3WIRE> i
Bus Pirate v3a
Firmware v5.4 (r450) Bootloader v4.1
DEVID:0x0447 REVID:0x3043 (B5)
http://dangerousprototypes.com
CFG1:0xF9DF CFG2:0x3F7F
*----------*
Pinstates:
1.(BR)  2.(RD)  3.(OR)  4.(YW)  5.(GN)  6.(BL)  7.(PU)  8.(GR)  9.(WT)  0.(Blk)
GND     3.3V    5.0V    ADC     VPU     AUX     CLK     MOSI    CS      MISO
P       P       P       I       I       I       O       O       O       I
GND     0.00V   0.00V   0.00V   0.00V   L       L       L       H       L
Power supplies OFF, Pull-up resistors OFF, Normal outputs (H=3.3v, L=GND)
MSB set: MOST sig bit first, Number of bits read/write: 8
a/A/@ controls AUX pin
R3W (spd csl hiz)=( 0 1 0 )
*----------*
3WIRE>

Not a very big change for the user, but it helps us to review the settings easier in case of trouble. The 'i' command now returns everything about the current settings.
Title: Re: Firmware v5.4
Post by: Sjaak on July 29, 2010, 10:07:29 pm
I just noticed we added lots of new commands, but didn't update the help screen...

So I just comitted rev 453 with a new help screen (and proper revisionnumber in base.h ;))
Title: Re: Firmware v5.4
Post by: ian on July 30, 2010, 10:57:14 am
I'm prepping this now. Thanks for the post, it's a huge help :)

I'll leave the part about the PIC programmer in, but unfortunately I've already changed stuff for it that is not in the v5.4 release ;)
Title: Re: Firmware v5.4
Post by: ian on July 30, 2010, 11:16:37 am
I had to make a new compile for v1a, so I also recompiled v3 with the latest PIC programming extensions. Packaged and posted. Unstickied.

( ! ) Fatal error: Uncaught exception 'Elk_Exception' with message 'Please try again. If you come back to this error screen, report the error to an administrator.' in /var/www/dangerousprototypes/forum/sources/database/Db-mysql.class.php on line 696
( ! ) Elk_Exception: Please try again. If you come back to this error screen, report the error to an administrator. in /var/www/dangerousprototypes/forum/sources/database/Db-mysql.class.php on line 696
Call Stack
#TimeMemoryFunctionLocation
10.01232147328session_write_close ( )...(null):0
20.01262278920ElkArte\sources\subs\SessionHandler\DatabaseHandler->write( )...(null):0
30.01262279696Database_MySQL->query( ).../DatabaseHandler.php:119
40.05722418424Database_MySQL->error( ).../Db-mysql.class.php:273