This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How to write to flash using CPU SFR register in CC2510 ???

Other Parts Discussed in Thread: CC2510F8, CC2510

I have been using 5 dma channels in my RF applications. So, II wanna write to flash through CPU SFR access not DMA

I made a test simple code of 2bytes flash write with chapter 12.3.2.2 CPU Flash write reference in CC2510f8 datasheet as followed.

I aleady have set clolck speed, source and  global interrupt enable in code.

1. FCTL busy check

2. FADDRH or L, FWT, FCTL write set

at this time,  I  tested FADDRH valuse as FADDRH = 0x0e, FADDRL = 0x00; to write at 0x1c00

3. inserting 1 byte data to FWDATA register twice.

4.  SWBUSY check for FCTL's flash  writing

but, I could not handle  FCTL.WRITE bit in spite of forcibly setting to FCTL through S/W register access.

also, at 0x1c00 address, the 2bytes data at flash region  don't updated.

I think it seems to need some prior work.

Is there some environment setting of  interrupts and other register etc. before acessing flash writing ?

or, do i miss the flash write handling???

Can I see some example code for flash write through CPU SFR access?

Thank you so much if you present me some simple example about it.

 

  • Hi.

    Did you get the part in the datasheet that states that you have to run code from RAM?
    Don't have an example code right now, but there will be one posted within a few weeks at www.ti.com, probably under the CC2510 page

    Rgds,
    Kjetil

  • Hi, Kjetil

    Thank you for your kind reply.

    Yes, I catched that the code must be  run from RAM, but the flash code has a  problem about it..

    I understood this code means that it is the code about only flash write functions and variables except other RF application part .

    Kjetil, is that right?? I have mixed feeling about that.

    Anyway,  I call the individual functions that I made to write flash.  but, this call stack address is positioned in code memory region, not in RAM region.

    I archeived success to position  the  data that  will be written to flash region (about 1kbyte ; 0x1c00 ~ 0x1eff) into RAM region (0xF000~0xFDA1), but the funtion call is failed to do into RAM region.

    Now, I am testing with CC2510f32, but Later, I will chage it to CC2510f08 chip

    As you recommend, it seems to have the  problem about that. I think flash writing process don't work because of it.

    Even though I refer to the document as called by 8051 C/C++  complier reference guide, I don't know how to position the code in RAM region as a C source.

    As though I have a wrong thought about it, if you know me the way how to be run code from RAM. I will be glad so much.

     

  • David Kim said:

    Even though I refer to the document as called by 8051 C/C++  complier reference guide, I don't know how to position the code in RAM region as a C source.

    Please take a look at the IAR Linker and Library Tools Reference Guide.  It discusses how to use the -Q option AND code your application, to setup sections to be placed in one location in memory (ie. flash) and to be copied to RAM for runtime.  Again, some code in your application will be required to actually perform the copy.

  • David,

    New basic software examples for the 8051 SoC can be found here:

    http://www.ti.com/litv/zip/swrc117

    This contains code for programming the flash from CPU and has everything you need (copying function to ram and executing from ram).

    Hope this helps,

    Rgds,
    Kjetil