Sming - Open Source framework for high efficiency native ESP8266 development

User avatar
By piperpilot
#35933 Hey guys,

I figured I'd post here to start. I am working to implement a PIC boot loader HOST side into my project where the onboard PIC can be updated from the ESP-8266 that downloads the latest firmware from a website. I'm just getting started and need access to debug information as I go to see whats going on.

The primary RX/TX UART0 is being used to talk to the PIC and I can't really send debug info over that line as it might cause problems with the boot loader process. I'd really like to use what I have seen referenced as UART1 that some say hangs on GPIO2 to do this.

In HarwareSerial.cpp I see the following:

Code: Select allHardwareSerial::HardwareSerial(const int uartPort)
   : uart(uartPort)
{
   resetCallback();
}


So it looks like I can instantiate an instance of HardwareSerial and pass in port 1? Then call begin, etc on it with the baud rate?

Has anyone done this before?

Now next question, on an ESP-12, I have GPIO2 tied high to 3.3V as thats what I was told needed to be done for it to boot. How is this supposed to support output then.

Anyways, if anyone has any insight to get me going, that would be great.
User avatar
By alonewolfx2
#35952 use this function for swapping uart to mtdo. i tried that code on sming and workig fine
define this on top of application.cpp
Code: Select all#define FUNC_U0CTS    4
#define FUNC_U0RTS    4

and use this on last line in void init() function.
Code: Select allPIN_FUNC_SELECT(PERIPHS_IO_MUX_MTCK_U, FUNC_U0CTS);//CONFIG MTCK PIN FUNC TO U0CTS//gpio13
PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDO_U, FUNC_U0RTS);//CONFIG MTDO PIN FUNC TO U0RTS//gpio15
SET_PERI_REG_MASK(0x3ff00028 , BIT2);//SWAP PIN : U0TXD<==>U0RTS(MTDO) , U0RXD<==>U0CTS(MTCK)

this will change uart after all bootlog.

http://bbs.espressif.com/viewtopic.php?f=7&t=22
User avatar
By piperpilot
#35981 Thanks @alonewolfx2, but not exactly what I'm looking for.

I'd like the normal UART0 to work...that is how I will talk to the PIC to program it.

But I would like to ALSO use UART1 to output some of my own debug code to see what is going on with the process during development. Does that make sense? I believe I can instantiate Serial1, but more concerned about what the ESP-12 is expecting on GPIO2.
User avatar
By piperpilot
#36004 OK...so I tried this with no success yet...here's what I did:

First off, I tied RX of my FTDI adapter to GPIO2 of the ESP and I removed the pull-up resistor. I also tied GND to GND on my board.

When the ESP starts, I do see some debug output at 115200bps:

Code: Select allload 0x40100000, len 1632, room 16
tail 0
chksum 0x43
load 0x3ffe8000, len 700, room 8
tail 4
chksum 0x0b
csum 0x0b

rBoot v1.2.1 - richardaburton@gmail.com
Flash Size:   32 Mbit
Flash Mode:   QIO
Flash Speed:  40 MHz
rBoot Option: Big flash

Booting rom 0.


At the top of my application.cpp I put:

Code: Select allHardwareSerial Serial2(1);


Then in my init() I put:

Code: Select all   Serial2.begin(SERIAL_BAUD_RATE);
   Serial2.systemDebugOutput(true);
   Serial2.printf("System Chip ID: %x\r\n", system_get_chip_id());


I don't see anything after the "Booting rom 0" message and it also seems like my ESP is rebooting over and over because of "something". I'll debug the reboot issue separately. But if anyone has a clue why Serial2 isn't getting used after I initialize it, I'm all ears.