-->
Page 1 of 1

UART Communication using MSP430

PostPosted: Fri Nov 20, 2020 1:57 am
by suryasiddhart
I have been using the msp430 module to connect with esp8266 module. The device driver snippet of the code is attached below. I have successfully set the baud rate and the other UART settings in the master Controller(MSP430). As a result, the device is successfully connected to the AP using AT+CWJAP. I try to use http GET request to post the data to the server. But, due to some reasons, I cannot get the data on the server.

unsigned char sendstring[20] = "AT\r\n";
unsigned char sendstring1[40] = "AT+CWJAP=\"xxxxx\",\"xxxxxxx\"\r\n";
unsigned char sendstring2[60] = "AT+CIPSTART=\"TCP\",\"xxx.xxx.xxx.xxx\",xxxx\r\n";
unsigned char sendstring3[30] = "AT+CIPSEND=500\r\n";
unsigned char sendstring4[265] = "GET http://xxx.xxx.xxx.xxx:xxxx/xxxxxx/xxxx ... &remarks=1\r\nHTTP/1.1\r\nHost: xxx.xxx.xxx.xxx:xxxx\r\nConnection: close\r\nCache-Control: private, max-age=0\r\nContent-Type: text/html;charset=utf-8\r\n";



//string 2 send
__delay_cycles(2500000);
for(j=0;j<sizeof(sendstring2);j++)
{
while (!(UCA1IFG & UCTXIFG));
UCA1TXBUF = sendstring2[j];
if (sendstring2[j] == '\n')
break;
}

for (j=0; j<sizeof(receivestring2); ++j)
{
while (!(UCA1IFG & UCRXIFG)); // Spin until something arrives
receivestring2[j] = UCA1RXBUF;
if (receivestring2[j] == '\r')
break; // quit if we see carriage return
}
receivestring[j] = '\0';
__delay_cycles(2000000);

//string 3 send
for(j=0;j<sizeof(sendstring3);j++)
{
while (!(UCA1IFG & UCTXIFG));
UCA1TXBUF = sendstring3[j];
if (sendstring3[j] == '\n')
break;
}

for (j=0; j<sizeof(receivestring3); ++j)
{
while (!(UCA1IFG & UCRXIFG)); // Spin until something arrives
receivestring3[j] = UCA1RXBUF;
if (receivestring3[j] == '\r')
break; // quit if we see carriage return
}
receivestring3[j] = '\0';
__delay_cycles(1500000);

//string 4 send
for(j=0;j<sizeof(sendstring4);j++)
{
while (!(UCA1IFG & UCTXIFG));
UCA1TXBUF = sendstring4[j];
//if (sendstring4[j] == '\n')
//break;
}

for (j=0; j<sizeof(receivestring4); ++j)
{
while (!(UCA1IFG & UCRXIFG)); // Spin until something arrives
receivestring4[j] = UCA1RXBUF;
if (receivestring4[j] == '\r')
break; // quit if we see carriage return
}
receivestring4[j] = '\0';

Here, __delay_cycles(1000000); equals delay of 1s. I feel the problems exists in the sendstring3 and sendstring4. The receivestring4 contains only the url and the port of the server. Could you guys help me to solve this problem

Re: UART Communication using MSP430

PostPosted: Wed Nov 25, 2020 3:50 am
by suryasiddhart
In the receivestring3, i get output as 'busy p' , 'WIFI CONNECTED', and 'WIFI GOT IP'.

Re: UART Communication using MSP430

PostPosted: Fri Nov 27, 2020 10:42 am
by eriksl
Not quite an "advanced" topic. Moved it.