User avatar
tand
Posts: 20
Joined: Sat Jul 14, 2012 7:56 am

Re: RF Bitbanger ported to Raspberry Pi

Fri Apr 26, 2013 9:28 pm

Last weekend I upgraded to kernel 3.6.11+ in a Raspbian distro. This caused incompatibility with the rfbb kernel module. To make future upgrades easier I wrote a simple script to download kernel and RF Bitbanger sources to target and build it all. The build process took almost 10 hours!
There are other ways to create kernel headers, but this worked for me! No warranties of any kind :)

Code: Select all

#!/bin/bash
cd
sudo apt-get install git-core build-essential
git clone --depth 1 git://github.com/raspberrypi/linux.git
cd linux
git checkout rpi-3.6.y
zcat /proc/config.gz > .config
make ARCH=arm oldconfig
make ARCH=arm
cd ..
git clone git://github.com/tandersson/rf-bitbanger.git
cd rf-bitbanger/rfbb
make KERNELDIR=~/linux
cd ..
cd  rfbb_cmd
make
#sudo make install
Checked the device major number by issuing:
insmod ~/rf-bitbanger/rfbb/rfbb.ko debug=1
dmesg
sudo rmmod rfbb
Reinserted rfbb without debug mode, set up device node, fixed protections and group access.
sudo insmod /home/pi/rf-bitbanger/rfbb/rfbb.ko
sudo mknod /dev/rfbb c 248 0
sudo chown root:dialout /dev/rfbb
sudo chmod g+rw /dev/rfbb
Tested with NEXA plug configured for "B1" group/unit:
rfbb_cmd -d /dev/rfbb -i RFBB -p NEXA -g B -c 1 -l 1
Note! If you would like to make the insmod and device settings persistent between reboots, put it in /etc/rc.local.
Be nice to your fellow threads!

stefangs
Posts: 7
Joined: Sat Jul 28, 2012 9:48 pm

Re: RF Bitbanger ported to Raspberry Pi

Sun Apr 28, 2013 8:54 pm

Support for rf-bitbanger is now implemented in NetHomeServer http://wiki.nethome.nu, so all rf-protocols supported by NetHomeServer can now be transmitted via rf-bitbanger. See http://nethomeserver.blogspot.se/2013/0 ... anger.html

talkeasy
Posts: 38
Joined: Sun Nov 04, 2012 10:57 pm

Re: RF Bitbanger ported to Raspberry Pi

Fri Sep 13, 2013 2:50 pm

Hi all

Has anyone tested Bitbanger with Bye-bye Standby plugs? I already have these devices and would like to avoid buying into a different system.

Also, what recommendations would folks make for Bitbanger compatible remote plugs in the UK?

Cheers.

cyberhasse
Posts: 1
Joined: Wed Nov 06, 2013 10:30 pm

Re: RF Bitbanger ported to Raspberry Pi

Wed Nov 06, 2013 10:42 pm

Hi folks! im new to this forum and need some help!

i have been trying for days now with different distros to compile rfbb and had some success with archlinux but
it's not working...

Could somebody just be so nice and dd a copy of a working image and put it up for download?
I would really appreciate it and if needed i'll share it with others.

Regards.

EDIT:

Hi again!
Nevermind got it working in archlinuxarm :D
Dont remember the exact steps to compile it thou...

Tried changing tx_pin in rfbb.c to 27 but did'nt work,
it is now sharing gpio 17 with my ir-blaster but seems to work perfectly.

Anyhow my problem was:

mknod /dev/rfbb c 248 0 did not work but after i did:
insmod rfbb.ko debug=1
dmesg

i got:
[ 13.204417] rfbb 0.05 registered
[ 13.204445] rfbb: dev major = 247
[ 13.204455] rfbb: IRQ = -1
[ 13.204464] rfbb: share_irq = 0

so i did:
mknod /dev/rfbb c 247 0
chmod 777 /dev/rfbb

And now it's working perfectly.

Thanks for all your work/hints/tips :)

Hope this helps.

Regards.

amitzauber
Posts: 4
Joined: Thu Dec 20, 2012 10:30 am

Re: RF Bitbanger ported to Raspberry Pi

Sat Nov 09, 2013 7:59 am

Hi guys. I am too intrested in this project. I had really bad exp. So far trying to work with another 433mhz device cc1101.
I am trying to understand which tranmitter + coding will give the the wanted result of working with this hong kong supplier devices which include power switchs light dimmer and swich
Plz let me know if possible

http://lanbon.appliances-china.com/Product.php?SC2=353

User avatar
tand
Posts: 20
Joined: Sat Jul 14, 2012 7:56 am

Re: RF Bitbanger ported to Raspberry Pi

Sun Nov 10, 2013 10:18 pm

@amitzauber
Do you know which chipset and/or protocol the switches are using? Sometimes it is possible to find the protocol by using tools like http://wiki.nethome.nu/doku.php/analyzer/start or a plain logic analyzer connected to a 433 MHz receiver.
Be nice to your fellow threads!

amitzauber
Posts: 4
Joined: Thu Dec 20, 2012 10:30 am

Re: RF Bitbanger ported to Raspberry Pi

Mon Nov 11, 2013 5:34 am

10x for the replay.
I havent bought any of those switchs yet. The seller have hard time answering my question.
Maybe i should gain some more knowlage before buying from lanbon.
BTW. I was looking for that 433mhz tx chip mantiond in the firsts replays on ebay. No luck does it have any other name?

elevation
Posts: 4
Joined: Sun Jan 05, 2014 9:18 am

Re: RF Bitbanger ported to Raspberry Pi

Sun Jan 05, 2014 9:58 am

Hello!

Tried to follow Tords script to compile RFBB but i guess it's because I have a newer kernel it fails for me! Any ideas about what I do wrong?

When trying to insmod my built module i get "Error: could not insert module ./rfbb.ko: Invalid module format"

I used kernel sources from git://github.com/raspberrypi/linux.git and the git branch is rpi-3.10.y.

uname -a
Linux raspberrypi 3.10.24+ #614 PREEMPT Thu Dec 19 20:38:42 GMT 2013 armv6l GNU/Linux

When compiling RFBB i got some warnings:

make KERNELDIR=~/linux
make -C /root/linux M=/root/rf-bitbanger/rfbb modules
make[1]: Entering directory `/root/linux'
CC [M] /root/rf-bitbanger/rfbb/rfbb.o
In file included from /root/rf-bitbanger/rfbb/rfbb.c:66:0:
arch/arm/mach-bcm2708/include/mach/gpio.h:12:0: warning: "ARCH_NR_GPIOS" redefined [enabled by default]
include/asm-generic/gpio.h:28:0: note: this is the location of the previous definition
arch/arm/mach-bcm2708/include/mach/gpio.h:14:0: warning: "gpio_to_irq" redefined [enabled by default]
/root/linux/arch/arm/include/asm/gpio.h:29:0: note: this is the location of the previous definition
/root/rf-bitbanger/rfbb/rfbb.c: In function â__check_debugâ:
/root/rf-bitbanger/rfbb/rfbb.c:748:1: warning: return from incompatible pointer type [enabled by default]
Building modules, stage 2.
MODPOST 1 modules
CC /root/rf-bitbanger/rfbb/rfbb.mod.o
LD [M] /root/rf-bitbanger/rfbb/rfbb.ko
make[1]: Leaving directory `/root/linux'


modinfo rfbb.ko
filename: /root/rf-bitbanger/rfbb/rfbb.ko
license: GPL
author: Tord Andersson
description: RF transmitter and receiver driver for embedded CPU:s with GPIO. Based on lirc_serial
srcversion: 1D28F51F08E5B7DBE443883
depends:
vermagic: 3.10.25+ preempt mod_unload modversions ARMv6
parm: debug:Enable debugging messages (bool)

User avatar
tand
Posts: 20
Joined: Sat Jul 14, 2012 7:56 am

Re: RF Bitbanger ported to Raspberry Pi

Mon Jan 06, 2014 11:22 am

RF Bitbanger - Cross-compiling the rfbb driver on an Ubuntu Host
@elevation

I tried to build RF Bitbanger on my RPI board with an updated kernel (rpi-update). Unfortunately, it seems that the old procedures to build drivers on target are now broken. Tried my old script updated for the 3.10.y branch. Also tried to use RPIF's Module.symvers with the current firmware/source (modules_prepare). No success!
Had to resort to cross-compiling. Below is a quick and dirty script I used to grasp the source code and Modules.symvers based on commit hashes for firmware and source. Note that some things like account/IP are based on my setup, and will probably need some tweaking. Note! There are no warranties of any kind on the script :)

Code: Select all

#!/bin/bash
#build_rfbb_driver_on_host.sh - script to build rfbb driver
#on Ubuntu host using RPIF kernel and Modules.symvers.
#Make sure to run "sudo apt-get update", 
#"sudo apt-get dist-upgrade" and
#"sudo rpi-update" before you run this script 
#Last updated: 2014-01-06, Tord Andersson

#User and node IP - Adjust to your environment
RPI_NODE_ACCOUNT="pi@rpinano"

#Where to place the content - Adjust to your preferences
cd ~/Documents

#Make sure you've got the right tools
sudo apt-get install git-core build-essential make ncurses-dev bc gcc-arm-linux-gnueabi
git clone git://github.com/raspberrypi/linux.git pi-linux
cd pi-linux

#Let's find out which firmware/source we use on target
#Store hash ID:s for later reference (if needed)
ssh $RPI_NODE_ACCOUNT "zgrep \"* firmware as of\" /usr/share/doc/raspberrypi-bootloader/changelog.Debian.gz | head -1 | awk '{ print \$5 }'" > FIRMWARE_HASH
FIRMWARE_HASH=$(cat FIRMWARE_HASH)
# get git hash for this kernel source
wget https://raw.github.com/raspberrypi/firmware/$FIRMWARE_HASH/extra/git_hash -O KERNEL_HASH
KERNEL_HASH=$(cat KERNEL_HASH)
git checkout $KERNEL_HASH
git reset --hard

#Get the kernel config from target
ssh $RPI_NODE_ACCOUNT "zcat /proc/config.gz" > .config

#Reconfigure with old configuration
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- oldconfig


#Option 1 - Reuse the current RPIF module symbol versions file
wget https://raw.github.com/raspberrypi/firmware/$FIRMWARE_HASH/extra/Module.symvers
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- modules_prepare

#Option 2 - Build the kernel and modules
#make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi-
#Build the modules and Modules.symvers
#make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- modules

cd ..

#Build the driver and transfer it to the target
git clone git://github.com/tandersson/rf-bitbanger.git
cd rf-bitbanger/rfbb
make KERNELDIR=~/Documents/pi-linux ARCH=arm CROSS_COMPILE=arm-linux-gnueabi-
scp rfbb.ko $RPI_NODE_ACCOUNT:
Then I ran the following commands on my target (rpinano):

Checked the device major number by issuing
sudo insmod ~/rf-bitbanger/rfbb/rfbb.ko debug=1
dmesg
sudo rmmod rfbb
Reinserted rfbb without debug mode, set up device node, fixed protections and group access.
sudo insmod /home/pi/rf-bitbanger/rfbb/rfbb.ko
sudo mknod /dev/rfbb c 248 0
sudo chown root:dialout /dev/rfbb
sudo chmod g+rw /dev/rfbb
Tested with NEXA plug configured for "B1" group/unit (rfbb_cmd was built on target):
rfbb_cmd -d /dev/rfbb -i RFBB -p NEXA -g B -c 1 -l 1
Successful activation! Hope this might help!
Last edited by tand on Sun Jan 12, 2014 2:06 pm, edited 1 time in total.
Be nice to your fellow threads!

elevation
Posts: 4
Joined: Sun Jan 05, 2014 9:18 am

Re: RF Bitbanger ported to Raspberry Pi

Sun Jan 12, 2014 12:21 pm

I was in the middle of reinstalling my computer so first now I got an Linux to cross-compile on! I am using Ubuntu 13.10 Desktop and first did "sudo apt-get install gcc-arm-linux-gnueabi" and then followed your guide and everything worked fine for me!

Thank you very much!

//Mattias

User avatar
tand
Posts: 20
Joined: Sat Jul 14, 2012 7:56 am

Re: RF Bitbanger ported to Raspberry Pi

Sun Jan 12, 2014 2:10 pm

elevation wrote:and first did "sudo apt-get install gcc-arm-linux-gnueabi"
Thanks for the feedback on the missing package! I have now updated the script in my previous entry.
Be nice to your fellow threads!

Geordio
Posts: 2
Joined: Sun Nov 23, 2014 8:23 am

Re: RF Bitbanger ported to Raspberry Pi

Sun Nov 23, 2014 8:43 am

I had bit banger working great thanks to the great instructions throughout this thread. Unfortunately my sd card became corrupt, so I started again with the latest raspbian image with kernel 3.12.32.
Now I'm unable to get it working. If I follow the from tend, it builds, but I get an instructions module format when I try to insert it.

I also tried some of the earlier methods, and can then successfully install it, but when I run the rf_cmd, it locks up my pi, and I can't dmesg.

Does anyone have this working successfully on 3.12.32?
Thanks

User avatar
tand
Posts: 20
Joined: Sat Jul 14, 2012 7:56 am

Re: RF Bitbanger ported to Raspberry Pi

Thu Jan 01, 2015 2:26 pm

@Geordio

I was able to build the driver on target with kernel 3.12.35+ by performing the following steps. No warranties of any kind! :)

Code: Select all

sudo apt-get update
sudo apt-get upgrade -y
sudo rpi-update 
cat /proc/version
gcc --version
Kernel/environment gcc version mismatch. Installed a newer gcc that seems to be close enough.

Code: Select all

sudo apt-get install gcc-4.8 g++-4.8
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 20
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 50
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.6 20
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 50
sudo reboot
After the reboot I cloned the kernel, and retrieved the commit that was used to build the kernel, prepared and downloaded the module.symvers file. This took quite a while!

Code: Select all

cd ~
git clone git://github.com/raspberrypi/linux.git pi-linux
cd ~/pi-linux
wget https://raw.github.com/raspberrypi/firmware/master/extra/git_hash 
KERNEL_HASH=$(cat git_hash)
git checkout $KERNEL_HASH
git reset --hard
zcat /proc/config.gz > .config
make ARCH=arm oldconfig
make ARCH=arm modules_prepare
wget https://raw.github.com/raspberrypi/firmware/master/extra/Module.symvers
Finally I downloaded and built the driver, followed by insertion using the debug statement to check which device node to use.

Code: Select all

cd ~
git clone https://github.com/tandersson/rf-bitbanger.git
cd rf-bitbanger/
cd rfbb
make KERNELDIR=~/pi-linux
sudo insmod ~/rf-bitbanger/rfbb/rfbb.ko debug=1
dmesg
Created the device node (change to suit the actual device node).

Code: Select all

sudo mknod /dev/rfbb c 247 0
Built, installed and tested with the rfbb_cmd utility.

Code: Select all

cd ~/rf-bitbanger/rfbb_cmd/
make
sudo make install
sudo chown root:dialout /dev/rfbb
sudo chmod g+rw /dev/rfbb
rfbb_cmd -d /dev/rfbb -i RFBB -p NEXA -g B -c 1 -l 1
Be nice to your fellow threads!

NeoRanga
Posts: 1
Joined: Tue Mar 12, 2013 10:54 pm
Location: Fritsla, Sweden
Contact: Website

Re: RF Bitbanger ported to Raspberry Pi

Mon Jan 19, 2015 3:10 pm

Did a rpi-update and the rf_bb stopped working, followed the instructiions by tand and now it's up n' runnig again.
Thx tand!

Geordio
Posts: 2
Joined: Sun Nov 23, 2014 8:23 am

Re: RF Bitbanger ported to Raspberry Pi

Wed Jan 21, 2015 8:40 pm

Thanks tand for your detailed instructions! I'll give this a go.

User avatar
DougieLawson
Posts: 40549
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: RF Bitbanger ported to Raspberry Pi

Wed Jan 21, 2015 9:12 pm

Geordio wrote:Thanks tand for your detailed instructions! I'll give this a go.
Before you run rpi-update read this: http://www.raspberrypi.org/forums/viewt ... 29&t=97314
Any language using left-hand whitespace for syntax is ridiculous

Any DMs sent on Twitter will be answered next month.
Fake doctors - are all on my foes list.

Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

elevation
Posts: 4
Joined: Sun Jan 05, 2014 9:18 am

Re: RF Bitbanger ported to Raspberry Pi

Tue Feb 17, 2015 5:45 pm

I had some problem with the latest kernel, Linux raspberrypi 3.18.7+.

First I got an error about missing "asm/system.h" in RFBB, but that was easy to solve by removing that line! Then i got some messages about faulty compiler even though I used GCC 4.8 as suggested above. Followed https://solarianprogrammer.com/2015/01/ ... -programs/ to install GCC/G++ 4.9 and ran update-alternatives and gave it highest priority, and that seemed to work.

Except for that the above guide seems valid!

//Mattias

Return to “Automation, sensing and robotics”