Hi,
I am trying to receive some data using the serial port ; Data that along with GPS data is then send by GPRS to my server(GPS postion is sent even if no data received by serial port). The problem i am facing is that when i run my application in DEBUG (during development) no problems appear, everything is working as expected; data is received on serial port, i process it and send it via GPRS.
When I write my application to the device, if any data is received on serial port the application resets. If no data is received the application no longer send anything by GPRS (even if in DEBUG mode it is sending)
See bellow how do i handle the FCM flow:
s8 fcmHandle;
ascii* inputDataBuffer;
ascii* inputData;
bool dataAvailable = FALSE;
bool FcmDataHandler (u16 DataLen, u8 * receivedData){
ascii *tempbuff;
if (inputDataBuffer != NULL){
tempbuff = adl_memGet(DataLen + wm_strlen(inputDataBuffer));
} else {
tempbuff = adl_memGet(DataLen);
}
*(receivedData + DataLen)=0;
if (inputDataBuffer != NULL){
wm_strcpy(tempbuff, inputDataBuffer);
wm_strcat(tempbuff, receivedData);
} else {
wm_strcpy(tempbuff, receivedData);
}
if (inputDataBuffer != NULL) {
adl_memRelease(inputDataBuffer);
}
inputDataBuffer = tempbuff;
// finished received data when \n or \r is received
if (strstr(inputDataBuffer,"\n")!= NULL || strstr(inputDataBuffer,"\r")!= NULL) {
if (inputData != NULL) {
adl_memRelease(inputData);
}
inputData = adl_memGet(wm_strlen(inputDataBuffer));
wm_strcpy(inputData,inputDataBuffer);
*(inputDataBuffer)=0;
if (inputDataBuffer != NULL) {
adl_memRelease(inputDataBuffer);
}
dataAvailable = TRUE;
}
return TRUE;
}
ascii* serialReader_getData(void)
{
dataAvailable = FALSE;
return inputData;
}
bool serialReader_dataIsAvailable(void){
return dataAvailable;
}
bool FcmCtrlHandler (adl_fcmEvent_e Event){
switch (Event){
case ADL_FCM_EVENT_FLOW_OPENNED:{
// switching to data mode
adl_fcmSwitchV24State(fcmHandle, ADL_FCM_V24_STATE_DATA);
break;
}
case ADL_FCM_EVENT_V24_AT_MODE_EXT: {
adl_fcmSwitchV24State(fcmHandle, ADL_FCM_V24_STATE_AT);
adl_fcmUnsubscribe(fcmHandle);
// back in AT mode when +++ is received
break;
}
break;
}
return TRUE;
}
void serialReader_init(void){
fcmHandle = adl_fcmSubscribe(ADL_FCM_FLOW_V24_UART1, FcmCtrlHandler, FcmDataHandler);
dataAvailable = FALSE;
}
Am I missing something regarding the way FCM is working. Why in DEBUG mode everything is ok and on the device nothing is working?
Thanks