PIC, SPI and the RFM12

I finally had some time this weekend so I started the hardware verification, mainly getting the PIC and the RFM talking together via SPI, of which I have had no previous experience.  The PIC is receiving it’s clock source from the RFM12 via the CLK pin so I dont need any external Xtals.  The RFM12 default clock rate on reset is 1MHz, so the first challenge is to change the speed of the RFM12 CLK to 10MHz, that way I know the PIC and RFM12 are talking.

 As I’m doing most of my software development with BoostC (http://www.boostc.com), there is a library to use the on-chip MSSP (SPI and I2C) functions of the PIC16f873A, so I thought I’d use this and the on-board SPI functions to handle all SPI communications to the RFM12, after a very frustrating few hours and with my scope monitoring the SPI pins, I finally got the SPI to spit out proper CLK, SDO, and receiving something back on the SDI line after I realised I had not had my interrupts enabled to allow for the non blocking SPI functions DOH!

Now that something was getting out and back in, however none of the commands I sent seem to be getting through, well at least not interpreted as commands by the RFM12.  After much head scratching and re-reading of the RFM12 SPI timing diagrams It occurred to me that the 16bits that make up the the RFM12 commands were getting send through in byte sized chunks, i.e. 8 bits at a time were being sent through, then the next 8 bits were send with a delay in between the two bytes, this makes sense as the internal SPI uses an 8 bit register that gets transmitted, although the library I was using allows from the transmit of any number of bytes via a buffer.  I figured this was the problem and quickly wrote some bit banging SPI functions to test the theory, and straight away the RFM12 responded to my commands and now I have the PIC running at 10MHz.

So now that  all is working in the land of Oz as far as my PIC and RFM12 and talking to each other it’s onto finishing the RFM12 library I started last week and testing that with the RFM12 Demo board so I can test Tx and Rx functionality without having two development boards set up.

RFM12 Demo Board

More challenges but getting there

Trying to fit the functionality into the existing ebay trigger receiver housing seems to be a royal pain in the butt, especially trying to work in with the batteries, so after a few days of PCB redesigns and juggling compments around I have put that particular design on hold and moved forward with my original PIC16F873A design, also I did not like the fact that there was 2 circuits to maintain, a transmitter and receiver, this then leads me to the next problem.  I want something easy for the end user, something similar to the Pocket Wizard Plus that is really a no brainer for the user to drive, i.e. a switch to select operation mode and channels, a 3 and 4 way slide switch respectivly, well do you think I can source any 4 way slide switches easily?  Seems I can get some 3 way easily enough, and I guess I could use a rotary switch but these are too clunky for my liking, but still an option.

Strobist Tranceiver MK1

Continue reading “More challenges but getting there”