Hi, I'm really stuck on this and could definitely use a little help!
I'm trying to use a BV4213 motor controller board with a revision 2 Raspberry Pi. I have the board connected to an AB Electronics ADC Pi V2 - this happens to have a buffered 5v I2C port which allows me to connect at the right logic voltage (the Pi is normally 3.3v).
I have a DC motor connected between pins 1 & 2, and another between pins 3 & 4 on the DC output connector. I also have 12v coming in to the same connector. The Pi itself actually has the required pull-up resistors, or so I have read. I also understand that the board defaults to I2C mode, so I have nothing else connected.
If I run i2cdetect, I can see the BV4213 at 0x21 (7-bit), and also the ADC at 0x68/0x69 (which we'll now ignore).
> i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- 21 -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- 68 69 -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
Note: I'm using I2C bus 1 rather than 0 as this is a revision 2 Raspberry Pi and they switched things around.
I can run the test command on the BV4213 using i2cget and receive the incrementing number returned as I should:
> i2cget -y 1 0x21 0x55
0x01
0x02
... etc
Now, here's where I run into problems. Using i2cset, I should (I think) be able to start the motors running with a few commands, as follows:
> i2cset -y 1 0x21 0x01 0x01
> i2cset -y 1 0x21 0x04 0x01
> i2cset -y 1 0x21 0x15 0x80
As per the datasheet, that should:
1) enable Y1,Y2
2) set differential control of Channel A (Y1,Y2) so that the connected motor runs in one direction
3) set PWM channel A to 50%
I have tried sending various formats for the last argument (e.g. 0x01 / 1, 0xFF / 255) but nothing seems to work. There is no voltage showing on any of the output pins.
The BV4213 is not listed as requiring the clock stretching "fix", though I did compile and run bcmdel as per instructions on this site
> sudo ./bcmdel
This didn't seem to make any difference.
I'm obviously missing something (I'm very new to this). Any ideas?