I can program the esp8266 when using an ftdi chip, but when I try to program it through the sam3x's native usb port using SerialUSB it fails. The sam3x is running a basic program that transfers the SerialUSB TX/RX bytes to Serial2.
Here is that code:
HardwareSerial *s = g_ctx.esp8266.getSerial();
while (1) {
if(SerialUSB.available()){
s->write(SerialUSB.read());
}
if(s->available()){
SerialUSB.write(s->read());
}
}
I found this great site the describes the packets used to program the esp8266 (https://github.com/espressif/esptool/wi ... l-Protocol). Then I attached a logic analyzer. I compared both the passing FTDI case and the failing Sam3x case. In both cases the initialization serial packets are sent to the esp8266 and the esp8266 responds. However, after that response from the esp8266 the FTDI case starts sending data, but the computer doing the programming never seems to get the acknowledgment in the sam3x case.
This made me think that something was wrong with the passing of the serial bytes from sam3x to the computer where the programming was being done. I don't have a logic analyzer that works with USB so instead I hooked up a serial terminal (putty) to the sam3x usb port. Then I sent a spoof initialization packet to the esp8266 that matched what was being sent from my computer for the esp8266 program initialization. In this case I got the exact data I was expecting from the esp8266 on my computer.
At this point I'm not sure why the esp8266 programming is failing when going through the sam3x. Do you experts have any ideas what might be going wrong?
Thanks in advance!