• AVR Freaks

Hot!MRF24J40 Initialize Problem

Author
phillipphan
New Member
  • Total Posts : 3
  • Reward points : 0
  • Joined: 2007/05/02 20:28:49
  • Location: 0
  • Status: offline
2007/05/02 21:02:12 (permalink)
0

MRF24J40 Initialize Problem

Hi Every body, I'm trying to initialize my mrf24j40. Here is the code:

void initMRF24J40(void)
{
        int8 i;
        int16 j;

        output_low(RESETn);
        for(i=0;i<255;i++){}
        output_high(RESETn);
        for(i=0;i<255;i++){}

        /* flush the RX fifo */
        SetShortRAMAddr(RXFLUSH,0x01);

        /* Program the short MAC Address, 0xffff */
        //<TODO> this step may not be required
        SetShortRAMAddr(SADRL,0xFF);
        SetShortRAMAddr(SADRH,0xFF);
        SetShortRAMAddr(PANIDL,0xFF);
        SetShortRAMAddr(PANIDH,0xFF);

        /* Program Long MAC Address, 0xFFFFFFFFFFFFFFFF*/
        SetShortRAMAddr(EADR0, 0xFF);
        SetShortRAMAddr(EADR1, 0xFF);
        SetShortRAMAddr(EADR2, 0xFF);
        SetShortRAMAddr(EADR3, 0xFF);
        SetShortRAMAddr(EADR4, 0xFF);
        SetShortRAMAddr(EADR5, 0xFF);
        SetShortRAMAddr(EADR6, 0xFF);
        SetShortRAMAddr(EADR7, 0xFF);

        /* program the RF and Baseband Register */
        SetLongRAMAddr(RFCTRL4,0x02);

        /* Enable the RX */
        SetLongRAMAddr(RFRXCTRL,0x01);

        /* setup */
        SetLongRAMAddr(RFCTRL2,0x80);

        SetLongRAMAddr(RFCTRL3, 0x08);

        /* program RSSI ADC with 2.5 MHz clock */
        SetLongRAMAddr(RFCTRL6,0x04);
        SetLongRAMAddr(RFCTRL7,0b00000000);

        /* Program CCA mode using RSSI */
        SetShortRAMAddr(BBREG2,0x80);
        /* Enable the packet RSSI */
        SetShortRAMAddr(BBREG6,0x40);
        /* Program CCA, RSSI threshold values */
        SetShortRAMAddr(RSSITHCCA,0x60);

        do
        {
            i = GetLongRAMAddr(RFSTATE);
        }
        while((i&0xA0) != 0xA0);  //Stuck here!!!!!!!!!!!!

}

The code get stuck at the end when I'm trying to read the RFState , I dont get 0xA0 to pass the loop instead i always got 0x00. I think something is wrong in my initialize code.
Anyone please help!!!!

#1

6 Replies Related Threads

    pierrick
    New Member
    • Total Posts : 14
    • Reward points : 0
    • Joined: 2007/03/27 01:02:44
    • Location: 0
    • Status: offline
    RE: MRF24J40 Initialize Problem 2007/05/03 02:30:01 (permalink)
    0
    Hi,

    I had the same problem : the supplied voltage of the MRF24J40 was down to the min 2.4V. I could communicate via SPI but, like you,  i always got 0x00 when i was trying to read the RFState. You should verify the supplied voltage.
    #2
    phillipphan
    New Member
    • Total Posts : 3
    • Reward points : 0
    • Joined: 2007/05/02 20:28:49
    • Location: 0
    • Status: offline
    RE: MRF24J40 Initialize Problem 2007/05/03 07:48:33 (permalink)
    0
    My supply voltage still stays at 4.98V.
    #3
    ADD_santi
    Starting Member
    • Total Posts : 70
    • Reward points : 0
    • Joined: 2007/03/15 09:40:27
    • Location: Zaragoza (Spain)
    • Status: offline
    RE: MRF24J40 Initialize Problem 2007/05/17 23:58:51 (permalink)
    0
    Hi Philipphan!

    Did you find what was wrong?

    Could you tell me?

    And I have another question, do you know any register in MRF24J40 that desactive the RX when you have received a data, because I have one problem.
    When I receive 2 packets the transceiver read the frist and when I am reading the packet from FIFO Rx if I receive another packet while I am reading this packet destroy my first packet and then I receive a mix between the two packets.
    In therory the Rx is desactivate until you read the last byte in FIFO Rx or until you make a FLUSH.
    Could you help me??

    Thanks
    Santi
    #4
    ferdi78
    Super Member
    • Total Posts : 198
    • Reward points : 0
    • Joined: 2005/08/23 12:32:47
    • Location: Brasil
    • Status: offline
    RE: MRF24J40 Initialize Problem 2007/05/18 05:05:00 (permalink)
    0

      I have one doubt, 4.98V is the voltage on your power supply or the voltage on MRF24J40 VDD pin ? cause MRF24J40 works at a max VDD of 3.6V.

    From datasheet

    Voltage on VDD with respect to VSS ............................................................................................................ -0.3V to 3.6V


      Hope it helps,

    Ferdi.
    #5
    jonbh
    New Member
    • Total Posts : 22
    • Reward points : 0
    • Joined: 2015/03/31 06:16:21
    • Location: 0
    • Status: offline
    Re: RE: MRF24J40 Initialize Problem 2016/09/26 11:01:51 (permalink)
    3 (1)
    I know this is a really old post, but I had a similar problem and wanted to post my solution.  In the MRF24J40ME PICtail/PICtail Plus Daughter Board, there is a EEPROM chip that is also on the SPI bus.  Therefore, there are two nCS pins on the PICtail connector, a MRF nCS and an EE nCS.  If you mix these up (as I did), the MRF24J40 will not respond.  Hope this helps someone, it stumped me longer than I care to admit.  :)
    #6
    m.roshandel
    New Member
    • Total Posts : 1
    • Reward points : 0
    • Joined: 2019/10/16 01:00:27
    • Location: 0
    • Status: offline
    Re: RE: MRF24J40 Initialize Problem 2019/10/17 02:52:45 (permalink)
    0
    Hi everybody, i have question about MRF24J40.i am using some of MRF24J40 in my project. sme where that Master and Slave is not near to them for example 2 km distance i need a coordinator or router between them.i use on of MRF24j40 as coordinator between two node.but it is not work well.often data is currept between them in packet.is ther any body that use MRF24J40 in coordiantor?can say me how it can be done?
    #7
    Jump to:
    © 2019 APG vNext Commercial Version 4.5