Trying to get ESP-7S to talk to MCU

Hi.. I ve design a board based on the Mighty Core 1284p chip running at 3.3V along with a ESP-7S.
The ESP module is connected to Serial1 while I use Serial for debugging.
I am posting a simplified version both of the schematic as well as the code for debugging purposes. This is the only part of the PCB that has been populated for now anyway.

#define esp8266Enable 1
#define esp8266Reset 4

void setup() {
pinMode (esp8266Enable,OUTPUT);
digitalWrite (esp8266Enable,HIGH);
pinMode(esp8266Reset, OUTPUT);
digitalWrite (esp8266Reset,HIGH);
Serial1.begin(115200);

Serial.begin(9600); // Initialise serial port for USB to PC
while (Serial.available()) {}
Serial.println(F("Sending to Wifi Module.."));

}

void loop() {

delay (5);

char c;

if (Serial1.available()) {
Serial.write(Serial1.read());
}
if (Serial.available()) {
c=Serial.read();}

Serial1.write(c);

}

For the past 3 days I am trying to send AT commands to the ESP module which wont respond.

I have already tried different baud rates for Serial1 including 9600
Verified that the PSU can deliver more than 1A at 3V3
Checked all wiring and solder joints.
Used a second ESP module .. just in case...
Needless to say that Serial Port comms with the MCU work fine.

Can anybody suggest something or spot a problem?

Thanks

Please describe what debugging techniques you used during those three days, and what you learned as a result.

What is this line supposed to do, and why?

else { Serial1.write(c);}

Well, I have mostly verified that the circuit is correct. Eg there is no tx, rx swapping etc.

Last line of the code above was a mistake . now coorrected

Do not edit the original post, as it make the thread impossible for others to follow.

And the code posted is still wrong, leaving little doubt why the actual code is not working.

If you have questions about code, post that code, or the minimum code that actually demonstrates the problem you are trying to solve.

why don't you directly connect esp07s to FTDI module.

have you tried to control a led using serial communication on esp?

is rx connected to tx and vice versa

Are you sure ESP has the AT firmware on it? https://www.espressif.com/en/products/sdks/esp-at/overview
Espressif boards are just microcontrollers so you can either program them directly and use them as the main uC or flash the firmware from espressif that allows you to use them with AT commands.

I was under the impression that AT firmware comes by default on all ESP modules...

That is not the case for any of the ESP modules I use. Among those are ESP32-CAM, ESP32 Dev Kit, Adafruit ESP32 Feathers, etc.

Yeah. I might try that as well using a putty or similar to see if the module responds.

Dont understand what you mean here. I am just trying to establish comms with the module at this stage. Controlling things would be a further step.

Yes.. see circuit above..

You could use this code to check whether esp serial communication working correctly

void setup() {
  pinMode(5, OUTPUT);
  Serial.begin(115200);
  Serial.println("setup completed");
}
void loop() {
  if (Serial.available() > 0) {
    char state = Serial.read();
    if (state == 'H' || state == 'h') {
      digitalWrite(5, HIGH);
      Serial.println("LED ON");
    }
    if (state == 'L' || state == 'l') {
      digitalWrite(5, LOW);
      Serial.println("LED OFF");
    }
  }
  delay(10);
}

that schematic only shows the pinouts, not how they are connected

Yes you are right! What is missing is this :slight_smile:
image

and it seems that Rx,Tx connections are wrong but I have tried to reverse them and it didnt make any difference.
I have now also tried to connect the FTDI directly to the module and still there is no response on the serial port.
So I would deduce that there is no AT firmware on the chip.

I am now thinking to burn a firmware using this guide: How to re-burn the firmware for ESP8266 module? — SunFounder 3in1 Kit documentation

The first and obvious step is to use a simple echo test to verify serial communications with ESP32.

Example with two ESP32 serial ports:

//DEV MODULE selected for ESP32-CAM
// works as expected with UART2, RX=14, TX=15
#include <HardwareSerial.h>
HardwareSerial SerialPort(2); // use UART2
void setup()  
{
  Serial.begin(115200);
  while (!Serial);
  Serial.println("Serial test");
  SerialPort.begin(115200, SERIAL_8N1, 14, 15); 
} 
void loop()  
{ 
  while (Serial.available()) {
    SerialPort.write(Serial.read());
  }
  while (SerialPort.available()) {
    Serial.write(SerialPort.read());
  }
}

what is the flash size of your esp-07?
if it is at least 1MB, flash AT 1.7.5 from SDK 3.0.5 from here
https://github.com/espressif/ESP8266_NONOS_SDK/releases

the upload command is

esptool.py write_flash --flash_size 1MB 0x0 boot_v1.7.bin 0x01000 at/512+512/user1.1024.new.2.bin 0xfb000 blank.bin 0xfc000 esp_init_data_default_v08.bin 0xfe000 blank.bin 0x7e000 blank.bin

esptool
https://docs.espressif.com/projects/esptool/en/latest/esp32/installation.html

no idea how much flash it has...how do you find out?

in the suppliers specs
or
with the esptool

esptool.py read_mac

it will print not just the mac address

Thanks...I guess i will need to install Python to run the tool....

Update:

I removed the ESP module and used this programmer to test it. Highly recommended by the way if you have a 3d printer! So, it appears the ESP module works fine and it has the AT firmware installed.
Next, having removed the ESP module I connected a second FTDI module in its place and used a simple code to send from Serial to Serial1 Port for testing.

The result is i can send from Serial to Serial1 but not the other way round.
Which means that when the ESP module was connected, it could receive AT commands but its response never reached the MCU.
Given that all wiring is correct and verified (continuity verified all the way from FTDI pins to MCU pins), is it possible that the Rx pin of Serial1 failed?
Any ideas for further testing before actually replacing the MCU?
Its an SMD TQFP-44 and I d prefer not to replace it unless necessary!

check the esp8266 boot log at 74880 baud

Is the boot log stored on the ESP chip itsef?