Could not open port COM4 (ESP8266)

Hello I have a question.

It’s very simple

D1 pin is LOW every 3 seconds

then If I upload the program again

Error message comes (could not open port COM4)

This is an error that occurs when the upload button is pressed while the D1 pin is LOW.
If the D1 pin is not LOW, no error occurs.

What I want to know is this error normal?
And is there a way to solve this error?

The only way I use it is to simply unplug and plug the port.

Of course, if this error comes, the program will still work internally.

But I can’t upgrade the program until I reconnect the port

My guess is that if the LOW or HIGH signal is input to all the input pins as well as the D1 pin, the program will not be uploaded.

Do you agree with me?

I think you’re using the Wemos D1 version of ESP8266. This board pin-out name does not match with the correct definition of ESP8266 boards as it tries to match the physical layout of Arduino boards such as UNO.

For this board, that so-called pin D1 (actually GPIO1) is connected to TX. The TX/RX pins actually are communications pins used for USB or Serial (mapped to whatever /dev/ttyUSBx for Linux or COMx for Windows) . That’s why you’re interfering with the normal working of COMx or /dev/ttyUSBx or Serial communications, which are necessary for uploading / Serial debugging of the board.

If you are using Serial debugging, you’ll see it might not work anymore or data are corrupted.

On some Wemos D1 boards, the correct ESP8266 pin names are printed on the back of the boards.

The solution is to use different pin for that pulsing purpose. If possible, leave that pin unused.

Thanks for the answer. Do you think I should use the what pin No.?
I’m going to use two pins

You still can use any other pins, but the so-called D0 pin, as it is actually RX. Certainly depending on your usage of other pins as well, such as SPI, TX1/RX1, etc.

I referred to this picture. According to the picture, are D1 and D2 safe?

If you’re using exactly that kind of NodeMCU board (in your picture), pin D1 and D2 are safe to use.
You can also see pin GPIO1 - TXD0 - TX and pin GPIO3 - RXD0 - RX on the lower right of the picture. Don’t use these pins.

I used D1 and D7
I agree that D7 may have caused the problem.

I will test again using D1 and D2.

Thank you very much

You should probably read this, rather than picking pins at random:

Pete.

Thank you for your reply.

What exactly does this mean? (HIGH for ~100 ms, then LOW) GPIO 12,13,14

I am trying to use one LOW input and one high output.

Can I use pins GPIO 12,13?

You are safe to use them.
(HIGH for ~100 ms, then LOW) GPIO 12,13,14 means just after booting up, the pins has some fluctuations, going HIGH for 100ms, then going back to so-called LOW if there is no internal/external PULL_UP or external PULL_DOWN.
If you use internal or external PULL_UP for these pins to use as INPUT, they will go HIGH from boot-up.
If you use them as OUTPUT, then there is nothing to worry.

Hello Mr Pete I hope you are doing fine and your family can you plz help me to understand how I can fix this problem

Executable segment sizes:
ICACHE : 32768 - flash instruction cache
IROM : 255220 - code in flash (default or ICACHE_FLASH_ATTR)
IRAM : 28897 / 32768 - code in IRAM (IRAM_ATTR, ISRs…)
DATA : 1564 ) - initialized variables (global, static) in RAM/HEAP
RODATA : 2540 ) / 81920 - constants (global, static) in RAM/HEAP
BSS : 27144 ) - zeroed variables (global, static) in RAM/HEAP
Le croquis utilise 288221 octets (27%) de l’espace de stockage de programmes. Le maximum est de 1044464 octets.
Les variables globales utilisent 31248 octets (38%) de mémoire dynamique, ce qui laisse 50672 octets pour les variables locales. Le maximum est de 81920 octets.
esptool.py v3.0
Traceback (most recent call last):
Serial port COM5
File “C:\Users\HP\Documents\ArduinoData\packages\esp8266\hardware\esp8266\3.0.2/tools/upload.py”, line 66, in
esptool.main(cmdline)
File “C:/Users/HP/Documents/ArduinoData/packages/esp8266/hardware/esp8266/3.0.2/tools/esptool\esptool.py”, line 3551, in main
esp = chip_class(each_port, initial_baud, args.trace)
File “C:/Users/HP/Documents/ArduinoData/packages/esp8266/hardware/esp8266/3.0.2/tools/esptool\esptool.py”, line 271, in init
self.port = serial.serial_for_url(port)
File "C:/Users/HP/Documents/ArduinoData/packages/esp8266/hardware/esp8266/3.0.2/tools/pyserial\serial_init
.py", line 90, in serial_for_url
Une erreur est survenue lors du transfert du croquis
instance.open()
File “C:/Users/HP/Documents/ArduinoData/packages/esp8266/hardware/esp8266/3.0.2/tools/pyserial\serial\serialwin32.py”, line 64, in open
raise SerialException(“could not open port {!r}: {!r}”.format(self.portstr, ctypes.WinError()))
serial.serialutil.SerialException: could not open port ‘COM5’: FileNotFoundError(2, ‘Le fichier sp�cifi� est introuvable.’, None, 2)

@Ilyas_MERROUN_OUAHAB I’d suggest that you start by opening a new “Need help with my project” topic and providing ALL of the information requested, along with FULL details of the type of board you are using, what you have connected to it, and as much background to what you’ve done previously with this board.

I’m closing this 3 year old topic.

Pete.