Trouble with uart2 rate selection


Hi everyone,

I’m in big trouble with the rate selection of the UART2 from the code…
I have read the post about but it still not work…

sReturn = adl_atCmdCreate("AT+WMFM=0,0,2", FALSE, uart_WMFMRspHandler_Stop,"*",NULL);
	Log(LOG_LEVEL_WARNING,"uart_Configure : adl_atCmdCreate : AT+WMFM=0,0,2 : %d", sReturn);

 /* I have sometimes +CMR ERROR : 3 (Operation not allowed. This error is returned when a
wrong parameter is detected.)

The problem is that I don't see what'sn wrong.... */

I wait the OK before doing the code here after :

	// Execute the command AT+IPR=9600 to set the baud rate to 9600 baud/s
	sReturn = adl_atCmdCreate("AT+IPR=9600", ADL_AT_PORT_TYPE( ADL_AT_UART2, FALSE ), uart_IPRRspHandler_Set,"*",NULL);
	Log(LOG_LEVEL_WARNING,"uart_WMFMRspHandler_Stop : adl_atCmdCreate : AT+IPR=9600 : %d", sReturn);

	sReturn = adl_atCmdCreate("AT+ICF=3,4", ADL_AT_PORT_TYPE( ADL_AT_UART2, FALSE ), uart_ICFRspHandler,"*",NULL);
	Log(LOG_LEVEL_WARNING,"uart_IPRRspHandler_Set : adl_atCmdCreate : AT+ICF=3,4 : %d", sReturn);

	// Save the current configuration in flash
	sReturn = adl_atCmdCreate("AT&W", ADL_AT_PORT_TYPE( ADL_AT_UART2, FALSE ), uart_ATWRspHandler,"*",NULL);
	Log(LOG_LEVEL_WARNING,"uart_ICFRspHandler : adl_atCmdCreate : AT&W : %d", sReturn);

	// Execute the command AT+WMFM=1 to enable uart 2
	sReturn = adl_atCmdCreate("AT+WMFM=0,1,2", FALSE, uart_WMFMRspHandler_Start,"*",NULL);
	Log(LOG_LEVEL_WARNING,"uart_ICFRspHandler : adl_atCmdCreate : AT+WMFM=0,1,2 : %d", sReturn);

Sometimes it works sometimes not…
I’m using OpenAT 4 with a Q2686H.





Hello gdt,

I could imagine that you get the error when the port is not open when the command is sent… That would explain why sometimes it does work: It works when the port is really open - it won’t work when the port is already or still closed… So my best guess is that you can safely ignore the error (if the following statements work fine…) - because all you wanted to do is to close the port, and that goal is achieved :wink: since the port was already closed - but if you would like to be absolutely sure you could as a very first step inquire the state of the port. Then you know if it is closed and you will only send the close command if the port is open… Then you should not get an error, or something else is really wrong…

Best Regards,


Hi jan,

Thanks for your quick response. When I ignore the CME ERROR and make the other commands, the speed of the uart2 is not modified. If I make an AT+IPR? after the AT+WMFM=0,1,2 , I get an +IPR:115200.

I have also noticed that the handlers of the other commands after AT+IPR are not called.

I have tried many things but without success…

If I do thoses commands manually, that works. really strange.


Best regards,



Hi gdt,

I don’t know why this is but you did remember to store the new setting with AT&W?

Best Regards,


I have done that…

I still have no time to debug this before my holidays, release must go out. I do that manually at the moment. It will look after that in two weeks.

Thanks Jan for your reply

Best regards,



Hi everyone,

I finally implement uart2 autoconfiguration on my Q2686H ().
It works for my with the tomalex way :wink:

Best regards,