Jump to content
Lukman

MSPflash do not work on MSP4305969

Recommended Posts

Hello Guys Good Day for All,

I just open the Mspflash example from energia example using MSP4305969LP board.

But when I compile, it show error as below picture.

Any one can help me?

 

Thanks a lot.

Best Regards,
Lukman

1.jpg

Share this post


Link to post
Share on other sites

MSPFlash is not compatible with FR devices as they have FRAM and not FLASH.

Please see the Sketch below for writing to FRAM. In this case the Sketch places a variable called count in FRAM. Then count is increased by 1 each time through the loop. You will see that count will continue increasing after a reset or power cycle.

You can attribute any variable with PLACE_IN_FRAM. Please see in the example placing a structure in FRAM.

#define PLACE_IN_FRAM __attribute__((section(".text")))
#define ENABLE_FRAM_WRITE SYSCFG0 = FRWPPW | DFWP
#define DISABLE_FRAM_WRITE FRWPPW | PFWP | DFWP

uint8_t unsigned long count PLACE_IN_FRAM;

struct data {
  uint16_t count;  
  uint8_t foo[32];
  uint32_t bar;
}; 

struct data mydata PLACE_IN_FRAM;

void setup() {
  Serial.begin(115200);
}

void loop() {
  Serial.print("Value: ");
  Serial.println(count);
  Serial.print("Count in struct: ");
  Serial.println(mydata.count);
 
 /*
  * Uncomment for devices such as the FR2433 that need their FRAM unlocked
  * Before FRAM can be writen to
  */
  //  ENABLE_FRAM_WRITE;  // Program FRAM write enable
 
  count++;      // Record the port event in FRAM
  mydata.count += 2;

  /*
  * Uncomment for devices such as the FR2433 FRAM lock
  */
  //  DISABLE_FRAM_WRITE;   // Program FRAM write protected (not writable)
  delay(1000);
}

 

Share this post


Link to post
Share on other sites

Hello, 
Thank you for your explanation & sample code.
This code is for writing FRAM right?

Do you have sample code for read FRAM also?
And If I want to write new data, is it will automatic replace the old data inside the FRAM?

or I need to erase it first?

 

Thank you.

Best Regards,

 

Lukman

Share this post


Link to post
Share on other sites

One does not explicitly write to FRAM. You just change the value of what is stored in FRAM and it will survive a power cycle or reset. Did you run the Sketch and observe the values as I described? See the count++ and mydate +=2. This is equivalent to a FLASH write. Those incremental values will be there after a reset or reboot. Just run the Sketch and then reset power cycle the board and you will see the result in the Serial monitor.

Share this post


Link to post
Share on other sites

As I'm just learning about FRAM on Energia -- and referring to the example above:

QUESTION  ---  does    count    need to be declared     persistent   ?      (or other declared as other type?)

 

cheers,

 

Share this post


Link to post
Share on other sites

As you can see from the Sketch, count is attributed with PLACE_IN_FRAM. Same for mydata which is of type struct data. This makes it "persistent". PLACE_IN_FRAM is defined as __attribute__((section(".text"))) at the top of the Sketch.

Share this post


Link to post
Share on other sites

Hello, 
Thank you for your sample code. I just run the sketch, the count looks good, event I already reset.

So regarding my question before,  about how to read from FRAM, I can directly use the value from count variable.

And it will auto replace the old value once we replace.

 

Thank you for your help.

Best Regards,

 

Lukman

Share this post


Link to post
Share on other sites

You do not explicitly "read" from FRAM. You just use the variable as you would normally do and yes, the "old" value is updated with the new value and stored in FRAM.

Share this post


Link to post
Share on other sites

Hi Energia,

I know this is energia forum, but yesterday I just try implemented the FRAM code you give to me using CCS 8.

It showing error invalid combination of type specifier.

Please see the attached file. I am wondering whether do you have any comment?

 

Thanks a lot.

 

Best Regards,

 

Lukman

1.jpg

Share this post


Link to post
Share on other sites
Posted (edited)

Hi @Fmilburn  & @energia ,

I know its out of topic, but I have a project to counter up & counter down. This counter up or counter down using interrupt and depend on ADC value.

If the ADC value higher than certain value, it will counter up, once it lower than certain value it will counter down. I have write the code using energia but still doesn't work.

I am wondering whether you are guys can help me to solve the problem.

I appreciate your help.

Best Regards,

Lukman.

 

Edited by Lukman
already solve the problem

Share this post


Link to post
Share on other sites

This may seem rough but you are not going to learn to code by asking questions like these and need to start figuring out some of this on your own.  You do not seem to have an understanding of the C/C++ languages.  I suggest getting a book or taking an online course.  Start with simpler problems if necessary but learn to solve problems yourself.

RE:  code that does not compile - decide whether you want to have an uint8_t variable or an unsigned long variable and then declare it as such.  E.G. for unsigned long:

unsigned long counter PLACE_IN_FRAM;

Regarding your counter code above.  This appears to be something copied from somewhere and has code not necessary for what you are trying to do such as the unused variables fadeValue and NUM_READS.  You do not say why it doesn't work or what you have done to try and fix it.  This is not the kind of thing people will want to spend time on trying to help you figure out.  Break it into pieces you understand, test them until they work as you want, and then put it back together piece by piece testing as you go.

Share this post


Link to post
Share on other sites

Hi @fmilburn,

Thanks a lot, I  really appreciate  your suggestion.
I will try to do your advise.

Best Regards,

 

Lukman

 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×