I am using msp430f67791a to communicate with the UART.
I have set the baud rate of the ESP8266 to be 9600 have disabled the parity bit using the AT commands in the putty terminal.
According to that, the modulation control and baud rate control registers have been set.
The registers have been set according to table 39-5 in the document: www.ti.com/.../slau208q.pdf
#include <msp430f67791a.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
void uart_init();
unsigned char senddata(unsigned char tx);
unsigned char sendstring[2] = {'A','T'};
unsigned char receivestring[50];
unsigned int i;
unsigned int j=0;
int main( void )
{
// Stop watchdog timer to prevent time out reset
WDTCTL = WDTPW + WDTHOLD;
uart_init();
while(1)
{
for(i=0;i<2;i++)
{
while (!(UCA1IFG & UCTXIFG))
UCA1TXBUF = sendstring[i];
}
j=0;
while (!(UCA1IFG & UCRXIFG))
{
receivestring[j] += UCA1RXBUF;
j++;
}
return 0;
}
}
void uart_init(void)
{
P3SEL0 |= (BIT4 + BIT5);
UCA1CTLW0 = 0;
UCA1CTLW0 |= UCSWRST;
UCA1CTLW0 |= (UCSSEL_2 + UCRXEIE + UCMODE_0);
UCA1CTLW0 &= ~(UCPEN + UCMSB + UC7BIT + UCSPB + UCSYNC + UCDORM);
UCA1CTLW1 |= UCGLIT_1;
UCA1BRW = 0x06;
UCA1MCTLW |= (UCBRS5 + UCBRF3 + UCOS16);
UCA1ABCTL &= ~(UCABDEN);
UCA1IRCTL &= ~(UCIREN);
UCA1CTLW0 &= ~(UCSWRST);
}
The ESP8266 does not seem to communicate with the MSP430. Please guide me through this.