Safely enable and disable UART1 on Q2687


#1

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


#2

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).


#3

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

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.


#4

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 :stuck_out_tongue:

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

Thanks!


#5

The module needs a restart after the UART1 is disabled to free the GPIOs.


#6

The restart is needed with firmware R7.xx, but was not necessary with firmware 6.6x.