Project

General

Profile

Making dataflash play nicely with LowPower Labs RF69 driver

Added by RobJW over 4 years ago

Jean-Claude (or any other contributors) can you help me with a flash access challenge on a JeeLink?

I’m trying to run the Dataflash code from the JeeLib with the RFM69 driver created by Felix Rusu
https://github.com/LowPowerLab/RFM69

Code status: the rf receiver works as planned but flash access fails on initialise.
df_initialise fails to read the device ID (info =0 rather than 0x2020)

static void df_initialize () {
    // assumes SPI has already been initialized for the RFM12B
    df_disable();
    pinMode(DF_ENABLE_PIN, OUTPUT);
    df_command(0x9F); // Read Manufacturer and Device ID
    word info = df_xfer(0) << 8;
    info |= df_xfer(0);
    df_deselect();
Serial.print(F("Info = "));
Serial.println(info,HEX);
    if (info == DF_DEVICE_ID) {
        df_writeCmd(0x01);  // Write Status Register ...
        df_xfer(0);         // ... Global Unprotect
        df_deselect();

        scanForLastSave();

        showString(PSTR("DF I "));
        Serial.print(dfLastPage);
        Serial.print(' ');
        Serial.println(dfBuf.seqnum);

        // df_wipe();
        df_saveBuf(); //XXX
    }
}

I’m using the latest SPI library modified by Paul Streffregen to include transaction support
http://hackaday.com/2014/08/01/arduino-spi-library-gains-transaction-support/
now incorporated in the latest Arduino IDE v1.6.6

In other articles I’ve read about interrupts clashes between the SPI bus and the RF69 chip, e.g.
http://forum.jeelabs.net/node/154.html
Is the Dataflash library robust to these?

In setup() the flash memory is initialised (or not initialised) after the radio chip . . . see below

  radio.initialize(FREQUENCY,NODEID,NETWORKID);
  //radio.setHighPower(); //uncomment only for RFM69HW!
//  radio.encrypt(KEY);
  Blink(LED,100); //debug
  radio.encrypt(null);
  radio.promiscuous(promiscuousMode);
  char buff[50];
  sprintf(buff, "\nListening at %d Mhz...", FREQUENCY==RF69_433MHZ ? 433 : FREQUENCY==RF69_868MHZ ? 868 : 915);
  Serial.println(buff);

    df_initialize();

Any thoughts much appreciated

Thanks

Rob