• AVR Freaks

MRF24J40MB - ZigBee, MiWi or my own program?

Author
assafelbaz
Senior Member
  • Total Posts : 144
  • Reward points : 0
  • Joined: 2011/07/19 23:44:47
  • Location: 0
  • Status: offline
2011/08/14 07:46:39 (permalink)
0

MRF24J40MB - ZigBee, MiWi or my own program?

Hi.

I'm using MRF24J40MB transceiver and i will monitor it with Zena Analyzer.

    1. For simple use of MRF24J40MB module as a transmitter for my temperature sensor what i better use: ZigBee, MiWi or i should write my own code?
    2. What is the differences between ZigBee and MiWi?
    3. Where can i find code examples for simple use?

Thank you.
post edited by assafelbaz - 2011/08/14 07:49:28
#1

19 Replies Related Threads

    dlindbergh
    Super Member
    • Total Posts : 478
    • Reward points : 0
    • Joined: 2006/09/11 18:17:11
    • Location: Boston USA
    • Status: offline
    Re:MRF24J40MB - ZigBee, MiWi or my own program? 2011/08/14 13:13:08 (permalink)
    0
    Write your own code.

    Zigbee - huge, complex, unnecessary unless your app needs to be Zigbee conformant.

    MiWi - my experience is the MiWi code takes far more time to integrate and debug for a simple application than does writing your own code.

    If you really need all the routing and addressing stuff, then the MiWi code might be worthwhile.  For most simple apps, you don't need it.

    Your own code - Don't let the thickness of the datasheet intimidate you.  Read the sections on initialization, transmit, and receive.  Code to that.  You can pretty much ignore the rest of the datasheet.  Follow the initialization instructions in the datasheet exactly.

    Cheers,

    --Dave

    #2
    DarioG
    Allmächtig.
    • Total Posts : 54081
    • Reward points : 0
    • Joined: 2006/02/25 08:58:22
    • Location: Oesterreich
    • Status: offline
    Re:MRF24J40MB - ZigBee, MiWi or my own program? 2011/08/14 13:57:45 (permalink)
    3 (1)
    agreed! Smile

    GENOVA :D :D ! GODO
    #3
    assafelbaz
    Senior Member
    • Total Posts : 144
    • Reward points : 0
    • Joined: 2011/07/19 23:44:47
    • Location: 0
    • Status: offline
    Re:MRF24J40MB - ZigBee, MiWi or my own program? 2011/08/14 19:27:51 (permalink)
    0
    Thank you so much for your time! It was very helpful.
    #4
    gjaman
    Starting Member
    • Total Posts : 83
    • Reward points : 0
    • Joined: 2006/08/23 13:26:56
    • Location: Canada
    • Status: offline
    Re:MRF24J40MB - ZigBee, MiWi or my own program? 2011/08/14 19:55:27 (permalink)
    0
    For a simple application I would suggest using part of MiWi (MiMAC)... even just the MRF24J40.h/c files as a guide.  The implementation of the basic function within it should be enough to get you going.  
    Having done the "Your own code" method with other chips, I found I spent a significant amount of time debugging issues in my own code.  

    -greg
    #5
    Oznog
    Super Member
    • Total Posts : 1011
    • Reward points : 0
    • Joined: 2004/10/14 21:54:10
    • Status: offline
    Re:MRF24J40MB - ZigBee, MiWi or my own program? 2011/08/26 21:49:31 (permalink)
    0
    I've been greatly troubled by trying to integrate either Zigbee, MiWi, or their RadioDriver utility.

    I have been looking for a simple, straight code description for THEIR code, and, well, I've never found anything like that.  I've had these modules for quite some time.  Custom-made PCBs for them with 33F's onboard.  Have never found a way to make them do anything, and it's been disheartening, to say the least.

    I thought RadioDriver would be a great starting point, but the code wasn't written to a modern clarity and reuse standard; for some queer reason it's C structured primarily with GOTOs of all things.  I spent some hours trying to graph what it was doing and convert to normal, reusable C but without understanding the code's flow initially I really couldn't sort it out.

    Maybe I should pick up the Clark Leach code again- I looked at it for a bit but figured it was probably a bit too nonstandard to start basing a project on.  

    I even started looking at the amateur Atmel libraries people had come up with for the MRF24J40.

    I gotta say, something's very wrong here.  The transmitters have spectacular capability at a good price.  Yet I've seen no user pages of people documenting actually using it.  

    I'm going to check out the idea of custom code from the module spec sheet itself- I do normally work that way, but I had concluded early on that the MRF24 was too complex to homebrew a solution for, and reuse of such a solution would be very limited.  But now I'm thinking I was mistaken in that assumption.
    #6
    assafelbaz
    Senior Member
    • Total Posts : 144
    • Reward points : 0
    • Joined: 2011/07/19 23:44:47
    • Location: 0
    • Status: offline
    Re:MRF24J40MB - ZigBee, MiWi or my own program? 2011/08/27 19:20:54 (permalink)
    0
    Thank you all guys.

    I found a thread with 4 files. It looks pretty easy to understand the process here.
    http://www.microchip.com/forums/tm.aspx?m=546788

    I have two questions before i begin to build my code:
        1. Can i monitor my wireless traffic with Zena Wireless Analyzer, but without using MiWi or ZigBee?
        2. Doe's the code i have found is good enough to begin transmitting?

    Thank you.
    #7
    DarioG
    Allmächtig.
    • Total Posts : 54081
    • Reward points : 0
    • Joined: 2006/02/25 08:58:22
    • Location: Oesterreich
    • Status: offline
    Re:MRF24J40MB - ZigBee, MiWi or my own program? 2011/08/28 03:54:50 (permalink)
    0
    Yes to 2 Smile but IMO no to 1...

    GENOVA :D :D ! GODO
    #8
    gjaman
    Starting Member
    • Total Posts : 83
    • Reward points : 0
    • Joined: 2006/08/23 13:26:56
    • Location: Canada
    • Status: offline
    Re:MRF24J40MB - ZigBee, MiWi or my own program? 2011/08/28 09:07:27 (permalink)
    0
    The zena will pick up any 802.15.4 packet... regardless of the high level protocol (MiWi,Zigbee, your custom mac).   The zena software will probably try interpret the payload as one of the high level protocol or display it with a label saying invalid packets.   However, you will still be able to inspect the payload and verify the packet against your own protocol format.  Might not be pretty, but it'll work.
    -greg





    #9
    immesys
    New Member
    • Total Posts : 5
    • Reward points : 0
    • Joined: 2011/08/28 07:15:58
    • Location: 0
    • Status: offline
    Re:MRF24J40MB - ZigBee, MiWi or my own program? 2011/08/28 10:13:11 (permalink)
    0

    Oznog:

    I've been greatly troubled by trying to integrate either Zigbee, MiWi, or their RadioDriver utility. 

    Having had difficulty finding the free zigbee stack, I am considering using the MiWi stack. I have in the past been burned by buying modules and never being able to get them working. I once manufactured 50 boards, designed for the ZeroG 802.11 module (a week before microchip deprecated the zeroG module and released their own) and had to try and get the example code working. Much as I love microchip, the code was amazingly shoddy and I never got the module working for anything other than Ad-Hoc networks. 

    The MRF24J40 is solidly a Microchip product though, so I am hoping the example code will be better, when I find it. I have always found Microchips documentation to be superb, but sometimes the example code is not quite as good :-( What were your problems with the MiWi code and do you really think I should roll my own? This is only a small part of a large project and I can't afford to get stuck for weeks on bugs in my own code.
    post edited by immesys - 2011/08/28 10:15:49
    #10
    DarioG
    Allmächtig.
    • Total Posts : 54081
    • Reward points : 0
    • Joined: 2006/02/25 08:58:22
    • Location: Oesterreich
    • Status: offline
    Re:MRF24J40MB - ZigBee, MiWi or my own program? 2011/08/28 11:35:20 (permalink)
    0
    Ah ok, thank you Greg.

    GENOVA :D :D ! GODO
    #11
    Oznog
    Super Member
    • Total Posts : 1011
    • Reward points : 0
    • Joined: 2004/10/14 21:54:10
    • Status: offline
    Re:MRF24J40MB - ZigBee, MiWi or my own program? 2011/09/04 15:03:52 (permalink)
    0
    The MRF24J40 is solidly a Microchip product though, so I am hoping the example code will be better, when I find it. I have always found Microchips documentation to be superb, but sometimes the example code is not quite as good :-( What were your problems with the MiWi code and do you really think I should roll my own? This is only a small part of a large project and I can't afford to get stuck for weeks on bugs in my own code.

    Hmm.  Good question.  It's not just one thing.
    First off, the nature of the basic task IS complicated in that you have 2 nodes and a complex link between them.  This is a complex thing to debug because you don't know which node might be the problem.  Physically, my ideal testbench would use 2 computers and 2 ICD3's, but that's probably not going to happen.  Of course, that's the nature of the problem, not of the code.

    I guess my aggravation with the demo code is this.  I suspect I'm mistaken on some points here, but not all, it's a collective pile of problems.
    1) A lot of it is heavily tied to the Demo board.  I don't use demo boards, and have no interest in using them.  I'm sure it would probably compile and run OK but won't actually get me much further since this doesn't actually make it work on my boards and tasks.  It has LCD writing tasks, LED flashers, temp sensor reading, and other code chaff I have no interest in.  I need a driver and a simple program.
    2)  The "MiWi DE Basic Demos" code has a TON of ifdef switches in it for different targets, even though it's got target-specific project files.  I'm divided in some ways because that seems like it would increase reusability in many ways, but the basic problem here is I can't read through the code with it so much stuff which may or may not be part of the build.
    3)  The system makes use of NVM the dsPIC doesn't have.  I'm not into adding external EEPROM and trying to integrate it into the project.  We can write program space but that's somewhat complicated and even if there's code in the project which does that, I really have to know upfront exactly what it's doing to write a system around it.  For example, writing program space usually means disabling all interrupts.  I need to know in detail all about that because I may have timers which need to sample inputs at specific times and if you disable the interrupts for awhile then it can break things.  
    I'm puzzled as to why the system thinks it NEEDS NVM or was just added to improve reliability if a node loses power.  That's actually pretty unlikely for me.  It does not sound like something I'd want included in a getting-started effort at all.  
    4)  Basically I'm looking for a standard code description of the code itself, NOT a presentation on how to run demo code, and not a high-level appnote on how these mesh networks work.  Actual code, the tasks, the interrupts, what I need to integrate into a project.  I can't find one.
    5)  The MiWi/Zigbee stuff uses a lot of network configuration, and that external Zena tool for configuration.  I'm sure that's useful and all, but integrating into a project requires an incremental approach.  To me, I was just puzzled.  The documents were again all seeming to be limited to the context of working with a standard demo board, not applying towards a user project.
    Basically, I'm looking through MiWi DE Basic Demos, Simple Example, Node 1.  What does it do?  How's it different than Node 2?
    I'm looking at nvm.c, trying to understand the potentially complicated (or simple) NVM issues.   "#if defined(PROTOCOL_MIWI_PRO)" OK, what's that define?    "#if defined(NWK_ROLE_COORDINATOR)"... what's that?  Oh wait "#if defined(ENABLE_NVM)"... yay, this sounds like a way to run without NVM.  Will it run ok without it?  What are the consequences?  Do I need to do anything different?
    I have no idea.  I'm browsing the directory.  PDF for this?  Nothing here at all.  App note?  If there is, I can't find it, and I think I have them all.
    6)  I was looking for the incremental path here.  As in, "this is how you verify the MRF24J40 driver is correctly sequencing the reset and communicating through the SPI".  "This is how you verify you've got a link to another node".  "This is how you send "hello" to is, and how it's received". 
    7) So, typically I don't go confused for very long without consulting Google, where I find people who have done it and documented the situation.  But, I can't find anyone who has.  There's very little out there, even though these modules have been out for years, and that's troubling.  Of course not everyone who gets a project working blogs it, only a small % do.  But that % goes up when there is little else out there about it.   So far, dlindbergh, DarioG, and Clark Leach and a page on using it with the Arduino seem to pretty much be the sum of the community documentation on the MRF24J40, and almost nothing else.  In fact, depending on your search term, THIS THREAD may be at the top of the Google results once you get past the official Microchip releases.  


    It seems a tragedy to me.  I mean, the hardware looks great, it's got the specs I need and I don't care so much about it taking up a lot of program space, it looks mind-bogglingly useful for many people, the MiWi code looks like a LOT of work went into making it, and then they seem to have totally dropped the ball on documentation OF the code, given the complexity involved in applying it to a project.






    #12
    dlindbergh
    Super Member
    • Total Posts : 478
    • Reward points : 0
    • Joined: 2006/09/11 18:17:11
    • Location: Boston USA
    • Status: offline
    Re:MRF24J40MB - ZigBee, MiWi or my own program? 2011/09/05 09:00:41 (permalink)
    0
    Oznog, your criticisms are all valid - I ran into the same things.

    My conclusion is that it's far better to write your own code, unless you really need the functionality that's in MiWi.   I know the datasheet makes it look horribly complex, but it's not really - there are only about 10 pages in the datasheet that affect what you have to do in software.

    I posted my experience with this on my blog the other day: http://nerdfever.com/?p=1457

    If there is enough interest, I could post some working code to drive the MRF24J40 that's tiny compared to the MiWi code.  It works on the PIC32 but I think it would be relatively trivial to port it to another PIC.

    Cheers,

    --Dave
    #13
    immesys
    New Member
    • Total Posts : 5
    • Reward points : 0
    • Joined: 2011/08/28 07:15:58
    • Location: 0
    • Status: offline
    Re:MRF24J40MB - ZigBee, MiWi or my own program? 2011/09/05 12:21:17 (permalink)
    0
    Oznog, I have to say I agree with you completely. I use Microchip products because the hardware and the datasheets with the hardware are really great. The team that does the example code however, really need to learn from the hardware designers' work ethos.

    In general, the code is so riddled with uncommented preprocessor directives that cater for everything from PIC 16's to PIC 32's on several different demo boards, that you can't get to the meat of it. I am sure that I am not alone when I say that what I really want is better separation between platform independant example code (bare minimum for functionality) and the niggly bits for specific demo boards.

    Even if that cannot be achieved (because I understand that the different families have very different ways of doing things like interrupts etc.) it would be great if they could spend some time creating documentation so that you had something to turn to when you are asking simple questions like "Ok, I've got this transceiver, how do I integrate it into my project with minimal unnecessary code"

    And I am not only referring to the code for the MRF24J40. I have had the same experiences with the mTouch code and even worse experiences with code for the ZG2100M.

    So, Oznog, I think you hit the nail on the head. I hope Microchip notices this post and does something, because I know they do listen and respond to their community (sometimes even with a sense of humour: http://www.youtube.com/watch?v=3YUvlrVlNao)

    #14
    assafelbaz
    Senior Member
    • Total Posts : 144
    • Reward points : 0
    • Joined: 2011/07/19 23:44:47
    • Location: 0
    • Status: offline
    Re:MRF24J40MB - ZigBee, MiWi or my own program? 2011/09/06 10:05:38 (permalink)
    0
    dlindbergh
    I posted my experience with this on my blog the other day: http://nerdfever.com/?p=1457


    Dave, I enjoyed reading this article you have linked here.
    I recommend it to anyone who shares the same question.
    #15
    Oznog
    Super Member
    • Total Posts : 1011
    • Reward points : 0
    • Joined: 2004/10/14 21:54:10
    • Status: offline
    Re:MRF24J40MB - ZigBee, MiWi or my own program? 2011/09/09 21:01:24 (permalink)
    0
    Wow.  I was afraid I was just frustrated and being excessively whiny on this one.  To tell the truth, it would not be the first time.

    I've been working on the MiWi "Simple Example- Node 1" for several days.  Actually there's more documentation within the files than I had thought.  No way I could have even known that, given a lack of a code description telling where to find that.  Yes, the need for NVM can be dismissed with a #define.  

    Well at least it's compiling for my 33F part & board there now.  I had to make a number of changes there.  It's not all that big- it's 2844 bytes program, 756 bytes data, but that includes main() and there's probably a significant amount of extraneous code still left.  Sure, in the old days, consuming 2K-3K was blasphemy, but nowadays, getting parts with more memory is usually trivial.

    Like I say, I think the code itself was well-written.  This could be inherently useful if actually "fixed" into a coder-friendly package, and documented with a proper code description.
    #16
    RaisinToe
    Senior Member
    • Total Posts : 171
    • Reward points : 0
    • Joined: 2008/12/09 14:00:56
    • Location: UT
    • Status: offline
    Re:MRF24J40MB - ZigBee, MiWi or my own program? 2011/12/17 23:09:51 (permalink)
    0
    dlindbergh

    If there is enough interest, I could post some working code to drive the MRF24J40 that's tiny compared to the MiWi code.  It works on the PIC32 but I think it would be relatively trivial to port it to another PIC.

    Cheers,

    --Dave


    Could you post your code? please, please please!
    #17
    dlindbergh
    Super Member
    • Total Posts : 478
    • Reward points : 0
    • Joined: 2006/09/11 18:17:11
    • Location: Boston USA
    • Status: offline
    Re:MRF24J40MB - ZigBee, MiWi or my own program? 2011/12/22 17:40:24 (permalink)
    0
    OK, I'm attaching the code to this reply.

    This is my latest version of the code, but it isn't cleaned up as much as I'd like before going public with it.  I've been meaning to clean it up a bit this winter before making it public, but since you asked I'm posting it as-is.

    To get started, look at the C source code for the functions that have prototypes in the .h file.  These are the main API to the driver code.  The other functions (not listed in the .h file) you can ignored; they're not meant to be called externally.

    I hope this is helpful.  Let me know (post in this thread) if you have questions.

    Cheers,

    --Dave

    #18
    RaisinToe
    Senior Member
    • Total Posts : 171
    • Reward points : 0
    • Joined: 2008/12/09 14:00:56
    • Location: UT
    • Status: offline
    Re:MRF24J40MB - ZigBee, MiWi or my own program? 2011/12/22 20:57:43 (permalink)
    0
    Gee, thanks! I will have to try it out as soon as I can.
    #19
    Brick
    Super Member
    • Total Posts : 1684
    • Reward points : 0
    • Joined: 2006/05/25 09:10:40
    • Status: offline
    Re:MRF24J40MB - ZigBee, MiWi or my own program? 2011/12/22 21:29:31 (permalink)
    0
    I have one suggestion for simple easy RF comms "XBEE"
    #20
    Jump to:
    © 2019 APG vNext Commercial Version 4.5