So, now I hopefully(!) have my cable which will give me access to the UART RX of the CC128 energy monitor. Time to try it out and begin processing some data with it!
Firstly, I go to the XMOS website and get the UART code and play around with it to create the UART code I want (RX only at the moment), compile it and give it a run.
But it’s never that simple! All I get are null characters. Odd I think – so I recheck the wiring, recheck the code. All seems to be ok.
So I strip down the code to a really simple function- one that just receives a character and prints it out (see the Super Simple UART receive function source file)
I still get null characters – maybe I got the wrong pins? Check again… nope, seems fine. So I decide its time to void the warranty (follow these CC128 teardown instructions at your own risk!).
Turns out there is a bit of solder between a via into the ground plane and the UART TX pin on the RJ45 connector (pin 8). After removing this I connected the XC-3 back up to the device and wah lah- it gives me the first character (a ‘<‘) of the XML data string.
Now to get the whole string out – so off I go to re-implement the more complex UART code.
After some battling I got it running!
The output looks like the following is in line with the CC128 XML documentation.
Next time… parse the XML and output to somewhere a little more useful!
My standalone receiver doesn’t appear to have any easy to access outputs – not even found a JTAG or anything. My USB receiver is weird – just a pair of HID devices, one of which gets written to (same packet every time) and the other replies with what i can only assume is what’s buffered up in the radio receiver. Incidentally, the radio in the USB receiver is from an Oregon Scientific weather station… o_O.
Once I’ve had a chance to read the data I’ll hopefully be able to figure out what it is.
Replaying the USB command in Linux hasn’t worked yet either. I wish it was as simple as RS232 and XML!
Hmm, sounds nastily more complex than mine… it might be worth me seeing if I can put it on the USB analyser at work and see if we can get a dump of what’s going on – hopefully that might be a bit more enlightening!
Could be interesting.
I had a theory based on something I read on another site though, and I think I’m onto something.
I took the data I snooped off the USB and put it into excel. I then assumed (hey, nothing like a crazy assumption) that the values were sampled radio data, thresholding the values at the average of the data, giving me a bunch of 1s and 0s.
I know that the ID of my transmitter at the moment (it changes if I reset it) is 596 and that they say there are “>4000 IDs per channel”, so I assumed 12-bit ID, then created a sliding 12-bit window and created decimal values across the data. Then I searched for the ID – boom, it’s there, repeatedly, and the bits surrouding it rarely change either – suggesting there’s other constant data too – it’s a pattern beyond randomness, I’m fairly sure.
Now how about THAT for some detective work!
Ha! Awesome. That sounds pretty nasty work though… I wonder why Owl made it so hard? But pretty classic code cracking stuff! Would be interested to see if you get it all deciphered and then integrate it into Google Power Meter (see my post on that…)
There’s a project article using this device at http://www.ibm.com/developerworks/xml/tutorials/x-ameetut/index.html