Accesing flash memory

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,

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 :slight_smile: