Skip to content
Mariano Alvira edited this page Jan 29, 2013 · 2 revisions

BBMC

BBMC is a small utility for bit banging functions on the mc13224v using libftidi. BBMC let's you to erase and reset Redbee Econotags and similar hardware.

Building

BBMC is part of the libmc1322x package. You can find it in libmc1322x/tools/ftditools

You need the libftdi 0.17 or later. Check that you have an acceptable version:

$ apt-cache policy libftdi-dev
libftdi-dev:
  Installed: 0.17-1+b1
  Candidate: 0.17-1+b1
  Version table:
 *** 0.17-1+b1 0
         80 http://ftp.debian.org testing/main Packages
         50 http://ftp.debian.org unstable/main Packages
        100 /var/lib/dpkg/status
     0.13-2 0
        200 http://ftp.debian.org stable/main Packages

and install libftdi-dev:

$ apt-get install libftdi-dev

at the time of this writing, 0.17 was available in testing or later.

Then run make in the ftditools directory.

$ cd tools/ftditools
$ make
cc -Wall -Wextra   -lftdi  bbmc.c   -o bbmc

Usage

Erase a redbee econotag:

./bbmc -l redbee-econotag erase
Found 1 devices with vendor id 0x0403 product id 0x6010
Opening device 0 interface 1 using layout redbee-econotag
setting VREF2 erase
toggle reset
waiting for erase
setting VREF2 normal
toggle reset
done.

If you have multiple devices with the same vendor and product id (e.g. multiple econotags) you will be prompted for which device to use:

./bbmc -l redbee-econotag erase
Found 2 devices with vendor id 0x0403 product id 0x6010

  [0]   Manufacturer: FTDI, Description: Dual RS232-HS, Serial ?
  [1]   Manufacturer: FTDI, Description: Dual RS232-HS, Serial ?

Use which device? 1
Opening device 1 interface 1 using layout redbee-econotag
setting VREF2 erase
toggle reset
waiting for erase
setting VREF2 normal
toggle reset
done.

You can do the same thing but avoid the prompt with the "-i" switch:

$ ./bbmc -l redbee-econotag -i 1 erase
Found 2 devices with vendor id 0x0403 product id 0x6010
Opening device 1 interface 1 using layout redbee-econotag
setting VREF2 erase
toggle reset
waiting for erase
setting VREF2 normal
toggle reset
done.

The full usage is shown below:

$ ./bbmc --help
Usage: bbmc [options|overrides] -l|--layout layout command 
Commands:
           reset: Toggles reset pin
           erase: Sets VREF2 erase mode; toggles reset; waits 2 sec.; sets normal; toggles reset again

Required options:
           -l|--layout   specifiy which board layout to use
                         layout is not necessary with a full
                         set of overrides

Layout overrides:
           --interface           FTDI interface to use
           --dir                 direction (1 is output)
           --reset_release       reset release command
           --reset_set           reset set command
           --vref2_normal        vref2 normal
           --vref2_erase         vref2 erase

Layouts:
        redbee-econotag: Redbee Econotag

                interface:      0x0001
                dir:            0xc400
                reset release:  0x0400
                reset hold:     0x0000
                vref2 normal:   0x4000
                vref2 erase:    0x8000

        redbee-usb: Redbee USB stick

                interface:      0x0002
                dir:            0x0460
                reset release:  0x0400
                reset hold:     0x0000
                vref2 normal:   0x0040
                vref2 erase:    0x0020


Options:
           -i|--index     specifiy which device to use (default 0)
           -v|--vendor    set vendor id (default 0x0403)
           -p|--product   set vendor id (default 0x6010)
*** You must specify a layout or a complete set of overrides

Notice that you can also specify the vendor and product id to use.

You can also, however, override the built-in commands for a particular layout. This is useful if you are developing new hardware that uses a different hookup from the Redbee Econotag or Redbee Usbstick.

You will need some pretty low-level knowledge of the FTDI controller to do both the design of the hardware and to determine the values for these overrides. Feel free to email [email protected] if you need help.

Troubleshooting

Permissions

You need permissions to access the ftdi hardware as your user. If you are having trouble connected, you can try as root. If that fixes the issue then you need to investigate what permissions you need and add the appropriate udev rules or add your self to the proper group.

As an example: if /etc/udev/rules.d/99-libftdi.rules contains:

SUBSYSTEM=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6010", MODE="0664", GROUP="plugdev"

Then your user needs to belong to group "plugdev". If you don't have a udev rule that matches idVendor="0403" and idProduct="6010" then you need one. The rule above might work for your system.

This page is maintained by Mariano Alvira. Please email me at [email protected] with patches, suggestions and comments.

Clone this wiki locally