Wednesday, December 24, 2014

I SPI a CC2500

So this is now working.  A very long, tedious process.  No shortage of posts out there from people abandoning these things.  Lots of issues with the available Arduino CC2500 SPI libraries, here's a random list of things you should know (ymmv):

  • If "things" aren't working, lead length probably isn't a cause
  • The RX FIFO is read only, you can't clear it by writing to it
  • The CC2500 has some registers that have to be written to in Burst mode
  • You don't need to do anything with SimpliciTI.  In fact, why would you?
  • The CC2500 is 3.3 Volts, don't connect MOSI directly to an UNO pin.  There is mention on the web that it works anyway, might depend on the board.  In my case, it doesn't work, you need to add a resistor.  5v doesn't appear to damage it though.
  • Because these boards run at 26mhz, allot of the register settings you would use on a Wixel are completely different.  You need to recalculate these using TI RF Studio.
  • You have to configure and use the GDO0 pin.  There is some code out there that doesn't.  I don't know how that could work.
  • Use led's to monitor the status of all the pins you're using on the CC2500, but be aware that you may also be affecting the status of those pins (is that possible?)
  • Simply reading from the FIFO does not flush it, you need to issue a command for that.

I'll put my revised SPI library on github at some point, when it's fit for the public.  I had to add Read Status Register and Read Burst Register functions to what is publicly available.

Initially I setup two separate Uno's with CC2500's.  I was paranoid about the RFduino, really working with SPI, in the end, I can confirm it works great.

I used example receive and transmit programs that are available with the library written by yasiralijaved.  Once I confirmed this works, I slowly added the new settings from RF Studio.
At one point I found that the IOCFG0 (configures the GDO0 pin) register setting no longer worked after changing some of the MDMCFG registers.  I had to use 0x01, assert when the RX FIFO is filled.  

I also configured a Wixel to transmit Dexcom packets every 10 seconds so I could work with the register settings in near real time, not every 5 minutes.

I also configured a RF24 to act as a frequency scanner, so I could see that I was transmitting on the correct frequencies.  I plan to breadboard this gadget and give it a display.  You can also see here just how much "noise" there is in the 2.4 ghz band.

Thursday, December 11, 2014

Trying out the CC2500

Finally getting around to this.  Slow work today, waiting on a client, so I'm going to get this onto a breadboard.

The plan is, start with this website(there's a link here):

Get this to work using the full SimpliciTI stack, and see what I really need.  If I can get this to work on a platform it plays natively with, I should be able to port this to the RFDuino.

So, from the left we have a TI MSP430 Launchpad, next to that a CC2500 module broken out onto a Schmart board, and finally the RFDuino.  End product will be on a PCB, may or may not go with the surface mount RFDuino.  Power usage may be low enough to use a coin cell, which would be very cool.

I've picked the 2500 up a few times over the last 6 months, this post will help me keep track of my progress, I have so many bookmarks it's hard to find the details anymore.  I've tried SPI with the CC2500 to an Arduino.  SPI isn't plug and play.  I could only get as far as updating registers.

Lots of sensitive timing issues, most recommend a scope.  I think some of the issues I've experienced trying other peoples code is the microcontroller speed.

Abandoning simpliciTI (Again).  This is for people with 40 hours to kill, not weekends.

I think I'm getting closer just using SPI.  IOCFG0 is one important factor in the variability of code you find.  The "sheet" for my CC2500 board refers to a couple of GDOX pins as general use.  So you think great, don't need to hook those up.  Turns out GDO0, is responsible for notifying your code that a packet has been received.  But, only if you set the IOCFG0 register with the correct value(and there are many to choose from).  Most likely 0x06 is what we want here.