Mrf24J40Ma with Arduino Nano

Hello all !

  • I have some question about mrf24j40ma with arduino.
  • Code:
/**
 * Example code for using a microchip mrf24j40 module to send simple packets
 *
 * Requirements: 3 pins for spi, 3 pins for reset, chip select and interrupt
 * notifications
 * This example file is considered to be in the public domain
 * Originally written by Karl Palsson, karlp@tweak.net.au, March 2011
 */
#include <SPI.h>
#include <mrf24j.h>

const int pin_reset = 6;
const int pin_cs = 10; // default CS pin on ATmega8/168/328
const int pin_interrupt = 2; // default interrupt pin on ATmega8/168/328

Mrf24j mrf(pin_reset, pin_cs, pin_interrupt);

long last_time;
long tx_interval = 1000;

void setup() {
  Serial.begin(9600);
  
  mrf.reset();
  mrf.init();
  
  mrf.set_pan(0xcafe);
  // This is _our_ address
  mrf.address16_write(0x6001); 
  
  // uncomment if you want to enable PA/LNA external control
  //mrf.set_palna(true);

  attachInterrupt(0, interrupt_routine, CHANGE); // interrupt 0 equivalent to pin 2(INT0) on ATmega8/168/328
  last_time = millis();
  interrupts();
}

void interrupt_routine() {
    mrf.interrupt_handler(); // mrf24 object interrupt routine
}

void loop() {
    mrf.check_flags(&handle_rx, &handle_tx);
}

void handle_rx() {
    // data to receive, nothing to do
}

void handle_tx() {
    if (mrf.get_txinfo()->tx_ok) {
        Serial.println("TX went ok, got ack");
    } else {
        Serial.print("TX failed after ");Serial.print(mrf.get_txinfo()->retries);Serial.println(" retries\n");
    }
}
  • Why don’t set up pin Wake (mrf24j40ma) ?. And when i send data, range only 20cm . How to increase the range? Because datasheet mrf24j40ma said : range about 70 meter

Hi, do u found any solution for it? I also encounter the same problem.

You are asking your question in a 3-years-dead Thread and in a Thread that never got to a solution.

What is "mrf24j40ma" ?

Post a link to its datasheet.

...R

Hello guys…im happy to share you some info…im manage to make the chip mrf24j40ma-mc module works great…here the tips:
1.un-comment //mrf.set_palna(true);
2.add this below mrf.set_palna(true);
write_short(MRF_TRISGPIO,0b00111111);
write_short(MRF_GPIO,0b00001111);
3.then upload…thats it…but make sure you set the target address and local address right ok…if you need detail explaination feels free to email me ok:haffizjohar@gmail.com

haffizjohar:
Hello guys...im happy to share you some info...im manage to make the chip mrf24j40ma-mc module works great..here the tips:

If you can post a complete working demo program I'm sure it would be helpful to others.

...R