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.

CC2430 Flash read

Other Parts Discussed in Thread: CC2430

Hello

 

Please excuse my  non-perfect english and probably not professionall questions. That said, I would like to ask if someone can tell me how to read from the integrated flash of a CC2430 F128 chip, or could point me to a helpful ressource.  Specifically I would like to know how to access the part of flash not mapped to xdata memory space. I don't know if this is relevant, but I use sensinodes nanostack + FreeRTOS + sdcc for programming purposes.

Thank you very much

 

Susa

  • Hi Susa,

    The CC2430 uses banking to map different areas of the flash into the xdata space. By changing the FMAP.MAP register, you will see different parts of the flash memory in the xdata space. This is described in section 11.2.2 of the datasheet.

    There is also a section of the flash that is not accessible from the system. That is a 2KB block used for system configuration. It is called the information page, and is only accessible through the debug interface.

  • Hi Susa,

    This is really straightforward the only catch is that the code for reading flash must be in bank0.

    Disable interrupts

    swithc FMAP to desired page

    read the memory

    restore FMAP

    restore interripts

    I use something like this( compiled with sdcc ):

    void flash_read( __XDATA uint8_t *dst, uint32_t address, uint8_t size )
    {
        uint8_t fmapOld;
        uint8_t  *flash;
        _CRITICAL_{
            fmapOld = FMAP;
            FMAP = address>>15;
            flash = (__code uint8_t *)((address & 0xFFFF) | 0x8000);
            memcpy( dst, flash, size);
            D_STR("Flash read ");
            D_HEX16(address);
            D_NL();
            FMAP = fmapOld;
        }_END_CRITICAL_
    }