Skip to main content
Topic: pin state printout (Read 2247 times) previous topic - next topic

pin state printout

Code: [Select]
Pin:SO|CK|SI|CS|AUX
Dir:ot|ot|in|ot|in|
Inp:lo|lo|lo|hi|lo|

I added a pin state printout to the information menu (i). It shows each pin, the direction (in/out), and the input state (low or high). It's a little compressed to make nice columns, I'm not sure ot is intuitive (or inp, for that matter). I'm open to suggestions.

The pin names also need to be changed. SO - is that miso or serial out (it's serial out), that's confusing. Probably MO MI would be better (but also less intuitive).

Code: [Select]
Select output type:
 1. Open drain (H=Hi-Z, L=GND)
 2. Normal (H=3.3V, L=GND)
(1) >2
READY
RAW3WIRE>i
Bus Pirate v3
Firmware v4.2 Bootloader v4.1
DEVID:0x0447 REVID:0x3043 (B5)
http://dangerousprototypes.com
*----------*
Pin:SO|CK|SI|CS|AUX
Dir:ot|ot|in|ot|in|
Inp:lo|lo|lo|hi|lo|
POWER SUPPLIES OFF
Voltage monitors: 5V: 0.00 | 3.3V: 0.00 | VPULLUP: 0.00 |
a/A/@ controls AUX pin
Normal outputs (H=V+, L=GND)
Pull-up resistors OFF
MSB set: MOST sig bit first
*----------*
RAW3WIRE>/
CLOCK, 1
RAW3WIRE>i
Bus Pirate v3
Firmware v4.2 Bootloader v4.1
DEVID:0x0447 REVID:0x3043 (B5)
http://dangerousprototypes.com
*----------*
Pin:SO|CK|SI|CS|AUX
Dir:ot|ot|in|ot|in|
Inp:lo|hi|lo|hi|lo|
POWER SUPPLIES OFF
Voltage monitors: 5V: 0.00 | 3.3V: 0.00 | VPULLUP: 0.00 |
a/A/@ controls AUX pin
Normal outputs (H=V+, L=GND)
Pull-up resistors OFF
MSB set: MOST sig bit first
*----------*
RAW3WIRE>_
DATA OUTPUT, 0
RAW3WIRE>-
DATA OUTPUT, 1
RAW3WIRE>i
Bus Pirate v3
Firmware v4.2 Bootloader v4.1
DEVID:0x0447 REVID:0x3043 (B5)
http://dangerousprototypes.com
*----------*
Pin:SO|CK|SI|CS|AUX
Dir:ot|ot|in|ot|in|
Inp:hi|hi|lo|hi|lo|
POWER SUPPLIES OFF
Voltage monitors: 5V: 0.00 | 3.3V: 0.00 | VPULLUP: 0.00 |
a/A/@ controls AUX pin
Normal outputs (H=V+, L=GND)
Pull-up resistors OFF
MSB set: MOST sig bit first
*----------*
RAW3WIRE>

This shows it working. The state changes as I twiddle the pins.

It might also be nice to have this as a separate menu, I could find it useful for verifying that libraries work as intended.

I'm adding to the newterm version now, will update SVN and nightlies shortly.
Got a question? Please ask in the forum for the fastest answers.

Re: pin state printout

Reply #1
Good job!

How about just I/O and H/L/Z (or 1/0/Z) ? You can also use the pinnumber instead of the name to keep it more general.

BTW: I'm almost finished with the textsubsys and the improved help for newterm.

Re: pin state printout

Reply #2
I was just writing to ask about the text subsys ;) The newterm looks great, I'd like to make a preview release, I'm still working on documentation for the script and new menu system.

I'm trying to finish the demo board with the LCD adapter, so I'll get around to porting the LCD to newterm shortly.
Got a question? Please ask in the forum for the fastest answers.

Re: pin state printout

Reply #3
Hehe. I'm trying to get it out today or tomorrow. Also the lcd library was still on the todo list together with lots of things ;)

Re: pin state printout

Reply #4
[quote author="Sjaak"]How about just I/O and H/L/Z (or 1/0/Z) ? You can also use the pinnumber instead of the name to keep it more general.[/quote]I second the I/O and H/L/Z, but suggest using both pin number and name for maximum readability. Then, if you pick a confusing abbreviation for the name, the number will be a certain identifier.

Another suggestion is to put each pin on its own row instead of in a column.  The columns would then become Pin Number, Pin Name, Direction, and State.  With only 5 pins being reported, there's not much difference between a 3-line, 4-line, or 5-line report.

Re: pin state printout

Reply #5
I personally like the way how it is presented now, however I would have used tabs instead of the pipe character to. I find it easier to read (find in just one look) the info if it is presented in collumns. The voltage readout is also in presented in collumns.

Re: pin state printout

Reply #6
@ian, I could resist :D, but i've combined the voltage measurement with your pinstate command.. also did a bit of cosmetic changes..

This is what I've come up with:
Code: [Select]
1-WIRE> i
Bus Pirate v3
Firmware v4.2 (newterm-basic)  Bootloader v255.255
CFG1:0xF9DF CFG2:0x3F7F
DEVID:0x0447 REVID:0x3043 (B5)
http://dangerousprototypes.com
*----------*
Pinstates:
GND     3.3V    5.0V    ADC     VPU     AUX     CLK     MOSI    CS      MISO
P       P       P       I       I       I       I       I       I       I
GND     0.00V   0.00V   0.00V   0.00V   L       L       L       L       L
POWER SUPPLIES OFF
a/A/@ controls AUX pin
Open drain outputs (H=Hi-Z, L=GND)
Pull-up resistors OFF
Bitorder configuration not allowed
*----------*
1-WIRE> W
POWER SUPPLIES ON
1-WIRE> i
Bus Pirate v3
Firmware v4.2 (newterm-basic)  Bootloader v255.255
CFG1:0xF9DF CFG2:0x3F7F
DEVID:0x0447 REVID:0x3043 (B5)
http://dangerousprototypes.com
*----------*
Pinstates:
GND     3.3V    5.0V    ADC     VPU     AUX     CLK     MOSI    CS      MISO
P       P       P       I       I       I       I       I       I       I
GND     3.26V   4.93V   0.00V   0.00V   L       L       L       L       L
POWER SUPPLIES ON
a/A/@ controls AUX pin
Open drain outputs (H=Hi-Z, L=GND)
Pull-up resistors OFF
Bitorder configuration not allowed
*----------*
1-WIRE> v
Pinstates:
GND     3.3V    5.0V    ADC     VPU     AUX     CLK     MOSI    CS      MISO
P       P       P       I       I       I       I       I       I       I
GND     3.26V   4.92V   0.00V   0.00V   L       L       L       L       L
1-WIRE>

I didn't jumper anyhting, just enabled the PSU



Offtopic: i think the voltages are way off, any ideas? my other bp is much closer to 3.3 and 5 then this one...

Re: pin state printout

Reply #7
I really like it, less space is taken up.

P=power, I=input, o=output?
L/H (low/high)?

I think some of the 5.0volt regulators are better than others (less drop out from 5v USB). Also, The voltage divider resistors are probably 5% or worse, so some will be a bit off.
Got a question? Please ask in the forum for the fastest answers.

Re: pin state printout

Reply #8
yes. I thought about detecting hiz but i realized the pin is then inputmode :)

i used tabs so no worry about space ;)

Re: pin state printout

Reply #9
Tabs are a smart move, I like it.
Got a question? Please ask in the forum for the fastest answers.