UART problems


#1

Hi, everybody

If I want to send an string from hyper terminal to Fastrack supreme via UART1. What things I have to do to get that string? I mean that if we have a handler or similar thing to get strings sent to UART1 (or UART2)? Please help me!

Thanks


#2

The first thing to remember is that the UART neither knows nor cares what caused the string to be sent - all that matters is that characters arrive at the UART’s input (with the control lines in the appropriate states).
Hyperterminal (or any other application) is irrelevant.

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


#3

Thanks you for replying me. I will try with FCM service.


#4

I read the FCM service and I knew that if i subscribe a port, when data reach at that port, FS will go to adl_fcmDataHdlr_f, is this right?

and I want to write a program which receives a string from Hyper Terminal This is my code

static bool DataTRACE_ctrl_handler(u8 event) {
bool bReturn = TRUE;
bool sReturn = FALSE;

TRACE ((1, "DATATRACE Control Event Handler : %d", event));

switch(event) {
    case ADL_FCM_EVENT_FLOW_OPENNED:    // 0
    	sReturn = adl_fcmSwitchV24State(DataTRACE_fcmHandle, ADL_FCM_V24_STATE_DATA);
		if (sReturn == OK) {
			TRACE ((1, "Successful switch to DATA mode and display NMEA traces"));
		} else {
			TRACE ((1, "ERROR switching to DATA mode and display NMEA traces: %d",sReturn));
		}
		break;

    case ADL_FCM_EVENT_FLOW_CLOSED:
        break;

    case ADL_FCM_EVENT_V24_DATA_MODE:   // 2
        break;

    case ADL_FCM_EVENT_V24_DATA_MODE_EXT:
    case ADL_FCM_EVENT_V24_AT_MODE:
    case ADL_FCM_EVENT_V24_AT_MODE_EXT:
        break;


    case ADL_FCM_EVENT_RESUME:          // 6
        break;

    case ADL_FCM_EVENT_MEM_RELEASE:     // 7
    case ADL_FCM_EVENT_V24_DATA_MODE_FROM_CALL:
    case ADL_FCM_EVENT_V24_AT_MODE_FROM_CALL:
    break;
}

return bReturn;

}

static bool DataTRACE_data_handler(u16 datalength, u8 *buffer) {
bool bReturn = TRUE;
s8 retVal;

TRACE ((1, "DataTRACE_data_handler, length: %d",datalength));
TRACE ((1,buffer));

retVal = adl_fcmSwitchV24State(DataTRACE_fcmHandle, ADL_FCM_V24_STATE_AT);
if (retVal == OK) {
	TRACE ((1, "Successful switch to AT mode and display NMEA traces"));
} else {
	TRACE ((1, "ERROR switching to AT mode and display NMEA traces: %d",retVal));
}

return bReturn;

}

when i ran it, i couldn’t use AT command.
I don’t know how to do it.

Pls help me!


#5

You have to subscribe it and then switch it to Data mode

Again, forget about Hyperterminal - it is an irrelevant detail!

You need to use the ‘Code’ button to make your code readable - not the font colour!

Read that section of the Manual again - the port can be in either AT Command mode or Data mode - but not both!