-->
Page 1 of 1

Can't get local IP address / problems with init sequence

PostPosted: Thu Mar 01, 2018 4:29 pm
by slow_rider
I'm using an AVR MCU to communicate with an ESP8266 module over UART.
At this point I'm sending the following commands to the module:

Code: Select allvoid ESPInit(void)
{
   UARTSendString_P(PSTR("ATE0\r\n")); // Turn off echo
   _delay_ms(100);
   UARTSendString_P(PSTR("AT+CWMODE=2\r\n")); // AP on-line
   _delay_ms(100);
   UARTSendString_P(PSTR("AT+CWSAP=\"HotSpot\",\"12345\",5,0\r\n")); // Set SSID + pass
   _delay_ms(100);
   UARTSendString_P(PSTR("AT+CIPMUX=1\r\n")); // Enable multiple connections
   _delay_ms(100);
   UARTSendString_P(PSTR("AT+CIPSERVER=1,80\r\n")); // Create server, port 80
   _delay_ms(100);
   UARTSendString_P(PSTR("AT+CIFSR\r\n")); // Get local IP address
   _delay_ms(100);
}


The UART send function also sends the data to an LCD that is attached to the board. The UART receive function also does the same, it's shown here:

Code: Select all ISR(USART0_RXC_vect)
{
   static uint8_t UARTRXBufferIndex = 0;
   
   UARTRXBuffer[UARTRXBufferIndex] = USART0.RXDATAL;

   #ifdef DEBUG
      LCDSetTextColor(BLUE, BLACK);
      LCDGWriteChar(UARTRXBuffer[UARTRXBufferIndex]);
   #endif

   if (UARTRXBuffer[UARTRXBufferIndex] == '\n')
   {
      UARTRXBufferIndex = 0;
      //UARTRXFlag = true;
   }
   else if (UARTRXBufferIndex < UART_RX_BUFFER_SIZE)
      UARTRXBufferIndex++;   
   else
      UARTRXBufferIndex = 0;
}


And here are the responses I get from the ESP8266:

Image

I have tried changing the delay time between commands, does not seem to change anything for the better. Advice would be appreciated.

In addition - can this be an electrical issue? Perhaps I need to add a large cap near the module? Perhaps I need to wait a short time after powering up the board & before starting the sequence on the module?