Cannot upload to Wemos board in Arduino IDE. This is the error: “espcomm_upload_mem failed” and this is the output text. Port from COM1 to COM5 setting address from 0x00000000 to 0x00000000 espcomm_upload_file espcomm_upload_mem setting serial port timeouts to 1000 ms opening bootloader resetting board trying to connect.
Thu Feb 08, 2018 8:40 pm Are you using a USB-serial adapter or have you moded the blue pill to do serial over the on board USB connector? Im using the on board usb connector If using the onboard USB, then you may have to modify a blue board to properly enumerate. Varioius posts have been dedicated to discussing the problem. Some users report not having to mod a board and other users report that it is necessary. Therefore, in my opinion, I think it all has to do with your local development PC and environment. The relevant link is: Summary.
![Port Port](/uploads/1/2/5/3/125382320/461032363.jpg)
Hardware installation BluePillUsbResistor.jpg The USB standard requires a 1.5 kΩ pullup resistor on D+, but this board is known to have a wrong value (R10 on the board). It ships with either a 10 kΩ resistor or a 4.7 kΩ resistor, but it should be replaced with a 1.5 kΩ resistor, or put an appropriate resistor value (e.g 1.8 kΩ) in between PA12 and 3.3V. It is also true that some PCs are tolerant of incorrect value so, before you change the resistance, you can try if it works in your case. Software installation A bootloader needs to be flashed using USB to Serial or ST-Link (SWD). See Flashing the bootloader Follow the normal Installation guide. Note that after first flashing the bootloader you may have to place the board into 'perpetual bootloader' mode before you can upload a sketch; place a resistor between pin PC14 and 3.3V, and then reset the board.
You should now be able to flash a blank sketch, remove the resistor, and restart the board, after which uploading new sketches should work as expected. If you find that the IDE successfully resets your board, but dfu-util complains about no DFU-devices being present you may have to edit the maple-upload script in tools-folder. Find the line where it calls upload-reset, and increase the value given to it.
There were some early posts that had some pictures of hacks such as soldering parallel resistor across the factory installed one to get close to the proper value. This seems to be the easy way for folks that cannot do SMT board work. One inventive member came up with a 'fix' to mimic the reset circuitry of the Maple Mini: There is a very good reason that the forum suggests that beginning STM32duino users purchase a Maple Mini clone even if 33% to 50% more expensive than the blue pill. The Maple Mini generally works best with the various operating systems for reset and it is not 100% which has been a problem for more than one member who wanted to use them for educational purposes where 100% correct uploading was a requirement.