Shop OBEX P1 Docs P2 Docs Learn Events
MRF24J40MA radio transceiver — Parallax Forums

MRF24J40MA radio transceiver

LuckyLucky Posts: 98
edited 2010-03-22 06:04 in Propeller 1
···· Does anybody have experience with the MRF24J40MA·2.4 GHz IEEE 802.15.4 radio transceiver module? The MRF24J40MA has an integrated PCB antenna and oscillator, so you can connect it directly to the prop via a 4-wire SPI interface. It supports the ZigBee and MiWi protocols. I'm mainly interested in it because it is cheap ($10), but I have no idea in how to interface it. I have had experience with SPI (MCP3208), but I don't know any of the terms they use like FIFO or packets. There's something about addressing stacks I think. From what I've seen, its easy to interface for PIC users, so it should be a breeze for the prop right?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"You do not really understand something unless you can explain it to your grandmother."


-Lucky[size=-1][/size]

Comments

  • Timothy D. SwieterTimothy D. Swieter Posts: 1,613
    edited 2010-03-17 08:17
    Thanks for pointing out the MRF24J40MA module, it may work in an application I have been toying around with in my head for a while.

    Unfortunately I don't have any experience to offer for your particular usage. I checked the Object Exchange and I didn't see an object. Perhaps you can partner with someone here to write an object to use the radio device. I glanced at the data sheet and there appears to be a lot of setting of values and registers, but I bet any sample library code provided by Microchip could be ported and rewritten to work with the Propeller.

    I'd recommend getting a couple modules and then start working through a design. Through the forum we can help offer design ideas, term definitions, etc. The first thing you will want to write is a basic toggling of the pins for the SPI protocol. Do this in SPIN. Then take another baby step and abstract that toggling of pins to accept data as a method and then clock that data out with SPI. Then from there you can start learning what the register and memory functions are of the radio IC and start to put together what is needed to transmit data.

    FIFO = first in, first out. This is usually a register or stack structure where the first data into the register is the first data to come out of the register/stack.
    Packet = is a group of data (bytes/words/longs) that are transmitted together. Usually a packet consist of some sort of structure such that there is a header, payload and data/crc check.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Timothy D. Swieter, E.I.
    www.brilldea.com - Prop Blade, LED Painter, RGB LEDs, 3.0" LCD Composite video display, eProto for SunSPOT
    www.tdswieter.com
  • LuckyLucky Posts: 98
    edited 2010-03-18 01:40
    I found a part of code that "Defines all of the address and channel settings for the registers in the MRF24J40". Is this a good start point? So would I send the values to set the registers to those hexadecimal values between the parentheses?

    "
    ·· #define RFSTATE (0x20f)
    ·· #define RSSI (0x210)
    ·· #define CLKIRQCR (0x211)...·· "

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "You do not really understand something unless you can explain it to your grandmother."


    -Lucky[size=-1][/size]
  • Timothy D. SwieterTimothy D. Swieter Posts: 1,613
    edited 2010-03-18 02:19
    That is a start point. The hex value you listed is probably the register address information or a mask info for a register. The SPI communication consists of reads and writes. Because of the limited I/O lines, the read/write needs to first say what register to read/write and then either write data or read data. So, a SPI write sequence would be something like a byte or more that indicates a read or write operation, then the register address which could be a byte or two or three and then the data. A SPI read sequence would be something like a byte or more that indicates a write, then the register adress and then the data would start being clocked on the output (MISO).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Timothy D. Swieter, E.I.
    www.brilldea.com - Prop Blade, LED Painter, RGB LEDs, 3.0" LCD Composite video display, eProto for SunSPOT
    www.tdswieter.com
  • LuckyLucky Posts: 98
    edited 2010-03-20 19:53
    The "0x" just means its a hexadecimal number and has no value, right? And so 0x1A means 26 in decimal, which means I should send 0001 1010 for address over SPI?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "You do not really understand something unless you can explain it to your grandmother."


    -Lucky[size=-1][/size]
  • Timothy D. SwieterTimothy D. Swieter Posts: 1,613
    edited 2010-03-21 00:06
    Lucky - another good question! In most documentation 0x.... is an indicator of a hexadecimal number. The same number in SPIN would be $..... as the "$" indicates a hexadecimal number. Your conversion from hex to dec to binary is correct. Now you need to figure out if you need to send the byte Most-Significant Byte first (MSB) or Least-Significant Byte first (LSB). I'm not looking at the data sheet at the moment, but I would guess MSB.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Timothy D. Swieter, E.I.
    www.brilldea.com - Prop Blade, LED Painter, RGB LEDs, 3.0" LCD Composite video display, eProto for SunSPOT
    www.tdswieter.com
  • LuckyLucky Posts: 98
    edited 2010-03-21 21:07
    So what would the SPI sequence be - first set up(FFD or RFD, 868MHZ/915MHz/2.4GHz, set device address) ? The Microchip data sheet mentions a 64-bit address and a 16-bit address. I'm slowly going through all the stuff(beacons and non-beacons, network topologies, and frames/superframes). I guess what I'm looking for is a description or picture that shows the order of bits that you shift out, like something you find on a ADC data sheet.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "You do not really understand something unless you can explain it to your grandmother."


    -Lucky[size=-1][/size]
  • Timothy D. SwieterTimothy D. Swieter Posts: 1,613
    edited 2010-03-21 23:15
    Lucky -

    The first four diagrams to study would be on page 12 and 13. There four diagrams show the relationship of /CS, SCK, SDI and SDO for read and write operations. You will notice that one set of diagrams is for reading/writing the "short" address registers - that is registers with 6 bits. Note how the least significant bit is 0 or 1 based on a read or write operation being performed. Also the packet begins with a 0 to indicate a short address to follow.

    Similarly on page 13 are the diagrams for read/write of the "long" address registers or 10-bit address registers. The packet begins with a 1 to indicate a long address to follow.

    So an SPI sequence looks to be something like this:

    1 bit - indicates if it the next set of bits is a short or long address.
    6 or 10 bits - the short or long address of the registers to operate on
    1 bit - indicates if it is a read or write operation
    some amount of dummy clocks - we should review the data sheet to verify what the diagram is trying to show here.
    8 bits of data. You may be able to keep clocking more than 8-bits out, we just need to review the data sheet more to see what it says.

    As for what registers need to be set and in what sequence for operation.....that looks to be a much larger task to study. I'd review sample code and perhaps any applicable application notes.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Timothy D. Swieter, E.I.
    www.brilldea.com - Prop Blade, LED Painter, RGB LEDs, 3.0" LCD Composite video display, eProto for SunSPOT
    www.tdswieter.com
  • LuckyLucky Posts: 98
    edited 2010-03-21 23:26
    What is the document number? I have seen nothing like that so far!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "You do not really understand something unless you can explain it to your grandmother."


    -Lucky[size=-1][/size]
  • Timothy D. SwieterTimothy D. Swieter Posts: 1,613
    edited 2010-03-21 23:28
    This is the link I am using: ww1.microchip.com/downloads/en/DeviceDoc/DS-39776b.pdf There appears to be a data sheet for the module, which has the MA appended to the end of it and then a data sheet for just the IC. This makes sense because it keeps from duplicating documentation, but it means one needs to use both data sheets during the design and coding process.

    I can see both data sheets listed here: www.microchip.com/wwwproducts/Devices.aspx?dDocName=en535967

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Timothy D. Swieter, E.I.
    www.brilldea.com - Prop Blade, LED Painter, RGB LEDs, 3.0" LCD Composite video display, eProto for SunSPOT
    www.tdswieter.com
  • LuckyLucky Posts: 98
    edited 2010-03-22 00:16
    Oh, wow. This whole time I was looking at the MRF24J40MA module data sheet and not the MRF24J40 ic data sheet. This is what I've been looking for, thanks. It even has a 17 step process for initializing the MRF24J40

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "You do not really understand something unless you can explain it to your grandmother."


    -Lucky[size=-1][/size]
  • Timothy D. SwieterTimothy D. Swieter Posts: 1,613
    edited 2010-03-22 06:04
    You know.....I did the same thing the first time I read this post. I took the part number, did a Google search and promptly looked at the data sheet for the module. After glancing through it I realized it wasn't the IC data sheet. Funny...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Timothy D. Swieter, E.I.
    www.brilldea.com - Prop Blade, LED Painter, RGB LEDs, 3.0" LCD Composite video display, eProto for SunSPOT
    www.tdswieter.com
Sign In or Register to comment.