Repartition Blues

Unfortunately development has ground to a halt for me. 

Whilst repartitioning my laptop to give my system drive some more space (I REALLY dislike the default DELL partitioning of 20GB for c: and the rest for d:), I lost my development drive (and the rest of my data drive as well) with all my recent work on it, like the latest pcb I finished yesterday.  Luckily I have most of it backed up, however murphys law now comes into play and some of it was not. 

To cut a long store short I’ve had to resort to lowlevel recovery of my files, which at this point looks like I’ll recover 100% of my data…phew, but its slow work doing sector level file recovery of a 140GB worth of data!

On a brighter side, just received a shipping notice from batchpcb that my first lot of header boards for the RFM12 has been shipped, I’m hoping that they arrives before Christmas so I can play with them over the break.  My 2×6 2mm headers also arrived earlier this week.

RFM12 FSK Library – Alpha Release

I’m pleased to announce the very ALPHA release of the RFM12 library for the wireless HopeRF RFM12 FSK tranceiver module that I’m using for the strobist open trigger project.  It was developed under BOOSTC for the PIC embedded controller, but should be easily ported to any compiler.

Most of it is untested, hence the alpha release, but it’s a good starting point.  Everything is fairly well documented, but like any project could do with more.   Please send me any bug fixes/improvements that you may find while using it.

Download:  rfm12-0_1a.zip 

Features:

  • 433Mhz and 915Mhz HopeRF FSK RFM12 modules supported
  • Initialisation with a basic config
  • Set Frequency
  • Set Receiver Bandwidth
  • Set Receiver Gain
  • Set Receiver Signal Strength Indicator Level (RSSI)
  • Set Transmit Power level
  • Set Transmit Modulation
  • Set Baud rate
  • Enable/Disable Transmitter
  • Enable/Disable Receiver
  • Transmit a single byte – blocking
  • Transmit a buffer of data – blocking
  • Receive single byte – blocking with timeout
  • Receive ‘x’ number of bytes into buffer – blocking with timout

 TODO:  (not in any order)

  • Testing
  • Howto documentation
  • RFM12 Interrupt handling 
  • Non-blocking Tx/Rx routines
  • MSSP SPI implementation (current SPI implemented via bit bang)
  • Frequency hopping
  • Custom configurations

License:

Released under the Creative Commons – Attribution-Noncommercial-Share Alike

Disclaimer:

Please use this library at your own risk.  I will not be held liable for any damages.

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

RFM12 Prototype Board

The RFM12 module is a pain to prototype with due to the 2mm header (won’t fit into the breadboard), so I’ve whipped up a prototyping board that brings out the pins to a standard header.  It’s been it sent off for fabrication today so I should have back in the next week or so.   I’m trying out www.batchpcb.com for the first time so will be interested in how they turn out.

RFM12 Proto Board

In the meantime I’ve soldered on some wires but I don’t really like it.

Frequency Hopping

As mentioned in my last entry I was toying with the idea of frequency hopping on the RF side of things, well looks like someone has implemented something similar here http://www.raccoonrezcats.com/rfmodem.html I’ll like to do something similar to this as it seems doable. 

While not able to get some “hands on” development time over the weekend, I did more reading of the HopeRF modules and these will be able to achieve the hopping, as the can programmed to any frequency in the 902-928Mhz Freq range so definately looking achievable.

If what the above links says on the site then we could (at least in theory) have a max output of 1watt if we chose to implement hopping, else we are limited to 1mW output power.