Search code examples
embeddedbluetooth-lowenergyiar

Read XDATA value to app in CC2541


I want to read the MAC address for the Bluetooth LE chip CC2541. This is stored in memory location 0x780C. I went through the

osal_snv_read

function but I don't know what osalSnvId_t id is. A brief explanation about how this workds would be really helpful.


Solution

  • Apparently the location where MAC address is stored cannot be read using osal_snv_read. So either I have to use

    GAPRole_GetParameter(GAPROLE_BD_ADDR, ownAddress);
    

    after

    GAPROLE_STARTED
    

    or I have to use

    __xdata __no_init uint8 mac_id[6] @ 0x780C;
    

    __xdata to say it is reading from XDATA memory and __no_init to tell the compiler not to initialize this variable. Also, this had to be kept outside any function to prevent it from declaring as auto variable.

    Credits: http://e2e.ti.com/support/low_power_rf/f/538/t/273968.aspx