How to program

Hello

This is the first time I program something with the Fastrack supreme.
I have to program a “M2M” system. I get information like the temp. over a serial connection and I have to send these information to a server over GSM/GPRS.
So I have to program the receiving of the information and the transmitting to the Server. Is that possible to handle?

Can someone help me how to program the Fastrack supreme and where can I get some sample applications?

Thanks for the help.

Yes what you want to do is possible :smiley: For GPRS sample please look through C:\OpenAT\Plug-ins\WIP<ver>\WIP\Samples. For collecting data from the serial port, please look over the FCM service in the ADL User Guide. ADL samples can be found in C:\OpenAT\OS<ver>\ADL\samples

Thank you for your information.

But I cant find a sample how to read data from the serial port. For sending data I found this samples about the UDP or TCP Client/Server.
It would be ice if you could give me some more information about reading data from the serail port.

Hi Dollitz,
I write here below is the simple sample for reading and sending data through serial port. It is just a exp, you can make family with these APIs via ADL User Guide (with more detail and sample)

#include "adl_global.h"


/***************************************************************************/
/*  Mandatory variables                                                    */
/*-------------------------------------------------------------------------*/
/*  wm_apmCustomStack                                                      */
/*  wm_apmCustomStackSize                                                  */
/*-------------------------------------------------------------------------*/
/***************************************************************************/
u32 wm_apmCustomStack [ 256 ];
const u16 wm_apmCustomStackSize = sizeof ( wm_apmCustomStack );


/***************************************************************************/
/*  Local variables                                                        */
/***************************************************************************/

#define FCM_BUFFER_SIZE ( 2 * 1024 )

/* Variables */
s8 fcm_V24Handle;
u32 fcm_DataLength;
u8 fcm_DataBuffer [ FCM_BUFFER_SIZE ];

/***************************************************************************/
/*  Local functions                                                        */
/***************************************************************************/


// V24 Ctrl handler
bool fcm_V24CtrlHandler ( u8 Event )
{
    TRACE (( 1, "V24 event %d", Event ));
    
    // Switch on event
    switch ( Event )
    {
        case ADL_FCM_EVENT_FLOW_OPENNED :
            // Switch to data mode
			adl_atSendResponse(ADL_AT_RSP,"\r\nFlow Open\r\n");

            adl_fcmSwitchV24State ( fcm_V24Handle, ADL_FCM_V24_STATE_DATA );
        break;

		case ADL_FCM_EVENT_FLOW_CLOSED:
			adl_atSendResponse(ADL_AT_RSP,"\r\nFlow event CLOSED\r\n");
		break;
        
        case ADL_FCM_EVENT_V24_DATA_MODE :
			adl_atSendResponse(ADL_AT_RSP,"\r\nFlow event Data mode\r\n");
		break;

        
        case ADL_FCM_EVENT_RESUME:
			adl_atSendResponse(ADL_AT_RSP,"\r\nFlow event resume\r\n");
        break;
        
        case ADL_FCM_EVENT_V24_AT_MODE :
			adl_atSendResponse(ADL_AT_RSP,"\r\nFlow event AT mode\r\n");

			// Unsubscribe from V24 flow
		    adl_fcmUnsubscribe ( fcm_V24Handle );
			adl_atSendResponse(ADL_AT_RSP,"\r\nUnsubscribe FCM\r\n");
        break;
    }
    
    // Never allow external switch
    return FALSE;
}

// V24 Data handler
bool fcm_V24DataHandler ( u16 DataLength, u8 * Data )
{
	bool bEnd = FALSE;
	u16 i;

    TRACE (( 1, "V24 data (size %d)", DataLength ));

    for ( i = 0 ; i < DataLength ; i++ )
    {
		if ( Data [ i ] == '\x1a' )
        {
			bEnd = TRUE;
            break;
        }
    }

    wm_memcpy ( fcm_DataBuffer, Data, DataLength );
	adl_atSendResponse(ADL_AT_RSP,fcm_DataBuffer);

	if (bEnd)
	{
		fcm_DataLength = 0; // reset fcm_DataLength
		// Change to AT MODE
        adl_fcmSwitchV24State ( fcm_V24Handle, ADL_FCM_V24_STATE_AT );

	}
    
    // Release all credits
    return TRUE;
}



/***************************************************************************/
/*  Function   : adl_main                                                  */
/*-------------------------------------------------------------------------*/
/*  Object     : Customer application initialisation                       */
/*                                                                         */
/*-------------------------------------------------------------------------*/
/*  Variable Name     |IN |OUT|GLB|  Utilisation                           */
/*--------------------+---+---+---+----------------------------------------*/
/*  InitType          |   |   |   |  Application start mode reason         */
/*--------------------+---+---+---+----------------------------------------*/
/***************************************************************************/
void adl_main ( adl_InitType_e InitType )
{
    TRACE (( 1, "Embedded Application : Main" ));
    
    adl_atSendResponse(ADL_AT_RSP,"\r\nStart Application\r\n");
    // Subscribe FCM UART1
    fcm_V24Handle = adl_fcmSubscribe ( ADL_FCM_FLOW_V24_UART1, fcm_V24CtrlHandler, fcm_V24DataHandler );
}

Hope can help you,
ttt

Thank you, that helped me a lot to understand it better.

When I put “i=5” in the part of the

fcm_V24DataHandler

and build a new Make file, the compiler says me, that there is this error now:

hello_world.c warning: passing arg 2 of `adl_fcmSubscribe’ from incompatible pointer type

Can someone sa me, what this error means or how to eliminate?

Thanks for help!

Hi Dollitz,
Why do you put the “i=5” into the fcm_V24DataHandler? It is a variable for detecting character ‘\x1a’ for end of Data mode. This variable will be changed from 0 to the DataLength, so when you put it =5, it off-course error.
ttt

Sorry, that was my fault.

When i add to the fcm_V24DataHandler something like this:

bool fcm_V24DataHandler ( u16 DataLength, u8 * Data )
{
   bool bEnd = FALSE;
   u16 i;
   [b]u16 variable;[/b]
   
....

I receive the same error. Maybe I make a mistake to build the RTE. I do exactly the same, whats written in the TU_Tutorial_for_open_AT.pdf to build it.

I only wanna work with this incomming data and write them into a nother array, how can i do this?

Thx

Look at the error carefully, and think about what it says:

“arg 2” is short for “argument 2” - so, count the arguments in the call to ‘adl_fcmSubscribe’, and see which is number two;

You know that ‘C’ has the concept of types - yes?

Do you know what “incompatible” means?

Look in the ADL User Guide to see what type adl_fcmSubscribe requires for its second parameter;
Look at the type of the parameter you’ve actually provided - are they compatible?

are we nearly there yet…?

Of course, everything, what you said is right.

The programm is working fine at the beginning, i build it and send it to my Fastrack Supreme.
I send some String to the device and I can see the answer and everything.

But now my problem starts,after i put in this spezial String and my application stops, I add only u16 variable, into the project like this:

bool fcm_V24DataHandler ( u16 DataLength, u8 * Data )
{
   bool bEnd = FALSE;
   u16 i;
   u16 variable;

    TRACE (( 1, "V24 data (size %d)", DataLength ));

    for ( i = 0 ; i < DataLength ; i++ )
     ......

It changes nothing only creating a new variable. When i go than to Re build all i get the Problem.

But if i earase this variable after this try and try to re build everything, still the same problem.
Why is it working in the beginning and not after this try?

I am near to throw all of this out of my windows.

Hi Dollitz,
This appl I had written for Q24, that mean base on OpenAT OS 3… and it compile ok when you add a varible. But when you use it for Q26, that mean base on OpenAT OS 4…, it will compile error. You should read the ADL-User guide and build a new appl base on OS 4…
Hope have you,
ttt

Thank you!

All this helped me a lot!

I found my mistake and now i can read in the incomming data and work with them!

Has someone a sample project how to sent data to a PC over TCP or UDP port with the fastrack supreme 10?

Would be very nice!

hi dollitz,

how did you able to read and work with the incoming data from the serial port? i was hoping if you would be able to send me a sample code that you have with regards to reading and sending data in the serial port?
if you could not send me a sample code (for proprietary reasons…), hopefully you could describe the step by step process and the adl functions that you used…thanks…

Hi

If its possibe to publish the code tht would be great…

regds
KR

Read the section in the ADL User Guide about FCM - the Flow Control Manager

Also read the Application Note, “Using FCM flow in an Open AT® Application”
wavecom.com/modules/movie/sc … developers

Hi,

I worked with Fastrack Supreme 10 and 20, but always using AT commands wipsoft. I want to make it work Stand-Alone (without PC), but I don’t know which programm I should use, you are experienced so what you suggest me? I don’t see the difference and which is better between M2M Studio and Open AT SDK? I can programm C/C++ and read some examples on the forum.

My Fastrack Supreme need some cables or a programmer to change to my own Open At software? O it can be done with the serial cable? Or what do I need?

Thanks,

M2MStudio is the current SDK!

Sorry… I downloaded M2M Studio and installed, and finally downloaded OpenATSoftwareSuite from Download page for Fastrack Supreme, and you are rigth, is the same.