More errors when using Q24PL UART2


#1

Hello

I’ve finished my embedded software, and it works fine in 2 of 20 Q24PL that i have with me, I’ve been trying to understand what is going on, so i found an error on fcm_Subscribe from UART2, it is returning ADL_RET_ERR_BAD_STATE.
The code is this:

void ConfigSerial2(void)
{
     //Set BaudRate
     adl_atCmdCreate("AT+IPR=4800\r", ADL_AT_PORT_TYPE(ADL_PORT_UART2, TRUE), UART2HandlerIPR, "*", NULL ); 
}
//---------------------------------------------------------------------------
//Config UART2
bool UART2HandlerIPR(adl_atResponse_t *_paras)
{
    if(!strcmp(_paras->StrData, "\x0D\x0AOK\x0D\x0A"))
    {
       //Send AT+ICF for UART2
       adl_atCmdCreate("AT+ICF=3,4\r", ADL_AT_PORT_TYPE(ADL_PORT_UART2, TRUE), UART2HandlerICF, "*", NULL );
    }
}
//--------------------------------------------------------------------------
//UART2 ICF Handler
bool UART2HandlerICF(adl_atResponse_t *_paras)
{
    if(!strcmp(_paras->StrData, "\x0D\x0AOK\x0D\x0A"))
    {
	//Open UART2
	UART2Open();
    }
}
//--------------------------------------------------------------------------
void UART2Open(void)
{
	s8 bUARTok = -1;

	//Open UART2
	bUARTok = adl_atCmdCreate("AT+WMFM=0,1,2",FALSE,UART2Handler,"*",NULL);
	bUART2Handler = -1;

	if(!bUARTok)
	{
		bUART2Handler = adl_fcmSubscribe(ADL_FCM_FLOW_V24_UART2,UART2CtrlHandler,UART2DataHandler);		
		if(bUART2Handler < 0)
		{
			//ErroR
		}
	}
}
//--------------------------------------------------------------------------
//UART2 Control Handler
bool UART2CtrlHandler(adl_fcmEvent_e _event)
{
	//adl_atSendResponse ( ADL_AT_UNS, "\n\r UART2 CTLR HDLR \n\r");
	switch(_event)
	{
	case ADL_FCM_EVENT_FLOW_OPENNED:
		adl_atSendResponse ( ADL_AT_UNS, "\n\r FLOW OPENED \n\r");
		adl_fcmSwitchV24State(bUART2Handler,ADL_FCM_V24_STATE_DATA);
		break;
	case ADL_FCM_EVENT_FLOW_CLOSED:
		break;
	case ADL_FCM_EVENT_V24_DATA_MODE:
		adl_atSendResponse ( ADL_AT_UNS, "\n\r DATA OPENED \n\r");
		break;
	case ADL_FCM_EVENT_V24_DATA_MODE_EXT:
		break;
	case ADL_FCM_EVENT_V24_AT_MODE:
		break;
	case ADL_FCM_EVENT_V24_AT_MODE_EXT:
		break;
	case ADL_FCM_EVENT_RESUME:
		break;
	case ADL_FCM_EVENT_MEM_RELEASE:
		break;
	default:
		break;
	}
}

And it’s strange because it’s working on 2 of them, i noticed that in these two when i power them on i get the +WIND and +CREG messages and in the other 18 i don’t get nothing, only my messages.
Can anyone help??

Best Regards
Leohen


#2

Sounds like the 2 “working” units have had some necessary config change(s) made and saved - but the others haven’t.

You’re just going to have to go through all the config settings until you find the relevant one(s)…


#3

Try AT&V