RTS/CTS - Anyone?


#1

Hey everyone

I posted earlier this one on controlling the RTS/CTS for UART 2: http://www.wavecom.com/modules/movie/scenes/forums/viewtopic.php?f=5&t=3835

I would appreciate some guidelines… if possible.

Has anyone tried with the open UART interface?

Regards
palsson


#2

Hii

try by using the structure “eUartSs_t” … It has the thing which you want… also, just to inform you, there is a bug… to toggle CTS signals use “UART_SIG_RTS” instead of “UART_SIG_CTS” …

hope it helps… . :smiley:
cheers


#3

Hi there

Thanks for your reply…

I’ve tested so far on the uart open sample, check this piece of code below from the sample.
I’ll be working on this issue next upcoming days… but if you’ve tried it yourself, maybe you can point it out how to :slight_smile:

Thanks in advance…

s32 uart_open( char* identity, u32 speed )
{
	ascii buf[32];
	s32             handle;
	sUartSettings_t Settings;
	psGItfCont_t    pinterface;
	sUartEvent_t    events;
	sUartLc_t       lc;
	sUartFlowCtrl_t Fc;

   sUartSsIoc_t ioCtrl;

   /* Device */
   Settings.capabilities = NULL;
   Settings.identity = identity;
   Settings.role = UART_ROLE_NM;

   /* Events */
   events.user_data = (void*)0;
   events.valid_cb = UART_CB_ON_ALL;
   memcpy((u8*)events.cb_list, (u8*)uartCbTab, 6*sizeof(sGCbDesc_t));
   Settings.event_handlers = &events;

   /* To retrieve the UART SP Interface */
   Settings.interface = &pinterface;

   /* Line Coding */
   lc.valid_fields = UART_LC_ALL;
   lc.rate         = (eUartRate_t)(UART_RATE_USER_DEF | 115200 );
   lc.stop         = UART_STOP_BIT_1;
   lc.parity       = UART_PARITY_NONE;
   lc.data         = UART_DATALENGTH_8;

   Settings.line_coding = &lc;

   /*------------------*/
   /* open UART device */
   /*------------------*/
   if( 0 < (handle = adl_OpenDevice( DF_UART_CLID, &Settings)) )
   {
      TRACE(( 1, "UART successfully opened" ));
      adl_atSendResponse(ADL_AT_RSP, (char*)"UART successfully opened\n\r" );

      /* Locally store the uart interface */
      uart_itf = *pinterface;

      /* Flow control IO control setting */
      Fc.op   = G_IOC_OP_SET;
      Fc.type = UART_FC_RTS_CTS;//UART_FC_NONE;



      if( uart_itf.io_control( handle, IOC_UART_FC, (void*) &Fc) )
      {
         uart_itf.close( handle );
         TRACE((1, "ERROR : IOCTL FC Set"));
         adl_atSendResponse(ADL_AT_RSP, (char*)"ERROR : IOCTL FC Set\n\r" );
         handle = 0;
      }

      ioCtrl.op = G_IOC_OP_SET;
      ioCtrl.sig_id = UART_SIG_CTS;
      ioCtrl.state = 0;
      if( uart_itf.io_control( handle, IOC_UART_SS, (void*) &ioCtrl) )
      {
         adl_atSendResponse(ADL_AT_RSP, (char*)"ERROR : IOCTL Set CTS\n\r" );
         handle = 0;
      }

//      ioCtrl.op = G_IOC_OP_SET;
//      ioCtrl.sig_id = UART_SIG_RTS;
//      ioCtrl.state = UART_SIG_RTS;
//      if( uart_itf.io_control( handle, IOC_UART_SS, (void*) &ioCtrl) )
//      {
//         adl_atSendResponse(ADL_AT_RSP, (char*)"ERROR : IOCTL Set RTS\n\r" );
//         handle = 0;
//      }
   }
   else
   {
	   sprintf(buf,"Error: %i\n\r",handle);
	   adl_atSendResponse(ADL_AT_RSP, (char*)buf );
	   adl_atSendResponse(ADL_AT_RSP, (char*)"Uart_Open : ERROR UART is not opened\n\r" );
      TRACE(( 1, "Uart_Open : ERROR UART is not opened" ));
   }
   return handle;
}

#4

I’ve got it working now…

Wanted to let you know. Thanks for helping…

Regards
palsson


#5

Glad i was of some help… . :blush:


#6

Hi,

I too am trying to set and clear the CTS output of a Fastrack Supreme. I wish to use the CTS of UART1 to control the !(Receiver Output Enable) and (Driver Output Enable) of a RS-485 transceiver. However any program I run using the open UART interface it crashes.

I am using a slightly modified portion of the Wavecom Sample - UART raw access code. The unmodified UART raw access program also crashes on my Fastrack.

Does anyone have any advice on this matter?

Thanks,
David


#7

The sample is working fine as far as i know… i tested it just 2-3 days ago… n there was certainly no crash… . check if the sample you have downloaded and the SDK you have installed on ur modem are the same or not …?? they might be incompatible…
what is the RTK exception you are getting btw… ??