Crash when try to write in NVRAM [solved]

Go To Last Post
5 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi freaks,

I have a problem when I try to write in the NVRAM.

I use a EVK1100.

First, I have write my program by using external SDRAM.
All is done.

The next step is to save some data on NVRAM. Then I have try the example provided and so the FLASHC driver from the framework. The example working well.

Then I have modify the lds file by adding :

 FLASH_NVRAM PT_LOAD;

in PHDRS section

__flash_nvram_size__ = DEFINED(__flash_nvram_size__) ? __flash_nvram_size__ : 32K;

in SECTION
and

  .flash_nvram    ORIGIN(FLASH) + LENGTH(FLASH) - __flash_nvram_size__ (NOLOAD) :
  {
    *(.flash_nvram)
  } >FLASH AT>FLASH :FLASH_NVRAM

near the end of the file.

I define variable as :

__attribute__((__section__(".flash_nvram")))
static U8 pstate;

Right now, I'm able to read value of pstate, but when I try :

flashc_memcpy((void *)&pstate, &src, 8, TRUE);

I have a crash, program blocked.

I thought about a configuration or lds file problem but I'm not able to found it.

Somebody know if something else have to be modify in the lds file, or in AVR32Studio project configuration ?

Hope to be enouth clear and somebody have already use framework with flash, SRAM, SDRAM, NVRAM in the same project.

Thanks

cpu

Last Edited: Thu. Jan 13, 2011 - 08:40 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

hmm ... In my project i use

#if __GNUC__
__attribute__((__section__(".flash_nvram")))
#endif
static flash_data_t const  flash_nvram_data
;

- and

           flashc_memcpy((void *)&flash_nvram_data.data, ptr  , sizeof(_BSPSysConfig), TRUE);

for store data .... It's work fine...

PS ... may be static U8 pstate[8];
or flashc_memcpy((void *)&pstate, &src, 1, TRUE); ???

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for your reply.

Regarding your code, I see not difference with mine, just it looks like you use a structure or something close and maybe a typedef. As I use only GNUC I have remove #if.

About your "PS", I have investigate this way yesterday and ... doesn't work. Even with a sizeof(var).

Another idea ?
:(

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So ...

With the help of Atmel support, I know now that there is a known problem with MCU rev I and older.
I have an application note AVR32749 who describe a software workaround implementation but ... I don't understand what I have to do in details.

Is there somebody who have already do this workaround by using flashc_issue_command function ?

For sure I have asking the same question to the support but as I've time short ...

If the support is faster, I will post solution here after.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Finally ...

Ok, it was a known problem. The application note wasn't really clear because ... I have receive a link for download files after and in the quantity of Atmel documentation sometimes I'm lost.

So, for all others like me a little, and I hope simple, explanation:

On MCU Rev I and before (can be check with JTAG with a "Read MCU info") there is a NVRAM problem known and solved. But you have to make some modification in your lds file to add a new section. There is some files of the framework to "update" where the flashc_issue_command function is different.

Files flashc.h, flashc.c and lds example are downloadable here :
http://www.atmel.com/dyn/products/app_notes.asp?family_id=607

AVR32749 part.

We have just to remove the old flashc files and paste new ones, and use the lds (with modifications according to your previous modifications if necessary). The code itself haven't to be modify.

Have fun

cpu