Micro timer problem


#1

Hi all,
I am trying to control a GPS module embeded on a card with Q2686. I dont exactly know on which GPIO the ON_OFF pin of GPS is fixed so I am trying a boot on any GPIO and expecting a flow from the GPS on UART2. But my real problem is that the GPS module documentation says:

which mean for me that to power ON the module I should do something like this:

void GPIOHandle( u8 ID, void * Context ){
   adl_ioWriteSingle ( MyGpioHandle1, &MyGpioConfig1, 0);
   adl_ioWriteSingle ( MyGpioHandle1, &MyGpioConfig1, 1);
   adl_ioWriteSingle ( MyGpioHandle1, &MyGpioConfig1, 0);
  
}
int initUART2(u8 mode, int speed, u8 format, u8 parity, u8 flow_control){

	  char comand[15];
	  /* Check if port available*/
	  if(adl_fcmIsAvailable(ADL_FCM_FLOW_V24_UART2))
	  {
		 /* Save UART operation mode: DATA o AT*/
		 mode_uart2=mode;

		 /* subscribe to FCM uart service */
		 handle_uart2=adl_fcmSubscribe(ADL_FCM_FLOW_V24_UART2, EvhCrtlUart2,EvhDataUart2);

		 /* config parity with AT Command*/
		 wm_sprintf(comand,"AT+ICF=%d,%d", format, parity);
		 adl_atCmdCreate(comand, UART_2, EvhConfUartx, NULL);

		 /* speed  with AT Command*/
		 wm_sprintf(comand,"AT+IPR=%d", speed);
		 adl_atCmdCreate(comand, UART_2, EvhConfUartx, NULL);

		 /* flow control  with AT Command*/
		 switch(flow_control){
		 /* hardware flow control */
		 case CTS_RTS:
			adl_atCmdCreate("AT+IFC=2,2",UART_2,EvhConfUartx,NULL);
			break;
			/* no hardware flow control */
		 case NO_CTS_RTS:
			adl_atCmdCreate("AT+IFC=0,0",UART_2,EvhConfUartx,NULL);
			break;
		 }
		 /* save configuration */
		 adl_atCmdCreate("AT&W", UART_2, (adl_atRspHandler_t)EvhConfUartx,NULL);




		 return 0;
	  }
	  return -1;

   }/*initUART2*/
void GPIO_INIT(void){
   adl_atSendResponse ( ADL_AT_UNS, "\r\nConfig GPIO\r\n" );
   MyGpioHandle1 = adl_ioSubscribe ( 1, MyGpioConfig1, 0, 0, 0 );
   adl_tmrSubscribe ( FALSE, 1, ADL_TMR_TYPE_100MS, GPIOHandle );
   initUART2(DATAMODE, 9600 , DATA8_STOP1 , NONE_PARITY , NO_CTS_RTS);
}

Then I just start my app so:

void main_task ( void )
{
adl_atSendResponse ( ADL_AT_UNS, "\r\nApp Begin\r\n" );
	GPIO_INIT();
}

BUt I never received any data on UART2
I want to know How can I pule LOW-HIGH-LOW >62us on a GPIO while I know that the timers are of type 100MS or 18.5ms I mean is it not to high to use ms timers where asked us timers?
Nedd your help please


#2

What “GPS module” :question:

What “card” :question:

Do you not have any support or documentation for this “card”?

Surely that is an absolutely fundamental piece of information :question: :exclamation:

You really need to get that basic question nailed before you proceed with anything else!

I don’t think that is a valid expectation at all!


#3

Hi,
my GPS module is a FASTRAX IT300. It is embedded in a designed card which have no documentation. I know the Tx Gpio of the GPS is pined on one GPIO of the CPU. But which one I don’t know. I simply wasted time expecting time from my UART2 while it is on a GPIO that data is supposed to flow (but I gained on FCM management on UART2 :smiley: ) What I want to know now is Rx and Tx on GPIO. Can somebody tell me something about?


#4

Without documentation, you should consider the card essentially useless.
Throw it away!

Why are you trying to use it?

That would require you to bit-bang it - Open-AT is really not suited to that.

Again, I would recommend that you don’t waste any more time on this; get a properly documented and supported GPS unit - there are plenty available!


#5

Hi awneil,
You said:

Thanks for your help. But all managers never want to throw away what they spent for, that’s why I’m trying to manage existant first before new ones to come (It is a particular chapter for it is to come, be sure). but I did progress. while jumping some pins on my cards I am receiving data on my Uart2. This is my code:

#include "adl_global.h"
#include "generated.h"
#define UART_2 ADL_AT_PORT_TYPE(ADL_PORT_UART2,ADL_AT_RSP) /* refer to ADL User Guide pag 67, rspflag */
/* --- UART Config enums --- */
/* Data format */
enum UART_FORMAT{

   NO_USE,
   DATA8_STOP2,
   DATA8_STOP1_PARITY1,
   DATA8_STOP1,
   DATA7_STOP2,
   DATA7_STOP1_PARITY1,
   DATA7_STOP1

};

/* parity bit config */
enum UART_PARITY{

   ODD,
   EVEN,
   MARK,
   SPACE,
   NONE_PARITY

};

/* flow control */
enum UART_FLOW_CONTROL{

   CTS_RTS,
   NO_CTS_RTS

};

/* UART mode type */
enum UART_TYPE{

   DATAMODE,
   ATMODE

};
/*  can anybody help me with stack size???? */


s8 handle_uart2;                     /* UART1 handler */
u8 mode_uart2;                        /* UART1 mode type */
s32 GreenHandle;
s32 BlueHandle;
ascii result;
adl_ioDefs_t GreenLED [ 1 ] = { ADL_IO_GPIO | 20 | ADL_IO_DIR_OUT };
adl_ioDefs_t BlueLED [ 1 ] = { ADL_IO_GPIO | 22 | ADL_IO_DIR_OUT };
/*  functions prototypes */
int initUART2(u8 mode, int speed, u8 format, u8 parity, u8 flow_control);
static bool EvhCrtlUart2(adl_fcmEvent_e evnt);
static bool EvhDataUart2(u16 datalength, u8 *data);
static void EvhConfUartx(adl_atResponse_t *Rsp);
void GreenLEDHandle( u8 ID, void * Context );
void BlueLEDHandle( u8 ID, void * Context );
void GreenLEDHandle( u8 ID, void * Context ){
   static int toggle = 1;
   adl_ioDefs_t Gpio_to_write1 = ADL_IO_GPIO | 	20 ;
   adl_ioWriteSingle ( GreenHandle, &Gpio_to_write1, toggle);
   toggle = !toggle;
}
void BlueLEDHandle( u8 ID, void * Context ){
   static int toggle = 1;
   adl_ioDefs_t Gpio_to_write1 = ADL_IO_GPIO | 	22 ;
   adl_ioWriteSingle ( BlueHandle, &Gpio_to_write1, toggle);
   toggle = !toggle;
}
int initUART2(u8 mode, int speed, u8 format, u8 parity, u8 flow_control){

  char comand[15];
  /* Check if port available*/
  if(adl_fcmIsAvailable(ADL_FCM_FLOW_V24_UART2))
  {
	 /* Save UART operation mode: DATA o AT*/
	 mode_uart2=mode;

	 /* subscribe to FCM uart service */
	 handle_uart2=adl_fcmSubscribe(ADL_FCM_FLOW_V24_UART2, EvhCrtlUart2,EvhDataUart2);

	 /* config parity with AT Command*/
	 wm_sprintf(comand,"AT+ICF=%d,%d", format, parity);
	 adl_atCmdCreate(comand, UART_2, EvhConfUartx, NULL);

	 /* speed  with AT Command*/
	 wm_sprintf(comand,"AT+IPR=%d", speed);
	 adl_atCmdCreate(comand, UART_2, EvhConfUartx, NULL);

	 /* flow control  with AT Command*/
	 switch(flow_control){
	 /* hardware flow control */
	 case CTS_RTS:
		adl_atCmdCreate("AT+IFC=2,2",UART_2,EvhConfUartx,NULL);
		break;
		/* no hardware flow control */
	 case NO_CTS_RTS:
		adl_atCmdCreate("AT+IFC=0,0",UART_2,EvhConfUartx,NULL);
		break;
	 }
	 /* save configuration */
	 adl_atCmdCreate("AT&W", UART_2, (adl_atRspHandler_t)EvhConfUartx,NULL);




	 return 0;
  }
  return -1;

}/*initUART2*/

static bool EvhCrtlUart2(adl_fcmEvent_e evnt){
  switch (evnt)
   {
   /* when com is open, operation mode is defined */
   case ADL_FCM_EVENT_FLOW_OPENNED:
	  /*  DATA MODE */
	  if(mode_uart2 == DATAMODE){
		 adl_atSendResponse(ADL_AT_RSP, "\r\nUART2: Data Mode");
		 adl_fcmSwitchV24State(handle_uart2,ADL_FCM_V24_STATE_DATA);
	  }
	  /* AT MODE */
	  else if(mode_uart2 == ATMODE){
		 adl_atSendResponse(ADL_AT_RSP, "\r\nUART2: AT Mode");
		 adl_fcmSwitchV24State(handle_uart2,ADL_FCM_V24_STATE_AT);
	  }
	  break;

   case ADL_FCM_EVENT_V24_DATA_MODE:
	  /* DATA MODE OK */
	   adl_atSendResponse(ADL_AT_RSP, "\r\nUART2: Data Mode OK");
	  break;

   case ADL_FCM_EVENT_V24_AT_MODE:
	  /* AT MODE OK */
	   adl_atSendResponse(ADL_AT_RSP, "\r\nUART2: Returned to AT Mode");
	  break;

   case ADL_FCM_EVENT_RESUME:
	   adl_atSendResponse(ADL_AT_RSP, "\r\nUART2: Event resume");
	  break;

   case ADL_FCM_EVENT_MEM_RELEASE:
	   adl_atSendResponse(ADL_AT_RSP, "\r\nUART2: Memory Released");
	  break;

   default:
	  return FALSE;
	  break;
   }
   return TRUE;
}/*EvhCrtlUart2*/

static bool EvhDataUart2(u16 datalength, u8 *data){

  /* when data recived echo it */

	ascii NewText [ 20 ],txt[20];
	      u16 i;
	      result=*data;
	       for ( i = 0 ; i < datalength ; i++ )
	       {
	    	   GreenHandle = adl_ioSubscribe ( 1, GreenLED, 0, 0, 0 );
	    	   adl_tmrSubscribe ( TRUE, 5, ADL_TMR_TYPE_100MS, GreenLEDHandle );
	    	   if ( data [ i ] == '~' )
	           {
	            adl_fcmUnsubscribe(handle_uart2);
	           }else
	           {
				 txt[i]=data[i];
				 wm_sprintf ( NewText, "%d", txt[i] );

	         adl_atSendResponse(ADL_AT_UNS, NewText);//to send received data and display using uart1.

	         }
	      }
  //adl_atSendResponse(ADL_AT_RSP,data[0]);
  return TRUE;

}/*EvhDataUart2*/

static void EvhConfUartx(adl_atResponse_t *Rsp){

}/*EvhConfUartx*/
void main_task ( void )
{
// TODO Insert your task initialization code here
initUART2(DATAMODE, 9600 , DATA8_STOP1 , NONE_PARITY , NO_CTS_RTS);
}

And I am receiving some integer I don’t exactly understand. Here are some.

UART2: Data Mode
UART2: Data Mode OK1818022518214012915528064201680656080642016812819340160128152080646420806420806464208064208064642080642080646420806420806474218064208074662080821326537516512813120166131151489110118717217719723253
+WIND: 13

+CREG: 0

+CGREG: 0

UART2: Data Mode
UART2: Data Mode OK6920209169208080642080642080819020806421801042080806420806420808064208064208080642080642080806420806420808064208064202116012815528264518811869104532271925280832080806414817692366363232
+WIND: 13

+CREG: 0

+CGREG: 0

UART2: Data Mode
UART2: Data Mode OK18180971821341520806420806464201440160144112047160128152080642020806420806420208064208064202080642080642020806420806420211281520809064202081932120889165130352857242020872148252148121228246
+WIND: 13

+CREG: 0

+CGREG: 0

UART2: Data Mode
UART2: Data Mode OK1818097182140152080642080806420144016014411204516012815208064642080642080646420806420806464208064208064642080642080646421128152016806420208193212088916512821113318212064208021211218416862249132255
+WIND: 13

+WIND: 1

+CREG: 2

+WIND: 16

+CGREG: 0

+WIND: 15,3,"+04",4,"11/08/10,00:44:22+04",6,"0"

Can somebody help me in understanding this?
Is this my PVT data that I should decode? while receiving data from my data handler as ascii, I have some cryptograms characters. So I’ùm oblige to receive it as intergers.
I will apreciate your helps.

Thanks more


#6

If you have spent money on it, then it should have come with adequate documentation to allow you to use it!

What on earth are you (or your managers) doing messing about with undocumented stuff?!

Well, good luck with that - But be sure to fully account for the cost of your time in doing it!


#7

Does really nobody understands something about my codes or datablocks?
I receive them as ascii, so if there’s another data type, I will apreciate.


#8

The Datasheet for the GPS module will describe the data format(s) that it produces.