# Accesing flash memory

**URL:** <https://forum.sierrawireless.com/t/accesing-flash-memory/1505>\
**Category:** Open AT\
**Created:** [August 8, 2007, 10:34am UTC](https://forum.sierrawireless.com/t/accesing-flash-memory/1505 "2007-08-08T10:34:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Titan](https://avatars.discourse-cdn.com/v4/letter/t/7ba0ec/32.png) [@Titan](https://forum.sierrawireless.com/u/Titan)\
**Post date:** [August 8, 2007, 10:34am UTC](https://forum.sierrawireless.com/t/accesing-flash-memory/1505/1 "2007-08-08T10:34:50Z")

</div>

Hello all.

I’m trying to save some data into the flash memory of a wismo gprs modem, but i’m having some trouble. When I do “adl\_flhExist(APNHandle, T2R\_MYAPN\_ID)” I get -23 as an answer (which I think it’s a “WM\_BUS\_NO\_MORE\_HANDLE\_FREE” error).  
If I delete this line and try to subscribe the handler using "adl\_flhSubscribe (APNHandle, 1) " I get a -4 (“ADL\_RET\_ERR\_ALREADY\_SUBSCRIBED” I think). Can someone lend me a hand with this? I’m writing parts of the code just below.

#define T2R\_MYAPN\_ID 1  
ascii MyAPN[50];  
ascii APNHandle[4] = “APN\0”; //I already tried with ascii \*APNHandle = “APN”  
void Cmdt2rusr\_Handler ( adl\_atCmdPreParser\_t \*param );

void adl\_main (adl\_InitType\_e InitType){

s32 length;

if (!adl\_flhExist(APNHandle, T2R\_MYAPN\_ID)) //Here i get the -23  
adl\_flhSubscribe (APNHandle, 1); //Here the -4 if i comment the “if” above

if ((length = adl\_flhExist (APNHandle, T2R\_MYAPN\_ID)) \> 0)  
//length is -23 again  
adl\_flhRead ( APNHandle, T2R\_MYAPN\_ID, length, MyAPN );

adl\_atCmdSubscribe (“AT+T2RUSR”, Cmdt2rusr\_Handler,  
ADL\_CMD\_TYPE\_PARA | ADL\_CMD\_TYPE\_TEST);  
}

void Cmdt2rusr\_Handler (adl\_atCmdPreParser\_t \*param){

u16 length = 0;  
ascii localAPN[50];  
ascii \*cmdStr;

if (param-\>Type == ADL\_CMD\_TYPE\_PARA){  
cmdStr = param-\>StrData;  
wm\_strGetParameterString ( localAPN, cmdStr, 1 );  
strcpy ( MyAPN, localAPN );  
if ((length = adl\_flhExist (APNHandle, T2R\_MYAPN\_ID)) \> 0){  
//Here length is 65513 :S  
adl\_flhWrite (APNHandle, T2R\_MYAPN\_ID, length, localAPN);  
//adl\_flhWrite returns another -23…  
}  
}  
}

Thanks in advance for your help 🙂
