Quantcast
Channel: MSP430 Technical Forums
Viewing all articles
Browse latest Browse all 2077

Help with FR5969 r/w FRAM

$
0
0

Sorry to bother if I'm missing something obvious in the documentation - but there's something I can't seem to figure out.

 

I'm migrating a simple datalogger that uses an ATTiny24a, BMP180, and an external EEPROM to (hopefully!) take advantage of the power savings and FRAM on the MSP430FR5969.  I've attached a sample of my code by I can't seem to find anywhere similar functions to EEPROM.read and EEPROM.write.  All I've managed to find is FRAM_write<enter # of bits here> in the fram.c in the DriverLib library.

 

 

/*
Simple code to transmit ID and basic sensor data using OOK
 */
 
#include <EEPROM.h>

int pulse = 50;               //transmit pulse length
int interval = 25;            //interpulse length
int sample = 5000;            //time between sensor sampling
int gap = 500;               //time between transmissions
int idArray[] = {1,0,1,1};    //basic tag ID in binary, e.g. 11 = {1,0,1,1}
int addr = 0;                 //initial EEPROM write address
int address = 0;              //initial EEPROM read address

void setup() {
  Serial.begin(115200);
  // initialize digital pin 13 as an output.
  pinMode(13, OUTPUT);
}

void loop() {
//DATA_COLLECTION AND EEPROM WRITE/READ________________________________________________________________
int sensorData = random(1024);  // this is the BMP180 data but now it's just random junk for testing
  if (addr <= 9){
  EEPROM.write(addr, sensorData);
    addr = addr + 1;
    delay(sample);
  }
  if (addr > 9){
    int sensorTransmit = EEPROM.read(address);
//ID_ARRAY_TRANSMISSION________________________________________________________________________________
      for (int j=0; j<4; j++){
        if (idArray[j] == 1){
          digitalWrite(13, HIGH);   
            delay(pulse);  
        }else{
          digitalWrite(13, LOW);    
            delay(pulse);              
        }
        digitalWrite(13,LOW);
        delay(interval);
      }
//SENSOR_ONE_TRANSMISSION________________________________________________________________________________
      for (int k=0; k<8; k++){
        digitalWrite(13, bitRead(sensorTransmit, k));                 
          delay(pulse);
          digitalWrite(13, LOW);
          delay(interval);
            byte state = bitRead(sensorTransmit,k);
            Serial.print(state);
  }
    Serial.println();
        digitalWrite(13, LOW);  
         delay(gap);
            address = address + 1;
    if (address > 9){
      address = 0;
      addr = 0;
    }
  }
}
 

 

 

Basically all I'm trying to do is log data to the FRAM at a specified interval, then after a certain number of datalogging events read it back out and convert to on-off keying.  Each datalogger has it's own unqiue ID. At a later time I want to look into the different lower power modes on the MSP430, but first things first. 

 

Again, I apologize if I'm overlooking something quite simple. 


Viewing all articles
Browse latest Browse all 2077

Trending Articles