Safely enable and disable UART1 on Q2687

SL6087, SL808x, SL809x, SL9090, SL501x, Q2686, Q2687, Q2698, Q26 Elite

Safely enable and disable UART1 on Q2687

Postby pvouzis » Mon Aug 13, 2012 1:30 am

I need to use some GPIO pins that are multiplexed with UART1 on a Q2687. My understanding is that I first need to disable UART1 within my application, and then subscribe to the GPIOs. Before trying this I realized that disabling UART1 might be dangerous since there is no way to communicate with the module any more. And sure enough...

The way I do it is to use

adl_atCmdCreate ( "AT+WMFM=0,0,1", TRUE, ( adl_atRspHandler_t ) NULL, NULL );

to deactivate if, and then

adl_atCmdCreate ( "AT+WMFM=0,1,1", TRUE, ( adl_atRspHandler_t ) NULL, NULL );

to activate it. However, this doesn't work that well. The activation doesn't work, and I end up with a disabled UART1. Then I have to use DWLWin to flash the module and start over. It is annoying and it takes quite some time to do this.

So, does anybody have a recommendation about a safe process to enable and disable UART1?

Thanks1
pvouzis
 
Posts: 30
Joined: Tue Mar 25, 2008 3:58 pm
Has thanked: 9 times
Have thanks: 1 time

Re: Safely enable and disable UART1 on Q2687

Postby tomridl » Mon Aug 13, 2012 6:39 am

If you enable and connect through either UART 2 or the USB, then you can re-enable UART 1. Otherwise, you will have to write an Open AT application that enables UART 1 based on an event (e.g. GPIO dropping low etc).
SL6087, WMP100, XM0110
User avatar
tomridl
 
Posts: 347
Joined: Wed Feb 18, 2009 7:09 am
Location: Durban, South Africa
Has thanked: 9 times
Have thanks: 43 times

Re: Safely enable and disable UART1 on Q2687

Postby pvouzis » Tue Aug 14, 2012 2:02 am

I found my error and I am posting the solution here for future reference:

tomridl wrote:If you enable and connect through either UART 2 or the USB, then you can re-enable UART 1. Otherwise, you will have to write an Open AT application that enables UART 1 based on an event (e.g. GPIO dropping low etc).


I was using an input GPIO to call a function that would send the command:

adl_atCmdCreate ( "AT+WMFM=0,1,1", TRUE, ( adl_atRspHandler_t ) NULL, NULL );

but the UART wouldn't get activated back. Well, after RTFM I realized that by using that first "TRUE" in the command above the response would be sent to the UART that was already deactivated (since I had already sent adl_atCmdCreate ( "AT+WMFM=0,0,1", TRUE, ( adl_atRspHandler_t ) NULL, NULL ); )

So, when the UART is deactivated and it cannot receive the response the command is not executed. Thus, the UART doesn't get reactivated.

The solution: I used

adl_atCmdCreate ( "AT+WMFM=0,1,1", FALSE, ( adl_atRspHandler_t ) NULL, NULL );

which doesn't try to send the response to the UART at all. With this command the UART gets activated just fine.
pvouzis
 
Posts: 30
Joined: Tue Mar 25, 2008 3:58 pm
Has thanked: 9 times
Have thanks: 1 time

Re: Safely enable and disable UART1 on Q2687

Postby pvouzis » Tue Aug 14, 2012 5:27 am

So, now I am able to disable and enable the UART 1 on the Q2687 without problems. However, after disabling UART1 I try to do

adl_ioDefs_t GpioConfig = ADL_IO_DIR_OUT | ADL_IO_LEV_LOW | ADL_IO_GPIO | 42;
GpioHandle = adl_ioSubscribe(1, &GpioConfig, 0, 0, 0);

and I get the error ADL_IO_ERR_USED. I remind that GPIO42 on a Q2687 is multiplexed with RI of UART1.

So, I don't know why after disabling UART1 I am still not able to use GPIO42 as a GPIO. I suspect that the answer is hidden somewhere deep in the manual, but I haven't been able to find the location :p

Does anybody know how to use the GPIOs that are multiplexed with UART1?

Thanks!
pvouzis
 
Posts: 30
Joined: Tue Mar 25, 2008 3:58 pm
Has thanked: 9 times
Have thanks: 1 time

Re: Safely enable and disable UART1 on Q2687

Postby pvouzis » Tue Aug 14, 2012 10:33 am

The module needs a restart after the UART1 is disabled to free the GPIOs.
pvouzis
 
Posts: 30
Joined: Tue Mar 25, 2008 3:58 pm
Has thanked: 9 times
Have thanks: 1 time

Re: Safely enable and disable UART1 on Q2687

Postby tobias » Thu Oct 04, 2012 2:21 pm

The restart is needed with firmware R7.xx, but was not necessary with firmware 6.6x.
tobias
 
Posts: 435
Joined: Sun Dec 02, 2007 10:00 am
Has thanked: 3 times
Have thanks: 20 times


Topic Tags

Q2687, GPIO, UART

Return to Q/SL Series

Who is online

Users browsing this forum: No registered users and 1 guest