8 Replies Latest reply on May 21, 2017 8:40 AM by dovydas.girdvainis

    PSoC4 pioneer and ESP8266 WiFi module problem

    dovydas.girdvainis

      Hello guys, 

         

       

         

      I started to mess around with  ESP8266 and PSoC4 pioneer kit (CY8C4245AXI-483), this is my uart set up: 

         

      https://i.imgur.com/UrOn4K9.png 

         

      https://i.imgur.com/oP5A643.png

         

      I have set up my ESP8266 pins like this: 

         

      CE - 3.3 V 

         

      3.3 V - 3.3 V 

         

      RX - TX P1[1]

         

      TX - RX P1[0]

         

      GND - GND 

         

      RST - P2[2] 

         

      Everything else is left float. 

         

       

         

      I send AT command and check for OK response from ESP like this: 

         

      <code>

         

      UART_PutString("AT\r\n");  

         

       if (!WaitText("OK", 100)) 
              UART_1_UartPutString("UART does not work\r\n"); // debug text to putty terminal

         

      </code>

         

      I use some code from similar projects, to check for OK response:

         

      <code>

         

      uint16  WaitText(char *target, int time)     /******************************************************/             
       {
      uint8 targetLen = strlen(target);                                 // Длина искомого фрагмента
      uint8 index = 0;                                                  // maximum target string length is 255 bytes
      char c;                                                            // текущий символ
      while(UART_GetRxBufferSize())
      //do
      {                             // читаем UART  
            c = UART_ReadRxData();                                        // это элемент[index] искомой строки?  
            if( c == target[index]){  if(++index >= targetLen){return 1; }}    // return true если все элементы строки найдены    if all chars in the target match
            else  index = 0;   //..........................                     // не тот фрагмент - обнуляемся 
            if( !UART_GetRxBufferSize()){CyDelay(1); time--;}    // при проверке с==0 - вычитывает несколько раз, поэтому ReadRxData и GetRxBufferSize
          } //while(time);
      return 0;    // буфер данных пуст

         

      </code>

         

      The problem is, that I find no OK response. I thought that UART_PutString() function, does'nt put CR and LF chars at the end, so I put them myself, but I might be wrong, so I tried playing with combinations (no CR, but LF, no LF, but CR, no CR and no LF), but it still does'nt work, could it be that I configured my UART incorrectly? I know that the baud rate is correct, because I tested the esp on arduino board, and everything worked just fine. So at this point I am stumped, any ideas how to solve this?