Receive data from a JeeNode...Help needed

Hi all,

I’m trying to create a driver for a RFM12B SPI transceiver in order to receive data from a JeeNode (Atmega328 with RFM12B) with little to no success :-[. This would be especially useful for the Domotica users amongst us.

Anybody willing to help out?

Check this link out : [url]http://www.ideetron.nl/Hope/RF12B_code.pdf[/url]
It contains the commands descriptions and some C sample code at the bottom of the document.
After you have implemented the basic functionality (read/write command, etc.) you can just copy/paste.

Guy’s,

after struggling for 5 days i got to a point that i don’t know what else i could try.
I succeeded in getting the first 2 bytes back, but after that i always receive 0’s.
Does anyone of you have a RFM12B transceiver and is able to help out a bit?

The code i have so far:



		const ushort RF_RECEIVER_ON = 0x82DD;
		const ushort RF_XMITTER_ON =  0x823D;
		const ushort RF_IDLE_MODE =   0x820D;
		const ushort RF_TXREG_WRITE = 0xB800;
		const ushort RF_RX_FIFO_READ = 0xB000;

		static byte[] payload;
		static byte HDR;
		static byte LEN;


		void _interruptPort_OnInterruptRF12(uint data1, uint data2, DateTime time)
		{
			RFXX_WRT_CMD(0x0000); //send dummy word
			HDR = (byte)(RFXX_WRT_CMD(RF_RX_FIFO_READ) & 0x00FF); // Read Header
			LEN = (byte)(RFXX_WRT_CMD(RF_RX_FIFO_READ) & 0x00FF); // Read payload length

			bool CTL = ((HDR >> 5) & 0x04) != 0;
			bool DST = ((HDR >> 5) & 0x02) != 0;
			bool ACK = ((HDR >> 5) & 0x01) != 0;
			int ID = (HDR & 0x1F);
			
			payload = new byte[LEN];
			for (int x = 0; x < LEN; x++)
			{
				payload[x] = (byte)(RFXX_WRT_CMD(RF_RX_FIFO_READ) & 0x00FF);
			}
                
			RFXX_WRT_CMD(RF_IDLE_MODE);
			RFXX_WRT_CMD(RF_RECEIVER_ON);
			// Reset FIFO
			RFXX_WRT_CMD(0xCA81);
			RFXX_WRT_CMD(0xCA83);

			OnDataReceived(payload);
                }

		ushort[] _readBuf = new ushort[1];
		ushort[] _writeBuf = new ushort[1];
		private ushort RFXX_WRT_CMD(ushort cmd)
		{
			_writeBuf[0] = cmd;
			_spiPort.WriteRead(_writeBuf, _readBuf);
			
			return (_readBuf[0]);
		}


Would you have some protocol analyser available or memory scope to really check that the data is really coming to your input port ? Just see if you can see more than 16 consecutive flapping bits ?

Just to make sure everything is fine at the hardware level because pushing further the software…

Did you try to capture something with the pincapture function ?

Should have mentioned this also but here goes:

I have 2 of these modules and had them connected first to 2 arduino’s. They were happily married, uhm, exchanging data. Now the plan is to move 1 transceiver to the panda and receive the data that the other arduino is sending every 5 secs. I’m absolutely positive that at the hardware level everything is ok. What I suspect is that 1) I miss a command to read the buffer 2) that commands to read the buffer are not in the correct order.
I have analyzed the arduino driver for 5 days, but my c++ knowledge is pretty low.

And no, i don’t have a protocol analyzer or a DSO (would love to have one though), and i don’t think pincapture can help here since the transceiver is an SPI device.

Hi Eric,
can you please post a link to the arduino driver…

thanks

Here you go Jay: http://jeelabs.net/projects/cafe/repository/entry/RF12/RF12.cpp

PS: The code I posted above is not complete, it’s missing the initialization, but could also post that if needed)

Documentation of the driver can be found here: http://jeelabs.net/projects/cafe/wiki/RF12 in case it’s useful.

The packet that I’m expecting at the Panda (send by the arduino) is described here:
http://jeelabs.org/2011/06/09/rf12-packet-format-and-design/

have you seen this :
http://blucorazon.ch/wp-content/uploads/2010/01/rfm12b_schema.jpg

Yes, but thats not needed because i don’t need level conversion since the Panda IO’s are 3.3V

How about this:

http://www.ccsinfo.com/forum/viewtopic.php?t=43563&postdays=0&postorder=asc&start=0

some really good info in there…

Jay.

Hi Eric,
can you post your

 _spiPort.WriteRead(_writeBuf, _readBuf); 

we need to see how you are writing the cmd… and receiving the data…

thanks.

Jay, it’s in post above with the code (at the bottom)

i was talking about the actual WriteRead() function…

Never mind that is the SPI writeRead function()

Hi Eric,
Can you please post your initializing commands…

thank you.