UART2 not working

Hi,

I’m trying to use the UART2 of my Q2406B module.
I did activate the UART2 and checked it through AT interface:

at+wmfm?
+WMFM: 0,2,1,1
+WMFM: 0,2,2,1
+WMFM: 1,2,4,0
+WMFM: 1,2,4,1

I got UART2 connected to a device sending data at 4800bps.
First I followed jan’s topic instructions to set the speed up on the serial port:

adl_atCmdCreate( "AT+IPR=4800", ADL_AT_PORT_TYPE( ADL_AT_UART2, FALSE ), Res_IPR_Handler, "*", NULL );

In the handler i can see the response of the module is “OK”.

Now i subscribe to the fcm handler:

HandleUART2 = adl_fcmSubscribe( ADL_FCM_FLOW_V24_UART2, UART2fcmCtrlH, UART2fcmDataH );

And in the Control handler i receive the event which indicates that the flow was correctly opened. Then i switch to DATA Mode and the Control handler is called again with the event indicating that it went to DATA MODE.

However, the DATA handler is never called as if it didn’t receive anything.

Any hints please?

EDITED
I’ve spent the whole day trying things with UART2 and have observed something:
If I send data using:

adl_atSendResponse(ADL_AT_PORT_TYPE(ADL_AT_UART2,ADL_AT_RSP),buffer);

it works. However since I need to use raw data and try to send it with
adl_fcmSendData i experiment the following behavior:

When i call this function first i get the next message:
ADL_FCM_RET_OK_WAIT_RESUME
According to the documentation it means: Success, but the last credit was used.
Now i am supposed to wait for ADL_FCM_EVENT_RESUME in my control handler but it doesn’t arrive.
Of course the next times i try to send data the error code is as follows:

ADL_FCM_RET_ERR_WAIT_RESUME
which means that the flow’s got no more credit to use.

I don’t know how to sort this out, could please anybody help me?

Thanks,
Daniel

Hi Daniel,

I don’t know what’s going on, but I suspect that the flow is not in data mode. You get the event that it was switched, but I suspect that it was switched back to AT mode for some reason.

Are you using any AT commands sent to ADL_AT_UART2 from the internal application after you switched to data mode?

Can you enter AT commands on UART2 via a terminal emulator program - and do you get an answer?

Best Regards,
Jan

Hi Jan,

I’m still debugging it and I can see that my control handler isn’t called after receiving the event which indicates me that it went into DATA mode. So it doesn’t seem to receive the event indicating a switch back into AT mode.

But anyway I tried to send an at command to the UART2:

adl_atCmdCreate( "AT", ADL_AT_PORT_TYPE( ADL_AT_UART2, FALSE ), Res_AT_Handler, "*", NULL );

every second and I’ve got the Ok answer.
How can this be possible? Can the module switch back to AT mode without generating the proper event?

Damn, I’m getting mad :slight_smile:

Thank you very much jan for the answer, very accurate as usual
Now it seems I need to avoid that uncontrolled switch somehow.

Best regards,
Daniel

Hi Daniel,

That is exactly what I experienced: The module seems to switch back to AT as soon as you send an AT command using the PORT_TYPE macro for the port which has a flow in data mode…

Best Regards,
Jan

Hello guys,

You can always send commands internally via adl_atCmdCreate.
You do not need to be in AT-command mode. The switching between AT- and Data mode is only for the external UART.

/Snoooze

hi again,

Well my steps are as follows:

I send the AT+IPR command to set up the speed on UART2 (from the embbeded application).
I subscribe to the FCM flow on UART2.
I get the FLOW OPENED event on my control handler and then i switch to DATA mode.
I get the event confirmming me that I’m in DATA mode.
Now i get my debugging print on UART1 which indicates me that just in this moment the IPR response handler is called.

At this moment it’s not quite easy to send data into UART2 because of electrical levels but I will make an adapter if necesary. According to your answer, Jan I figure out that if i send any AT commands from the embbeded app it will switch modes and if I do from an external device It might not change, is that correct?

Thanks again

Daniel

Hi,

please try to switch the mode in the IPR handler function. I think it will work then…

And yes, I think only the internal application will cause that mode switch.

Best Regards,
Jan

Hi guys,

damn… i removed the at+ipr command and now it works !
I didn’t figure out the switch back to AT mode without generating the event. Is that a bug?

Thank you very much, really.

Hi again,

Looks like one to me now, because if

then the mode shouldn’t be affected by adl_atCmdCreate’d commands…

Best Regards,
Jan

Hi Daniel,
You can try the following steps to check if the procedure works:

  1. First of all, configure the UART2, by sending AT+IPR command. After receiving the response of this command (“OK”), you should subscribe for FCM flow for UART2.
  2. Now, you should switch the UART2 to data mode.

I feel that the problem is occuring because UART2 is switched to different baud rate after you switch the UART2 to data mode.

Best Regards.

Hi,
I’m also trying to work with UART2. I have Q2400A module with 3.01 OpenAT virsion and a small circuit with MAX3232 to connect modem to another board. I’ve tried all tips that i’ve found at this board, but the UART is not working.

I’ve compared RTS signals on UART1 and UART2 when start\stop connection in HyperTerminal and have found next thing. The voltage at RTS pin of UART1 is 0 or 5, but at UART2 it is always 0,3V. It seems to me that this pin is at input mode constantly.

The second experiment. I’ve wrote a program that switches UART2 RTS pin (35) from 0 to high voltage. (adl_ioWrite). This program works fine.
It works fine even when i open UART2. I thought that when UART2 is opened, GPIO doesn’t work.

Could anyone tell me is this feature (UART2) works in Q2400A with OpenAT v3.01?

Hello dead_arhip,

Are you sure that the uart2 is activated with AT+WMFM command?
If i remember well, you should get an error using pin functions on Uart2 RTS even when you don’t use flow control.

Regards,

tom

Tomalex, thanks for reply.

I did my experiments with opened UART2 and even with closed :smiley:. No result.
I’ve leave UART2 for better times.
I just want to know does it work in principal or it’s a problem with my device.

I think that you shouldn’t be able to manage IO pins multiplexed with UART2 if it’s enabled. I’ve just tried it out on OpenAT v3.02 and it doesn’t.

I have a CME ERROR: 3 when trying to write onto RTS2 and UART2 enabled.

have you tried your program even when configured with Flow Control on UART2?

Regards
Daniel

I have just tried an AT+WIOW=0,0 on a Q2406B , ie, write a ‘0’ on GPIO0 (multiplexed with RTS2) and it just works when UART2 is disabled (no matter whether I use Local Flow or not).

Cheers

Daniel

Daniel, thank you for reply.

I think so too. But I do can manage GPIO5(RTS2) without any error when UART2 is opened (AT+WMFM=0,1,1).
I suppose that the problem is a software one (OpenAT v3.01).
I should possibly upgrade soft to version 3.02 and try again.

Best Regards.
Alex

I am trying to get teh UART 2 into command mode and using AT commands to do it, any help on how, curently I jsut use AT+WMFM=0,1,2 and not sure how to set the +IPR for UART 2, is this possible to get the command mode with UART 2 any help

Samuel