This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

DS5250 Flash access?

I'm currently working with the DS5250 evaluation kit.
I tried to write a small application to permanently store data in the flash chip, but I have trouble understanding how this is mapped.

I'm currently reading/writing to flash like this:

FLASH_READ:
//reads the content of the flash memory and puts it in CHAR_VALUE
        MOV DPTR, #flashcharc
        ORL FLMC, #010h ; enable flash access (sets FLMC.4 (FLCM) to 1)
        MOVX A, @DPTR
        ANL FLMC, #0EFh ; disable flash access (clears FLMC.4 (FLCM) to 0)
        MOV CHAR_VALUE, A

        RET

FLASH_WRITE:
        //writes CHAR_VALUE to the flash memory

        MOV DPTR, #flashcharc
        MOV A, CHAR_VALUE
        ORL FLMC, #010h ; enable flash access (sets FLMC.4 (FLCM) to 1)
        MOVX @DPTR, A
        ANL FLMC, #0EFh ; disable flash access (clears FLMC.4 (FLCM) to 0)

        RET


I'm defining the variable #flashcharc like this:

char far flashcharc _at_ 0x100001;

I'm placing it there because I understand that flash can be accessed from address 0x100000.
Of course it doesn't work at all. Can someone point me what I'm doing wrong?
I'm using a ROM size of "Contiguous Mode: 16MB program" and "Large: variables in XDATA" memory model.

I'd really appreciate a nudge in the right direction.

Parents
  • "Could anyone post an example in a non-secure microprocessor based on the 8051?"

    Have you actually looked at the examples that are installed with your Keil tools?

    They are also available at http://www.keil.com/download/

    And don't forget the Application Notes: http://www.keil.com/appnotes/

    "All I want to do is write some data on the flash memory."

    Begin with the basics - forget about 'far', and just try writing to the part of your flash that appears in the 8051's standard 64K XDATA address space.

    Once you have that working, then you can adapt it to work beyond the 64K limit...

    "the flash I'm using is a AM29F080B."

    Go to the manufacturer's website - they will almost certainly have example code for writing to their devices...

Reply
  • "Could anyone post an example in a non-secure microprocessor based on the 8051?"

    Have you actually looked at the examples that are installed with your Keil tools?

    They are also available at http://www.keil.com/download/

    And don't forget the Application Notes: http://www.keil.com/appnotes/

    "All I want to do is write some data on the flash memory."

    Begin with the basics - forget about 'far', and just try writing to the part of your flash that appears in the 8051's standard 64K XDATA address space.

    Once you have that working, then you can adapt it to work beyond the 64K limit...

    "the flash I'm using is a AM29F080B."

    Go to the manufacturer's website - they will almost certainly have example code for writing to their devices...

Children
No data