Announcing: RPI_SERIAL: breaks out the serial busses of the GPIO


16 posts
by rew » Wed Apr 18, 2012 3:53 pm
The RPI_SERIAL board works! First time! :-)

What does it do?

It breaks out three or four(depending on how you look at it) of the serial busses that are available on the GPIO connector.

There is the UART. It provides a 5V compatible cmos-level UART. You can connect that for instance to an Arduino mini, or our ftdi_serial board to connect it through USB with a PC. http://www.bitwizard.nl/catalo.....ucts_id=41

You have the boot messages and a login prompt there if you want to troubleshoot your raspberry pi say without a screen and/or ethernet. (or to get the screen and/or ethernet up and running).

Next there is I2C. This can connect to our I2C expansion boards, but also to sensors like those found in WII controllers. 5V I2C devices will have to read a 3.3V "high" as being high, as the pullups on the Raspberry pi are tied to the 3.3V supply.

Then there are two SPI connectors. These share the bus lines, but have separate chip select lines. The BitWizard SPI modules http://www.bitwizard.nl/catalo.....p?cPath=34 are able to be daisychained on such a single-CS SPI bus, maybe not all SPI devices can, so that's why there is a second bus.

The software on the raspberry pi side still needs a bit of cleaning up.
I currently have a user-space driver that will operate the SPI hardware.

I have demonstrated I2C functionality with interactive memory-poking. That userspace-driver should be working quickly. (tomorrow). I hope to be able to make the current SPI stuff more presentable as well.

Raspberry pi connected to SPI_LCD.
Check out our raspberry pi addons: http://www.bitwizard.nl/catalog/
User avatar
Posts: 396
Joined: Fri Aug 26, 2011 3:25 pm
by nick.mccloud » Wed Apr 18, 2012 4:30 pm
Cool!

[Goes off to sulk even more and think about taking the soldering iron off emergency standby until a Pi actually arrives]
User avatar
Posts: 797
Joined: Sat Feb 04, 2012 4:18 pm
by SN » Wed Apr 18, 2012 6:58 pm
ditto... we need a SULKING corner for all us pi-less posters ... :-(
Steve N – binatone mk4->intellivision->zx81->spectrum->cbm64->cpc6128->520stfm->pc->raspi ?
User avatar
Posts: 1009
Joined: Mon Feb 13, 2012 8:06 pm
Location: Romiley, UK
by rew » Thu Apr 19, 2012 3:09 pm
I've wrapped up the software side of things so that I can release the software.

I've managed to get the I2C version working as well.

(I'm using the LCD boards to verify functionality. The other boards ( http://www.bitwizard.nl/catalo.....p?cPath=34 ) will work just as well.)

Raspberry pi connected to SPI_LCD and I2C_LCD.

I have released the software that allows you to send bytes over the SPI and I2C busses.

http://www.bitwizard.nl/softwa.....120419.tgz

Oh, and I was supposed to link to the newer version of the usb-serial board: http://www.bitwizard.nl/catalo.....ucts_id=73
Check out our raspberry pi addons: http://www.bitwizard.nl/catalog/
User avatar
Posts: 396
Joined: Fri Aug 26, 2011 3:25 pm
by zeeMonkeez » Thu Apr 19, 2012 9:44 pm
Hi & Thanks for your efforts.

May I say that in the above linked archive in gpio_list.c all occurrences of argv[x] need to be changed to argv[x+1] (argv[0] is the program name).

Can you briefly describe how to read data back from the SPI bus?

Thanks,

Jonas
Posts: 3
Joined: Thu Apr 19, 2012 8:31 pm
by jbeale » Thu Apr 19, 2012 10:32 pm
Great work! By the way, if you're wondering what to do with the I2C port, check out the I2C boards available below. They are intended for a 3.3V Arduino-style board called a "JeeNode" but should work perfectly well with any 3.3V I2C system.

http://jeelabs.net/projects/ha.....ware/wiki/

Interfaces - I2C Bus

User avatar
Posts: 1967
Joined: Tue Nov 22, 2011 11:51 pm
by FinleysDad » Mon Jun 18, 2012 12:36 pm
This looks great!

I really like to be able to do this too but have to admit my level of knowledge is lacking....infact RasPi is my first venture into doing anything like this.

I've got one of the LCD screens ordered. (Bit of a spur of the moment purchase)
Is there any where I could get more information on getting this little SPI LCD working at all? Taking in to consideration that I'm a total newbie.

Also I notice you use a little break out board in the photos is this specifically required or can you attach the lcd to the pins without it?
Posts: 7
Joined: Wed Jun 06, 2012 9:33 am
by TommyboyNL » Mon Jun 18, 2012 4:39 pm
I just wrote a howto for controlling the SPI_LCD module: http://www.bitwizard.nl/wiki/index.php/ ... spberry_Pi
If you still can't get it to work, please say so, and we will try and help you.

And a simple showcase i just made:
http://www.youtube.com/watch?v=enJEksPqWqo
Posts: 48
Joined: Mon Jun 18, 2012 4:37 pm
by FinleysDad » Tue Jun 19, 2012 1:53 pm
Hi,

Thanks for the response... It has helped me a lot.

I now have the SPI LCD hooked up tot he RasPi.: It lights up and displays a message:

tiny_spi_lcd 1.5
A: 82.

I thought I had followed the instruction to update the kernel.

Also did the Rsync

I have also compiled the c code into pi directory

I've sorted the shh out too

I thougtht I had done everything as described but when I come to run the compiled program I get an error as below

pi@raspberrypi:~$ sudo ./bw_lcd -T 0,0 'Hello World!'
can't open device: No such file or directory

Have I done something wrong?

I'm guessing it is somethign around the kernel that I have messed up?
Posts: 7
Joined: Wed Jun 06, 2012 9:33 am
by TommyboyNL » Tue Jun 19, 2012 2:11 pm
The display is showing it's boot-up message, meaning you hooked up the power properly. I suspect something went wrong with copying the kernel modules. Does your pi have the following files?
/lib/modules/3.1.9+/kernel/drivers/spi/spidev.ko
/lib/modules/3.1.9+/kernel/drivers/spi/spi-bcm2835.ko

If so, do you have a /dev/spidev0.0 device?

I'll make a working image in a few hours, and upload that to wetransfer, to get you started.
Posts: 48
Joined: Mon Jun 18, 2012 4:37 pm
by TommyboyNL » Tue Jun 19, 2012 3:39 pm
This is exactly what I did:

mkdir rpi
cd rpi
wget http://files.velocix.com/c1410/images/d ... 4-2012.zip
wget http://www.bitwizard.nl/software/rpi-sp ... 120608.tgz
wget http://www.bitwizard.nl/software/bw_lcd.c
tar -xzvf rpi-spi-binary-kernel-20120608.tgz
unzip debian6-19-04-2012.zip
sudo dd if=debian6-19-04-2012/debian6-19-04-2012.img of=/dev/sdc

Unplug SD, replug SD (for automount)

cp boot/* /media/95F5-0D7A/
sudo rsync -aPv lib/ /media/18c27e44-ad29-4264-9506-c93bb7083f47/lib/
cp bw_lcd.c /media/18c27e44-ad29-4264-9506-c93bb7083f47/home/pi/
mv /media/95F5-0D7A/boot_enable_ssh.rc /media/95F5-0D7A/boot.rc
sudo umount /media/*

<At this point, I imaged my SD card. I will upload this image ASAP.>

Unplug SD, Plug SD into RPi
Turn RPI on
Wait a few minutes 2 - 5 minutes should be enough
Turn RPi off and on

ssh 192.168.1.116 -l pi
gcc -o bw_lcd bw_lcd.c
sudo ./bw_lcd -T 0,0 'Hello World!'


This worked for me.
Posts: 48
Joined: Mon Jun 18, 2012 4:37 pm
by TommyboyNL » Tue Jun 19, 2012 3:58 pm
Sorry for the 3 consecutive posts, but I cant edit non-approved posts...

I uploaded an image to WeTransfer: http://wtrns.fr/2-qU3JUp1wkveBq
Write it to your SD card, and you're ready to go.
Put the SD card in your pi, let it go through its first boot, reboot, compile, and done!

Good luck!
Posts: 48
Joined: Mon Jun 18, 2012 4:37 pm
by FinleysDad » Tue Jun 19, 2012 8:01 pm
Woohoo!

I've got it working!


I went through the tutorial again. This time with a little more patience.

I think I went wrong on this command line:
cp rpi-spi-binary-kernel-20120608/boot/* /media


When I used this below everything seemed to work out right

cp rpi-spi-binary-kernel-20120608/boot/* /media/95F5-0D7A/

Thanks again for posting this stuff. It really has helped me a lot. Now I just need to figure out how to program it all
Posts: 7
Joined: Wed Jun 06, 2012 9:33 am
by TommyboyNL » Tue Jun 19, 2012 11:06 pm
That was an error on my behalf, it's fixed now. Good luck, and have fun! Some tips/possible useful things:
sudo ./bw_lcd -T 0,0 `hostname -I`
prints your IP address.

sudo ./bw_lcd -p 0,0 -t `date +%m/%d/%Y`
prints the current date in my preferred format.

Have a look at the following page for a more complete manual of the bw_lcd program: http://www.bitwizard.nl/wiki/index.php/ ... CD_program

If anyone needs more help controlling some of our other SPI boards, please say so!
Posts: 48
Joined: Mon Jun 18, 2012 4:37 pm
by PostaL2600 » Sun Sep 23, 2012 4:32 pm
One small question: are the "Modified kernel and modules" valid for the current version of Raspbian ( http://downloads.raspberrypi.org/downlo ... spbian.zip ) or only for the one mentioned in the tutorial ?

Thank you!
User avatar
Posts: 7
Joined: Fri Aug 24, 2012 7:04 pm
by TommyboyNL » Mon Sep 24, 2012 1:15 pm
You don't need our kernel modules dor the newest Raspbian (wheezy) release, just use our script to enable SPI and/or I2C on your raspberry pi: http://www.bitwizard.nl/software/bw_upgrade
You can also just follow out howto: http://www.bitwizard.nl/wiki/index.php/RPi_SPI_wheezy
Posts: 48
Joined: Mon Jun 18, 2012 4:37 pm