Sending AT-Commands failed

I tried to enable sys clock via the command “AT+WEXTCLK=1,1”
First i noticed that /dev/ttyAT is sometimes unreachable, so i need to wait a couple seconds and try again. When this finally works the real trouble begins. The code works like the test example in the repository.

  • cmd="AT+WEXTCLK=1,1"
  • le_atClient_TryConnectService()
  • if OK open /dev/ttyAT
  • devRef = le_atClient_Start(atFd);
  • cmdRef = le_atClient_Create();
  • le_atClient_SetCommandAndSend(&cmdRef, devRef, cmd, "", "OK|ERROR|+CME ERROR", 1000)

the last method always yield in the following error.

-WRN- | atClientDaemon[1257]/framework T=atCommandClient-10 | thread.c PThreadStartRoutine() 416 | Failed to set thread name for atCommandClient-10 (34).
=ERR= | atClientDaemon[1257]/atClient T=atCommandClient-10 | le_atClient.c TimerHandler() 802 | Timeout when sending AT+WEXTCLK=1,1, timeout = 1000
=ERR= | atClientDaemon[1257]/atClient T=main | le_atClient.c le_atClient_SetCommandAndSend() 2005 | Failed to send !

I tried to increase the timeout value but without success.

See if this app helps

Or you can see this document to send AT command in unsandboxed legato application:

The application was already in sandbox mode and the services are connected. Maybe it has something to do with the following message.

-WRN- | atClientDaemon[2705]/framework T=atCommandClient-11 | thread.c PThreadStartRoutine() 416 | Failed to set thread name for atCommandClient-11 (34).

after lot of retries i get this messages

-WRN- | atClientDaemon[4150]/framework T=atCommandClient-34 | safeRef.c le_ref_CreateRef() 547 | Safe reference map maximum exceeded for refFdMonitors, new size 106
=ERR= | power[2752]/powerComp T=main | at-commands.h sendCmd() 49 | unable to send at command "AT+WEXTCLK=1,1": LE_TIMEOUT
-WRN- | atClientDaemon[2705]/framework T=atCommandClient-13 | thread.c PThreadStartRoutine() 416 | Failed to set thread name for atCommandClient-13 (34).
=ERR= | atClientDaemon[2705]/atClient T=atCommandClient-2 | le_dev.c le_dev_Read() 278 | read error: Resource temporarily unavailable
=ERR= | atClientDaemon[2705]/atClient T=atCommandClient-1 | le_dev.c le_dev_Read() 278 | read error: Resource temporarily unavailable
=ERR= | atClientDaemon[2705]/atClient T=atCommandClient-3 | le_dev.c le_dev_Read() 278 | read error: Resource temporarily unavailable
=ERR= | atClientDaemon[2705]/atClient T=atCommandClient-5 | le_dev.c le_dev_Read() 278 | read error: Resource temporarily unavailable
=ERR= | atClientDaemon[2705]/atClient T=atCommandClient-9 | le_dev.c le_dev_Read() 278 | read error: Resource temporarily unavailable
=ERR= | atClientDaemon[2705]/atClient T=atCommandClient-7 | le_dev.c le_dev_Read() 278 | read error: Resource temporarily unavailable
=ERR= | atClientDaemon[2705]/atClient T=atCommandClient-10 | le_dev.c le_dev_Read() 278 | read error: Resource temporarily unavailable
=ERR= | atClientDaemon[2705]/atClient T=atCommandClient-6 | le_dev.c le_dev_Read() 278 | read error: Resource temporarily unavailable
=ERR= | atClientDaemon[2705]/atClient T=atCommandClient-12 | le_dev.c le_dev_Read() 278 | read error: Resource temporarily unavailable
=ERR= | atClientDaemon[2705]/atClient T=atCommandClient-11 | le_dev.c le_dev_Read() 278 | read error: Resource temporarily unavailable

I double checked the adef and cdef as well. The following is the code that gives me headache

	if (cmdRef != nullptr)
	{
		leRes = le_atClient_SetDevice(cmdRef, devRef);
		LE_ERROR_IF(leRes != LE_OK, "failed SetDevice");

		leRes = le_atClient_SetCommand(cmdRef, cmd);
		LE_ERROR_IF(leRes != LE_OK, "failed setting command");

		leRes = le_atClient_SetFinalResponse(cmdRef, "OK|ERROR|+CME ERROR");
		LE_ERROR_IF(leRes != LE_OK, "failed setting final response");

		leRes = le_atClient_SetIntermediateResponse(cmdRef, "");
		LE_ERROR_IF(leRes != LE_OK, "failed setting intermed response");

		leRes = le_atClient_Send(cmdRef);
		// leRes = le_atClient_SetCommandAndSend(&cmdRef, devRef, cmd, "", "OK|ERROR|+CME ERROR", 1000);
		LE_ERROR_IF(leRes != LE_OK, "unable to send at command \"%s\": %s", cmd, LE_RESULT_TXT(leRes));
	}

Have you tried the sample application?

Have you tried to send AT command in unsandboxed legato application?

fixed it, you can only connect one at a time.