Friday, 4 April 2014

A Fubarino SD and Retro BSD capable pcb design

I really like my home brew Fubarino SDR, I call it that with the R as it's my layout with a few modifications. I started playing around with the RPi and it was just too slow and was seriously lacking IO. I just couldn't cram all I needed onto a pcb adapter for it. So rather than give up entirely I decided I'd make my own or rather a generic multipurpose microcontroller board.

I had a lot of PIC processors most of which are either usb or Ethernet and they're 8 bit, not really what I was after. I wanted something like an Arduino but I could use for other things such a real operating system. Further research came up with the Fubarino, someone had already beat me to it. But the board was lacking a few things such as on board power regulation and it couldn't run an OS. The original Fubarino, of which a few contained the PIC32MX795F512 which did have enough RAM amongst other things, was able to run an old version of UNIX called RetroBSD. Now we're cooking, a real OS on an 80MHz microcontroller with 96Kb of RAM for programs to run in and SD Card IO with drivers for gpio, analog, spi and i2c. This is what I'm after, it can run as a supercharged Arduino clone using the MPIDE software from ChipKit (Arduino IDE clone as well but for PIC32's) and it can run BSD.

The picture of the layout is below in case you're interested and I'll be etching 4 of these boards. I'll also redo the layout for the 100pin version of the same chip and add the Ethernet PHY as well, making this one tidy little power house. It was actually a shame that Microchip hadn't and still hasn't brought out the 32MZ series which has 2Mb flash and 512Kb Ram, now that would be an awesome board with 200MHz clock. These series of Microcontrollers can toggle the io at the clock rate, so, 200Mbps SPI anyone?!

I'll update this post some more with the etched boards when they're done with a picture of the acetate before and after application with my trusty clothes iron. Yes, that is the only thing I use an iron for, sod ironing shirts that's what body heat is for :)
Fubarino SDR V1.1 64pin TQFP

Saturday, 22 June 2013

OLED Driver working!

The OLED driver code is almost done and is giving an output, although noise seems to be an issue. I'm going to buy some DuPont jumper wires to connect directly to the Raspberry Pi rather than breadboard. 20Mbps over breadboard is pushing it really :) Here's a picture of the OLED displaying time, all written in C#!

The resistor in the picture is just to hold the flappy display down. Under the display is a pcb which holds several capacitors for the dc to dc charge pump and a current limiting resistor. The current limits the OLED drive current for the pixels and the charge pump converts the 3.3v from the RPi to around 7 to 12v for the pixel drive voltage.

I also decided that rather than make one board, I'd make a few extra plus some other boards such as an AD7190 analogue to digital converter (a very, very low noise one for bridge sensors such as a load cell or gas sensor). An AD9834 DDS board with a 50MHz master clock source, I can use this to generate any frequency I want up to about 15MHz useable in sub hertz steps. The last board is a CAN BUS controller such as used in cars and industrial control. The can controller is based on the MCP2515 controller and MCP2551 can interface. Here's pictures of the rough, not yet cleaned up, pcb's:

I'll update the git hub repository with my latest updated wrapper class and test modules so anyone can have a play. For my next trick, DDS board with scope pictures and code updates!

Wednesday, 8 May 2013

A great start...

Today was a great success to say the least. Some of my coding in recent months has surprised me when it's just worked right first time. It doesn't always happen but when it does, it's a great feeling.

I completed the library and paid particular attention to the pointers that Gordon Henderson uses in his WiringPi library. After learning of some different marshalling techniques I picked one that looked as though it did exactly what I wanted with the right performance, after all if it's worth coding, write it to be as simple and efficient as possible. Recompiling the WiringPi libraries as shared objects was something I'd seen somewhere in my Mono and Raspberry Pi searches so I decided to go with that. The commands to do so are: cc -shared wiringPi.o -o libwiringPi.so You'll need to do the same on all the libraries such as wiringPiSPI, wiringPiI2C etc.

The libraries just recompiled as shared objects are then imported by the WiringPi.WrapperClass in the visual studio solution. The console application in the solution has a reference to this wrapper and the LoopTest project is just a simple console application which writes 0xAA and 0x55 and tries to read the data back.

After copying the compiled code SPITest.exe, WiringPi.dll and pdb files I ran the code with the command sudo mono SPITest.exe and got this reply:

SPI init completed, using channel 0 at 32MHz for loopback testing
All zeros read back

This is great as I'd expected this or to receive an all ones message. Now to short out the MOSI pin to the MISO pin. (Master Out Slave In, Master In Slave Out) This should mean what we write is what we get back because the interface is full duplex i.e. simultaneous write and read. Sure enough we get our Loopback is connected! message.

This is a great start but there's more to do, libraries for common devices and different scenario's is one area I think many would benefit from including myself. First I need to make a few pcb's for the devices I do have in stock. MRF24J40 radio modules, temperature sensor, OLED display, DDS chip, load cell interface, the list goes on and on....

See my github repo here: https://github.com/danriches/WiringPi.Net for the code, enjoy and feel free to comment...

Monday, 29 April 2013

Here we go...

I've never done a blog before or anything like this really, so bear with me.

I bought two Raspberry Pi's of late and have been messing about with them for a while, learning or rather relearning linux shell commands and the file system. It takes a while to get to grips with especially when you've limited time being busy and all. One of the Pi's has given me loads of problems which I've narrowed down to it being a really early model that has the polyswitch fuses on the USB ports. Sadly I only found out after it trashed, and I mean totally killed, one of my SD cards.

Normally I wouldn't have documented all my Pi dealings but a few people have asked for any pointers and now I can point them here.

I'm not going to draw attention to setting up a Pi, everyones already done it. Rather I want to share getting electronic gadgets or interfaces connected and running. Initially I'll support this all through the use of C#, my favourite programming language for many reasons. I'll later go on to using C / C++ as I learn it and try to explain everything as best I can. Of course I welcome comments, keep them clean please, constructive or otherwise. I'm always open to new suggestions and ways of doing things so fire away.

First up see this post on the Raspberry Pi forums for getting Mono up and running. I'm only going to support this method on the hard float version of Raspbian, you're on your own with the soft float release (sorry). Currently, at the time of writing, the hard float version doesn't work with the usual distro release of mono, the linux version of the Windows .Net Framework and CLI as there are bugs with DateTime.Now for one.

You can use the Raspberry Pi.Net solution from cypherkey on github if you only want gpio. However I want SPI and I2C working as most of my projects use ADC's (Analog to Digital Converters) and OLED displays which communicate over SPI. Although this library does support SPI and I2C, it uses the bit bang method rather than using the dedicated hardware. This means it's slow, uses more cpu time than necessary and my devices need high speed. One of these is a 10/100 ethernet chip that'll need 20MHz clock cycles if not more and using a library which pulses bits rather than hardware doing it for you, which is why it's there, seems a cop out to me but hey it works.

I'm going to wrap up Gordon's Wiring Pi library which is written in C and can be found on his site here, take a look and you'll see it uses the hardware and we can ramp the speed up to 32MHz which is impressive. First we have to grab the library and compile it, then create a shared library so we can wrap the function up in a C# class so everyone out there can connect all sorts of stuff from SparkFun and AdaFruit etc. We can even get some of those Arduino shields connected, I've not got any myself or an Arduino but I can enlist a friend who does if I need to.

So, on to writing the wrapper. I'll update this blog as I go, here goes nothing ;)