ADH8066 Communication Problem

Dear All,

I’m having a weird problem with my adh8066 module.

I’m trying to send a simple sms message, this is a code snippet:

   int size =0;
	char at_command[] = "AT\r\n";
	char set_text_mode[] = "AT+CMGF=1\r\n";
	char set_receiving_number[] = "AT+CMGS=\"00201285308016\"\r\n";
	char message_body[] = "Hello from OK6410\x1A";

	tcflush(fd, TCIOFLUSH);

	write(fd,at_command,sizeof(at_command));
	char ptr0[20];
	size = read(fd,ptr0,20);
	ptr0[size]='\0';
	printf("%s\n",ptr0);

	tcflush(fd, TCIOFLUSH);

	write(fd,set_text_mode,sizeof(set_text_mode));
	char ptr1[20];
	size = read(fd,ptr1,20);
	ptr1[size]='\0';
	printf("%s\n",ptr1);

	tcflush(fd, TCIOFLUSH);

	write(fd,set_receiving_number,sizeof(set_receiving_number));
	char ptr2[20];
	size = read(fd,ptr2,20);
	ptr2[size]='\0';
	printf("%s\n",ptr2);

	tcflush(fd, TCIOFLUSH);

	write(fd,message_body,sizeof(message_body));
	char ptr3[20];
	size = read(fd,ptr3,20);
	ptr3[size]='\0';
	printf("%s\n",ptr3);

The code above is supposed to send each AT command and print the response.

I get these responses:

AT

AT+CMGF=1

AT+CMGS="00201285308016"

The responses are the same AT commands I sent, and I don’t know where is the problem.

Here is the 1st part of the code, before the above snippet:

	int fd;
	struct termios oldtio,newtio;

	fd = open("/dev/ttyS0", O_RDWR | O_NOCTTY);
	if (fd==-1)
	{
		printf("Can't Open Serial Port!\n");
		exit(0);
	}

	tcgetattr(fd,&oldtio); /* save current serial port settings */
	bzero(&newtio, sizeof(newtio)); /* clear struct for new port settings */

	newtio.c_cflag = BAUDRATE | CLOCAL | CS8 | CREAD;
	newtio.c_iflag = IGNPAR | ICRNL;
	newtio.c_oflag = 0;
	newtio.c_lflag = ICANON;

	newtio.c_cc[VINTR]    = 0;
	newtio.c_cc[VQUIT]    = 0;
	newtio.c_cc[VERASE]   = 0;
	newtio.c_cc[VKILL]    = 0;
	newtio.c_cc[VEOF]     = '>';
	newtio.c_cc[VTIME]    = 10;
	newtio.c_cc[VMIN]     = 0;
	newtio.c_cc[VSWTC]    = 0;
	newtio.c_cc[VSTART]   = 0;
	newtio.c_cc[VSTOP]    = 0;
	newtio.c_cc[VSUSP]    = 0;
	newtio.c_cc[VEOL]     = 0;
	newtio.c_cc[VREPRINT] = 0;
	newtio.c_cc[VDISCARD] = 0;
	newtio.c_cc[VWERASE]  = 0;
	newtio.c_cc[VLNEXT]   = 0;
	newtio.c_cc[VEOL2]    = 0;

	cfsetispeed(&newtio, BAUDRATE);
	cfsetospeed(&newtio, BAUDRATE);

	tcflush(fd, TCIFLUSH);
	tcsetattr(fd,TCSANOW,&newtio);

Any Help?

Hello, I have the same problem. The response are the same ascii caracters but the module don´t ejecuts the AT comands.

Do you solve this problem?

Problem solved! My problem is the hyperterminal software: it don´t sent the line terminator. I try with another software and the responses are fine. Line terminator for all comands: CR+LF \r\n