So I'm making a little board based on a NodeMCU and another peripheral I communicate with over serial. Now, I'd like to have bi-directional serial with Rx and Tx to the peripheral and at the same time, let users re-flash the NodeMCU should they need it.
But I'm running into roadblocks on how to do this. If I connect the serial lines from the NodeMCU/esp8266 to the other device, its serial will interfere with the bootloader. I tried to do something like tie the ESP's reset and GPIO 0 lines to inputs on the peripheral so that if it detects them to reset and be low, to not start serial. But the ESP is weird in that it uses GPIO0 as an output for a while too along with input so it doesn't seem reliable.
Another thing I did was use the second serial peripheral on the ESP8266 that's on pins 13 and 15. But GPIO 15 must be held low to boot normally and that's what goes to the other peripheral's RX line which pulls it high (serial RX does that). And those lines aren't connected to the NodeMCU's USB serial chip so it's not as nice for debugging.
I'm ready to say screwit and just use a toggle switch to turn power on or off to the other peripheral so it won't interrupt. But I really don't want to add components to the board for something that feels like it should be possible in software and clever layout, I just can't seem to get it.
And yes, I already can flash OTA over wifi, but I want to make the USB/Serial route an option for my users in case they need that lower level of flashing if their OTA firmware screws up.
Any suggestions would be greatly appreciated, thank you!