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.