UART raw access Sample

Hi there,

I am trying to get the UART access sample going with my FASTRACK Supreme 20. I am using latest M2MStudio and USB card for additional Serial port access. I am connecting from M2MStudio to FASTRACK on USB serial connection and trying to open UART1 with “AT+WDU=1,UART1,115200”. M2MStudio Trace shows following lines:

ADL 1 uart_open(UART1,115200)
ADL 1 Uart_Open : ERROR UART is not opened

I am wondering why I can’t open UART1. I tried other scenarios like tracing M2MStudio on COM1 and trying to open the UART1 or UART3. Neither one worked. I am using the sample as it is.

Any help is appreciated.

Thanks,
Haiden

You have the source code - look at it to determine what could cause that particular Trace to be emitted…

Sure. I did. Nothing looks suspicious. Following is the code. My earlier post showed first and last trace statements from the following code snippet. All the settings look just fine. I am trying to open UART1, so the role is UART_ROLE_DCE. Speed is 115200. M2MStudio can use the UART1 just fine for debugging. So when I flip the COM port and make M2MStudio use UART3 based on USB and try to let my app open UART1, i get the error.

I am working with only one app (UART_access) and trying to open UART1 for the first time. Bad part is, error code on Open fail is not descriptive other than fail/success. Is it possible that UART1 is already opened by something in the OS or Firmware? If yes, how can I disable it from using UART1?

TRACE (( 1, "uart_open(UART%c,%d)",identity[4], speed ));
   /* Device */
   Settings.capabilities = NULL;
   Settings.identity = identity;
   Settings.role = ( UART2 == identity[4] ) ? UART_ROLE_NM : UART_ROLE_DCE;
   /* 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 | speed );
   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" ));

      /* 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;

      if( uart_itf.io_control( handle, IOC_UART_FC, (void*) &Fc) )
      {
         uart_itf.close( handle );
         TRACE((1, "ERROR : IOCTL FC Set"));
         handle = 0;
      }
   }
   else
   {
      TRACE(( 1, "Uart_Open : ERROR UART is not opened" ));
   }

I’ve just tried it, and yes - that looks likely!

I don’t use the “Target Management” in M2MStudio (as it is officially acknowledged to be a steamy pile of the smelly stuff) - I’m sticking with the old Target Monitoring Tool (TMT) and Terminal Emulator (TE) instead.

Anyhow, I have TMT+TE connectcted to a Fastrack Supreme on UART1, and tried to open UART2 with this sample app:

much as you got?

So I tried “disabling” UART2 first:

and the TRACE said:

I guess this is what the ADL User Guide is referring to when it says:

But that’s about as clear as mud!

I presume that, “handled by the Wavecom firmware” is supposed to mean that it’s “opened” by AT+WMFM :question:
But that is not at all clear, and there is no proprer explanation nor specific mention of AT+WMFM :angry:

There is also no mention of this in the documention of AT+WMFM in the AT Commands manual :angry:

And the worst thing by far is that there is no explanation nor even any mention of this in the Sample! :angry: :angry:

That is great help. If this is true, How can I execute this command from my app before it tries to open the UART?

Note that you can never execute a custom AT command from your own Open-AT application!

viewtopic.php?f=36&t=3764&p=14592&hilit=execute+custom+at+command#p14592
viewtopic.php?f=3&t=3936&p=15472&hilit=execute+custom+at+command#p15445

But, if you mean, “how can I use this facility on the same UART from which I issue the command” - then, I guess, you would have to modify the sample so that it closes the UART (with AT+WMFM) before it attempts to open it with adl_OpenDevice()

viewtopic.php?f=21&t=4510&p=18187#p18187

Hi there,

I need help to solve a problem regarding the UART raw access.

I have a SiWi GL6100 with only one uart, specifically the UART1.

With this uart I program the module and the I switch the module to FCM mode to read data from UART1.

Now I want to use the UART in raw mode and this is what i do:
[] Enable FCM mode to enable to read ESC character from serial. If I detect this character switch to AT mode to update the firmware through UART1.
[
] After 10 second switch UART1 to AT Mode and then disable UART1 with this command:

sprintf(atCommand, "AT+WMFM=0,0,1,0");
adl_atCmdCreate( atCommand, UART_1, ( adl_atRspHandler_t )EvhConfUartx, NULL);

But when the firmware execute the command I give back an error:

+CME ERROR: 3

The same thing appears if I execute the command through terminal monitor, but this behaviour is explained in tha AT command manual:

. This make sense.

Where I make an error?

Thanks in advance!