Skip to main content
Topic: BP Demo board v5 firmware development (Read 9574 times) previous topic - next topic

Re: BP Demo board v5 firmware development

Reply #15
[quote author="Sjaak"]You can enable i2c hardware support on bp (code should br there) or move to a lower bitrate. Also run the bpdemo at a higher clock.[/quote]
Thanks, increasing the clk rate helped it working with the BPv3

so far I got the I2C to work with all devices, so PWM works :)

One question about SPI, what setting do you use with the Bus Pirate, I can easily send data to it, butt reading from it dosen't seem to happen...
 I'm using your default code, just to see the communication....

BP SPI settings and a BP SPI read example would be much apreatited, if you got it to send you back a byte...
thanks..

for I2C PWM,
adress is 0x30
0 is period, 1 is duty
so [0x30 0 25 33] sets the period (PR2 to 25, and the duty cycle to 33%)
[0x30 0 99]  changes the period to 99.
[0x30 1 72] changes the duty cycle to 72%
reading is the same as eeeprom reads...two consecutive reads when the adres is seto to 0 will return the period and duty cycle
best regards FIlip.

Re: BP Demo board v5 firmware development

Reply #16
Congrats on the working I2C Fil

Re: BP Demo board v5 firmware development

Reply #17
I found the old topic about the demoboard (and firmware). I think it is an interesting read about the thoughts (and weird behauviour) we had. it is here: viewtopic.php?f=64&t=3083&hilit=demoboard

It also describes the spi behaviour you asked. it uses the standard settings of the bp.

One thing i recall is to enable interrupts for UART reception.

Re: BP Demo board v5 firmware development

Reply #18
thanks, but I got it under control, the TRIS bit for the MISO pin was set insted of cleard :)
best regards FIlip.

Re: BP Demo board v5 firmware development

Reply #19
Whoo hoo Demo Board Firware complete :)

All devices, and all protocols functional...
UART speed 9600...
controll through macro (1)....

DAC/and PWM peripherals can be controlled through UART, but can't be rad by the BP since, in macro (1) you can't send commands like d (read ADC) or f (read freq, etc)...

Only clean-up and documentation is left....
best regards FIlip.

Re: BP Demo board v5 firmware development

Reply #20
Ok tested it out with a programed release...
here are the terminals from varius tests, SPI EEPRMOm, and ADC still need some work...

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

(1)>4
Set speed:
 1. ~5KHz
 2. ~50KHz
 3. ~100KHz
 4. ~400KHz

(1)>3
Ready
I2C>W
Power supplies ON
I2C>P
Pull-up resistors ON
I2C>(1)
Searching I2C address space. Found devices at:
0x10(0x08 W) 0x11(0x08 R)

I2C>[0x10 0]
I2C START BIT
WRITE: 0x10 ACK
WRITE: 0x00 ACK
I2C STOP BIT
I2C>[0x11 r]
I2C START BIT
WRITE: 0x11 ACK
READ: 0xFF
NACK
I2C STOP BIT
I2C>[0x10 1]
I2C START BIT
WRITE: 0x10 ACK
WRITE: 0x01 ACK
I2C STOP BIT
I2C>[0x11 r]
I2C START BIT
WRITE: 0x11 ACK
READ: 0xAC
NACK
I2C STOP BIT
I2C>[0x10 2]
I2C START BIT
WRITE: 0x10 ACK
WRITE: 0x02 ACK
I2C STOP BIT
I2C>[0x11 r]
I2C START BIT
WRITE: 0x11 ACK
READ: 0x56
NACK
I2C STOP BIT
I2C>[0x10 3]
I2C START BIT
WRITE: 0x10 ACK
WRITE: 0x03 ACK
I2C STOP BIT
I2C>[0x11 r]
I2C START BIT
WRITE: 0x11 ACK
READ: 0xFF
NACK

I2C/DAC
Code: [Select]
I2C>w
Power supplies OFF
I2C>W
Power supplies ON
I2C>(1)
Searching I2C address space. Found devices at:
0x20(0x10 W) 0x21(0x10 R)

I2C>d
VOLTAGE PROBE: 0.00V
I2C>d
VOLTAGE PROBE: 0.00V
I2C>[0x20 128]
I2C START BIT
WRITE: 0x20 ACK
WRITE: 0x80 ACK
I2C STOP BIT
I2C>d
VOLTAGE PROBE: 1.63V
I2C>d
VOLTAGE PROBE: 1.63V
I2C>[0x20 200]
I2C START BIT
WRITE: 0x20 ACK
WRITE: 0xC8 ACK
I2C STOP BIT
I2C>d
VOLTAGE PROBE: 2.56V
I2C>d
VOLTAGE PROBE: 2.56V
I2C>[0x20 255]
I2C START BIT
WRITE: 0x20 ACK
WRITE: 0xFF ACK
I2C STOP BIT
I2C>d
VOLTAGE PROBE: 3.17V
I2C>[0x20 0]
I2C START BIT
WRITE: 0x20 ACK
WRITE: 0x00 ACK
I2C STOP BIT
I2C>d
VOLTAGE PROBE: 0.00V

I2C/EEPROM

Code: [Select]
I2C>w
Power supplies OFF
I2C>W
Power supplies ON
I2C>(1)
Searching I2C address space. Found devices at:
0xA0(0x50 W) 0xA1(0x50 R)

I2C>[0xA0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14]
I2C START BIT
WRITE: 0xA0 ACK
WRITE: 0x00 ACK
WRITE: 0x01 ACK
WRITE: 0x02 ACK
WRITE: 0x03 ACK
WRITE: 0x04 ACK
WRITE: 0x05 ACK
WRITE: 0x06 ACK
WRITE: 0x07 ACK
WRITE: 0x08 ACK
WRITE: 0x09 ACK
WRITE: 0x0A ACK
WRITE: 0x0B ACK
WRITE: 0x0C ACK
WRITE: 0x0D ACK
WRITE: 0x0E ACK
I2C STOP BIT
  > 0 a          ]
I2C>]
I2C STOP BIT
I2C>[0xa0 0]
I2C START BIT
WRITE: 0xA0 ACK
WRITE: 0x00 ACK
I2C STOP BIT
I2C>[0xa1 r]
I2C START BIT
WRITE: 0xA1 ACK
READ: 0x01
NACK
I2C STOP BIT
I2C>[0xa1 rrr]
I2C START BIT
WRITE: 0xA1 ACK
READ: 0x02
READ:  ACK 0x03
READ:  ACK 0x04
NACK
I2C STOP BIT
I2C>[0xa1 r:10]
I2C START BIT
WRITE: 0xA1 ACK
READ: 0x05  ACK 0x06  ACK 0x07  ACK 0x08  ACK 0x09  ACK 0x0A  ACK 0x0B  ACK 0x0C  ACK 0x0D  ACK 0x0E
NACK
I2C STOP BIT

I2C/PWM

Code: [Select]
I2C>w
Power supplies OFF
I2C>W
Power supplies ON
I2C>f
AUX Frequency: 2,668,544 Hz
I2C>(1)
Searching I2C address space. Found devices at:
0x30(0x18 W) 0x31(0x18 R)

I2C>f
AUX Frequency: 2,668,544 Hz
I2C>[0x30 0 25]
I2C START BIT
WRITE: 0x30 ACK
WRITE: 0x00 ACK
WRITE: 0x19 ACK
I2C STOP BIT
I2C>f
AUX Frequency: 307,968 Hz
I2C>[0x30 0 255]
I2C START BIT
WRITE: 0x30 ACK
WRITE: 0x00 ACK
WRITE: 0xFF ACK
I2C STOP BIT
I2C>f
AUX Frequency:  autorange 31,293 Hz
I2C>[0x30 0]
I2C START BIT
WRITE: 0x30 ACK
WRITE: 0x00 ACK
I2C STOP BIT
I2C>[0x31 rr]
I2C START BIT
WRITE: 0x31 ACK
READ: 0xFF
READ:  ACK 0x32
NACK
I2C STOP BIT
I2C>[0x30 0 50]
I2C START BIT
WRITE: 0x30 ACK
WRITE: 0x00 ACK
WRITE: 0x32 ACK
I2C STOP BIT
I2C>[0x31 rr]
I2C START BIT
WRITE: 0x31 ACK
READ: 0x32
READ:  ACK 0x32
NACK
I2C STOP BIT

SPI--------------------------------

SPI/DAC

Code: [Select]
SPI>[16 15]
/CS ENABLED
WRITE: 0x10
WRITE: 0x0F
/CS DISABLED
SPI>d
VOLTAGE PROBE: 1.52V
SPI>[16 10]
/CS ENABLED
WRITE: 0x10
WRITE: 0x0A
/CS DISABLED
SPI>d
VOLTAGE PROBE: 1.01V
SPI>d
VOLTAGE PROBE: 1.01V
SPI>[16 ] ]1
/CS ENABLED
WRITE: 0x10
WRITE: 0x00
/CS DISABLED
Syntax error at char 7
SPI>d
VOLTAGE PROBE: 0.00V
SPI>[16 31]
/CS ENABLED
WRITE: 0x10
WRITE: 0x1F
/CS DISABLED
SPI>d
VOLTAGE PROBE: 3.17V

SPI/PWM

Code: [Select]
SPI>f
AUX Frequency: 2,669,568 Hz
SPI>[0 4]
/CS ENABLED
WRITE: 0x00
WRITE: 0x04
/CS DISABLED
SPI>f
AUX Frequency: 1,601,792 Hz
SPI>[0 8]
/CS ENABLED
WRITE: 0x00
WRITE: 0x08
/CS DISABLED
SPI>f
AUX Frequency: 889,856 Hz
SPI>[0 255]
/CS ENABLED
WRITE: 0x00
WRITE: 0xFF
/CS DISABLED
SPI>f
AUX Frequency:  autorange 31,284 Hz
SPI>[1 25]
/CS ENABLED
WRITE: 0x01
WRITE: 0x19
/CS DISABLED
SPI>f
AUX Frequency:  autorange 31,291 Hz
SPI>[1 25 r]
/CS ENABLED
WRITE: 0x01
WRITE: 0x19
READ: 0x19
/CS DISABLED

UART is menu based, the BP talks to the demo board and yo chose trough the options...
setup the terminal to transmit CR for EoL, and recive LF as EOL

UART BP setup and entering menu

Code: [Select]
UART setup (receve LF) (transmit CR)
--------------------

HiZ>m
1. HiZ
2. 1-WIRE
3. UART
4. I2C
5. SPI
6. 2WIRE
7. 3WIRE
8. LCD
9. DIO
x. exit(without change)

(1)>3
Set serial port speed: (bps)
 1. 300
 2. 1200
 3. 2400
 4. 4800
 5. 9600
 6. 19200
 7. 38400
 8. 57600
 9. 115200
10. BRG raw value

(1)>5
Data bits and parity:
 1. 8, NONE *default
 2. 8, EVEN
 3. 8, ODD
 4. 9, NONE
(1)>1
Stop bits:
 1. 1 *default
 2. 2
(1)>1
Receive polarity:
 1. Idle 1 *default
 2. Idle 0
(1)>1
Select output type:
 1. Open drain (H=Hi-Z, L=GND)
 2. Normal (H=3.3V, L=GND)

(1)>2
Ready
UART>W
Power supplies ON
UART>(1)
UART bridge
Reset to exit
Are you sure? y
mm

Bus Pirate Demo Board v5
FW verison v0.95

  Main Menu
-------------

1)ADC
2)PWM
3)DAC
4)EEPROM

Choose(1-4):

*I'll post links to datasheets and the SPI eeprom/ADC fixed code shortly....
best regards FIlip.

Re: BP Demo board v5 firmware development

Reply #21
Nice job, thanks Filip. I'llprepare this for production next week.
Got a question? Please ask in the forum for the fastest answers.

Re: BP Demo board v5 firmware development

Reply #22
SPI/EEPROM

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

(1)>5
Set speed:
 1. 30KHz
 2. 125KHz
 3. 250KHz
 4. 1MHz

(1)>3
Clock polarity:
 1. Idle low *default
 2. Idle high

(1)>1
Output clock edge:
 1. Idle to active
 2. Active to idle *default

(2)>2
Input sample phase:
 1. Middle *default
 2. End

(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
SPI>W
Power supplies ON
SPI>[6]
/CS ENABLED
WRITE: 0x06
/CS DISABLED
SPI>[2 50 1 2 3 4 5 6 7 8 9 10 11 12]
/CS ENABLED
WRITE: 0x02
WRITE: 0x32
WRITE: 0x01
WRITE: 0x02
WRITE: 0x03
WRITE: 0x04
WRITE: 0x05
WRITE: 0x06
WRITE: 0x07
WRITE: 0x08
WRITE: 0x09
WRITE: 0x0A
WRITE: 0x0B
WRITE: 0x0C
/CS DISABLED
SPI>[4]
/CS ENABLED
WRITE: 0x04
/CS DISABLED
SPI>[3 50 r
/CS ENABLED
WRITE: 0x03
WRITE: 0x32
READ: 0x01
SPI>r
READ: 0x02
SPI>r
READ: 0x03
SPI>r
READ: 0x04
SPI>rr
READ: 0x05
READ: 0x06
SPI>rrr
READ: 0x07
READ: 0x08
READ: 0x09
SPI>]
/CS DISABLED

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

(1)>5
Set speed:
 1. 30KHz
 2. 125KHz
 3. 250KHz
 4. 1MHz

(1)>2
Clock polarity:
 1. Idle low *default
 2. Idle high

(1)>1
Output clock edge:
 1. Idle to active
 2. Active to idle *default

(2)>2
Input sample phase:
 1. Middle *default
 2. End

(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
SPI>W
Power supplies ON
SPI>[1 0 r]
/CS ENABLED
WRITE: 0x01
WRITE: 0x00
READ: 0xFF
/CS DISABLED
SPI>[1 16 r]
/CS ENABLED
WRITE: 0x01
WRITE: 0x10
READ: 0xAC
/CS DISABLED
SPI>[1 32 r]
/CS ENABLED
WRITE: 0x01
WRITE: 0x20
READ: 0x56
/CS DISABLED
SPI>[1 48 r]
/CS ENABLED
WRITE: 0x01
WRITE: 0x30
READ: 0xFF
/CS DISABLED
SPI>[1 48 r]
/CS ENABLED
WRITE: 0x01
WRITE: 0x30
READ: 0xCC
/CS DISABLED
SPI>[1 48 r]
/CS ENABLED
WRITE: 0x01
WRITE: 0x30
READ: 0xB6
/CS DISABLED
SPI>[1 48 r]
/CS ENABLED
WRITE: 0x01
WRITE: 0x30
READ: 0xB4
/CS DISABLED
SPI>[1 48 r]
/CS ENABLED
WRITE: 0x01
WRITE: 0x30
READ: 0xB4
/CS DISABLED
SPI>[1 48 r]
/CS ENABLED
WRITE: 0x01
WRITE: 0x30
READ: 0xC6
/CS DISABLED
SPI>[1 48 r]
/CS ENABLED
WRITE: 0x01
WRITE: 0x30
READ: 0xBA
/CS DISABLED
best regards FIlip.

 

Re: BP Demo board v5 firmware development

Reply #23
Datasheets
I2C ADC.
MCP3428  4chanell ADC
http://www.microchip.com/wwwproducts/De ... e=en545865
general call still unimplemented...

I2C DAC
CP47DA1
http://www.microchip.com/wwwproducts/De ... e=en557693

I2C PWM device we haven't chosen, a single PWM signal generator I2C doesn't exist, I haven't fount it yet..

I2C EEPROM
modeled after 24LC/AA02
http://ww1.microchip.com/downloads/en/D ... 21709J.pdf

SPI EEPROM modeled after 25AA020A
http://www.microchip.com/wwwproducts/De ... e=en025534
http://ww1.microchip.com/downloads/en/D ... 21833F.pdf

SPI DAC modeled after MCP4801 http://www.microchip.com/wwwproducts/De ... e=en547815
http://ww1.microchip.com/downloads/en/d ... 22244b.pdf

SPI ADC modeled after...MCP3004 4 chanel 10 bit ADC...
http://www.microchip.com/wwwproducts/De ... e=en010529
http://ww1.microchip.com/downloads/en/D ... 21295C.pdf

ALL have their chanels as folwos C0=ADC pin, C1=2/3 ADC pin, C2 = 1/3ADC pin...C3 = temp sensor

UART is used as a non emulated device, you control the demo board from it trough ASCII UART menu, which the Demo Board Provides, here we could also incude a bootleader through the BP...

*watch out the I2C ADC and DAC were changed from what I posted above, for the DAC you need to send one more 0 before sending the value this time 0-61----
so [addr 0 DACV] will work...
reading the same as before...

ADC works a lot differently

starting the ADC [addr 0x70]
reading is
[addr+1 r r r] or [addr+1 rrr] or [addr+1 r:3]

first byte is the HIGH part of the 10 pit conversion
second byte is the LOW
third id the config...whoses MSB tells you if the conversion has complited since last time you read it...if MSB off config is 0 then conversion was done, if 1 it is pending...

I am also commiting this to the SVN
best regards FIlip.

Re: BP Demo board v5 firmware development

Reply #24
Congrats arakis! Looking supercool

Re: BP Demo board v5 firmware development

Reply #25
[quote author="Sjaak"]Congrats arakis! Looking supercool[/quote]
Thanks, it wouldn't have been posible so quickly, without your groundwork
best regards FIlip.

Re: BP Demo board v5 firmware development

Reply #26
Thanks Filip, this is perfect!
Got a question? Please ask in the forum for the fastest answers.

Re: BP Demo board v5 firmware development

Reply #27
Moved to public forum
best regards FIlip.