Arduino changes COM port when uploading code (Windows) - windows

I'm testing the new MKR1000 in Windows. I'm having an annoying issue that causes Windows to re-install the Arduino drivers in another port every time I upload new code into the board. E.g.:
If the Arduino is installed on COM4, when I upload code into the board Windows decides to install Arduino on COM5. This causes the IDE to tell me that the upload procedure failed (as there is no Arduino connected on COM5), but strangely enough, the code actually uploads correctly.
If I want to open the Serial monitor I need to go in the IDE and change the Arduino port back to COM4. It's super annoying to have Windows go through the driver installation procedure every time I upload new code into Arduino.
Some generic information:
This happens in both Windows 7 & 8
I'm troubleshooting with the Blink example (pin 6)
The problems happens with both the Arduino IDE (1.6.11) & Arduino Create (1.0.38)
The MKR1000 is correctly installed in Windows, showing up in the Device Manager as 'Arduino MKR1000 (COM4)'
SAMD Board 1.6.6 is installed
Tried multiple USB cables
The error in the Arduino IDE is:
Arduino: 1.6.11 (Windows 7), Board: "Arduino/Genuino MKR1000"
Sketch uses 7,972 bytes (3%) of program storage space. Maximum is 262,144 bytes.
Forcing reset using 1200bps open/close on port COM4
PORTS {COM3, COM4, } / {COM3, } => {}
PORTS {COM3, } / {COM3, } => {}
PORTS {COM3, } / {COM3, } => {}
PORTS {COM3, } / {COM3, COM5, } => {COM5, }
Found upload port: COM5
C:\Users\40009929\AppData\Local\Arduino15\packages\arduino\tools\bossac\1.6.1-arduino/bossac.exe -i -d --port=COM5 -U true -i -e -w -v C:\Users\40009929\AppData\Local\Temp\build9c9ef3bdfe2fccb480bc6e4bac749e41.tmp/Blink.ino.bin -R
Set binary mode
readWord(addr=0)=0x20007ffc
readWord(addr=0xe000ed00)=0x410cc601
readWord(addr=0x41002018)=0x10010305
version()=v2.0 [Arduino:XYZ] Nov 24 2015 11:35:16
chipId=0x10010005
Connected at 921600 baud
readWord(addr=0)=0x20007ffc
readWord(addr=0xe000ed00)=0x410cc601
readWord(addr=0x41002018)=0x10010305
Atmel SMART device 0x10010005 found
write(addr=0x20004000,size=0x34)
writeWord(addr=0x20004030,value=0x10)
writeWord(addr=0x20004020,value=0x20008000)
Device : ATSAMD21G18A
readWord(addr=0)=0x20007ffc
readWord(addr=0xe000ed00)=0x410cc601
readWord(addr=0x41002018)=0x10010305
Chip ID : 10010005
version()=v2.0 [Arduino:XYZ] Nov 24 2015 11:35:16
Version : v2.0 [Arduino:XYZ] Nov 24 2015 11:35:16
Address : 8192
Pages : 3968
Page Size : 64 bytes
Total Size : 248KB
Planes : 1
Lock Regions : 16
Locked : readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
none
readWord(addr=0x41004018)=0
Security : false
Boot Flash : true
readWord(addr=0x40000834)=0x7000a
BOD : true
readWord(addr=0x40000834)=0x7000a
BOR : true
Arduino : FAST_CHIP_ERASE
Arduino : FAST_MULTI_PAGE_WRITE
Arduino : CAN_CHECKSUM_MEMORY_BUFFER
Erase flash
chipErase(addr=0x2000)
done in 0.823 seconds
Write 8124 bytes to flash (127 pages)
write(addr=0x20005000,size=0x1000)
writeBuffer(scr_addr=0x20005000, dst_addr=0x2000, size=0x1000)
SAM-BA operation failed
An error occurred while uploading the sketch
[=============== ] 50% (64/127 pages)write(addr=0x20005000,size=0xfc0)
writeBuffer(scr_addr=0x20005000, dst_addr=0x3000, size=0xfc0)
[==============================] 100% (127/127 pages)
done in 0.051 seconds
Verify 8124 bytes of flash with checksum.
checksumBuffer(start_addr=0x2000, size=0x1000) = 7923
checksumBuffer(start_addr=0x3000, size=0xfbc) = b6c0
Verify successful
done in 0.010 seconds
CPU reset.
readWord(addr=0)=0x20007ffc
readWord(addr=0xe000ed00)=0x410cc601
readWord(addr=0x41002018)=0x10010305
writeWord(addr=0xe000ed0c,value=0x5fa0004)
In Arduino Create the problem is the same:
Atmel SMART device 0x10010005 found
Device : ATSAMD21G18A
Chip ID : 10010005
Version : v2.0 [Arduino:XYZ] Nov 24 2015 11:35:16
Address : 8192
Pages : 3968
Page Size : 64 bytes
Total Size : 248KB
Planes : 1
Lock Regions : 16
Locked : none
Security : false
Boot Flash : true
BOD : true
BOR : true
Arduino : FAST_CHIP_ERASE
Arduino : FAST_MULTI_PAGE_WRITE
Arduino : CAN_CHECKSUM_MEMORY_BUFFER
Erase flash
done in 0.822 seconds
Write 8116 bytes to flash (127 pages)
[=============== ] 50% (64/127 pages)
[==============================] 100% (127/127 pages)
done in 0.052 seconds
Verify 8116 bytes of flash with checksum.
Verify successful
done in 0.010 seconds
CPU reset.
SAM-BA operation failed
Could not program the board

Hi based on your output there might be a reason why its doing that.
Other developers can correct me if I am wrong.
When you upload a code to the ATSAMD21,
-->The IDE/development environment used will put the board into bootloader mode for 5seconds. (At 1200bps) //STEP 1
-->But when it uploads the program to the board the bootloader locks after successful upload and changes its port //STEP 2
-->At STEP 1, the micro works as NATIVE USB Port and calls PROGRAMMING USB Port
-->At STEP 2, the micro finishes programming and after reset it goes back to its default state - NATIVE USB Port (this is where your COM port changes to the next port).
-->If you observe carefully when you open hyperterm and open the connected Arduino port (say COM4 for example) at 1200bps in 5sec, in your device manager you will notice a USB Serial Device in place of your Arduino MKR board.
Hope it helps.

Yeah I had the same problem too. Try to download arduino advance ide (enhanced release).
Here
This should help because when it does changes port it will tell you and ask you if you do want to.
Hope it helped!

Here is my fix for SAM-BA operation failed.
Situation
Windows 7 with USB3 port (previously worked on Windows 7 machine with only USB2 ports)
Uploading to Sparkfun Redboard Turbo
Put a USB 2 hub between the PC and the board.
SAM-BA error no longer occurres

Related

Error: no device found Error: unable to open ftdi device with vid 0403, pid 6010, description '*' When trying to debug ESP32-S3 on macOS

Trying to debug ESP32-S3 with PlatformIO on VSCode with macOS on M1.
Installed ftdi drivers from their website. (installed the VCP drivers, not the D3XX ones as I couldn't find a way to compile and install them).
As ESP32-S3 has an internal debugger, I just created a USB that connects D-/D+ pins to the board gpio 19 and 20 (and grd). BTW, when I connect it to the macbook, I dont see any additional port under /dev/*
Getting the following error, regardless of my platform.ini configuration.
http://openocd.org/doc/doxygen/bugs.html
adapter speed: 20000 kHz
adapter speed: 5000 kHz
Info : tcl server disabled
Info : telnet server disabled
Error: no device found
Error: unable to open ftdi device with vid 0403, pid 6010, description '*', serial '*' at bus location '*'
Error: no device found
Error: unable to open ftdi device with vid 0403, pid 6014, description '*', serial '*' at bus location '*'
.pioinit:11: Error in sourced command file:
Remote connection closed
My platformio.ini:
[env:esp32-s3-devkitc-1]
platform = espressif32
board = esp32-s3-devkitc-1
framework = arduino
upload_port = /dev/cu.wchusbserial553C0085431
monitor_speed=115200
build_type = debug
debug_init_break = tbreak setup
;debug_tool = esp-builtin
debug_tool = esp-prog
Removed and installed the ftdi drivers.
Got a similar error when trying with ESP-IDF.
Any thoughts?
If you are connecting the USB conector directly on esp32s3 module, you should try to change the board parameter from esp32-s3-devkitc-1 to esp32s3-builtin. This way you specify that you are using the built-in debugger.

Break at address "0x[...]" with no debug information available, or outside of program code STM32CubeIDE

I have already read this, this and this but noone of them match my issue.
When I launch the debug option on the STM32CubeIDE 1.10.1 everything works well, the code is flashed, it works and I can easily debug everything. The only issue is that while flashing, I got the following message
Break at address "0x8002664" with no debug information available, or outside of program code.
To actually run the code after having flashed it, I have to press Resume (F8). The code, after having flashed it, should have a default breakpoint on the int main(void) { line. For some reason, my breakpoint is set at HAL_NVIC_ClearPendingIRQ(SysTick_IRQn); where
int main(void) {
//unsigned char a = 1;
uint32_t i = 0;
/* USER CODE BEGIN 1 */
//__disable_irq();
HAL_NVIC_ClearPendingIRQ(SysTick_IRQn);
My strtup file is correctly added under Startup folder as startup_stm32f091vbtx.s
The output of the debugger (I'm using a ST-Link/V2) is
STMicroelectronics ST-LINK GDB server. Version 7.0.0
Copyright (c) 2022, STMicroelectronics. All rights reserved.
Starting server with the following options:
Persistent Mode : Disabled
Logging Level : 1
Listen Port Number : 61234
Status Refresh Delay : 15s
Verbose Mode : Disabled
SWD Debug : Enabled
InitWhile : Enabled
Waiting for debugger connection...
Debugger connected
Waiting for debugger connection...
Debugger connected
Waiting for debugger connection...
-------------------------------------------------------------------
STM32CubeProgrammer v2.11.0
-------------------------------------------------------------------
Log output file: C:\Users\...\STM32CubeProgrammer_a11308.log
ST-LINK SN : 55FF6D066684564926401687
ST-LINK FW : V2J39S7
Board : --
Voltage : 3.19V
SWD freq : 4000 KHz
Connect mode: Under Reset
Reset mode : Hardware reset
Device ID : 0x442
Revision ID : Rev 1.0
Device name : STM32F09x/F030xC
Flash size : 128 KBytes
Device type : MCU
Device CPU : Cortex-M0
BL Version : --
Memory Programming ...
Opening and parsing file: ST-LINK_GDB_server_a11308.srec
File : ST-LINK_GDB_server_a11308.srec
Size : 75.89 KB
Address : 0x08004000
Erasing memory corresponding to segment 0:
Erasing internal memory sectors [8 45]
Download in Progress:
File download complete
Time elapsed during download operation: 00:00:03.654
Verifying ...
Download verified successfully
Shutting down...
Exit.

ESP8266: Timed out waiting for packet header

Hi somebody who can link an beginners guide for ESP 8266 on arduino uno? Or help me with this error :
Arduino:1.8.9 (Windows 10), Kort:"Generic ESP8266 Module, 80 MHz,
Flash, Legacy (new can return nullptr), All SSL ciphers (most
compatible), dtr (aka nodemcu), 26 MHz, 40MHz, DOUT (compatible), 4MB
(FS:3MB OTA:~512KB), 2, nonos-sdk 2.2.1+100 (190703), v2 Lower Memory,
Disabled, None, Only Sketch, 115200"
Executable segment sizes:
IROM : 227372 - code in flash (default or
ICACHE_FLASH_ATTR)
IRAM : 26368 / 32768 - code in IRAM (ICACHE_RAM_ATTR,
ISRs...)
DATA : 1252 ) - initialized variables (global, static) in
RAM/HEAP
RODATA : 672 ) / 81920 - constants (global, static) in
RAM/HEAP
BSS : 24848 ) - zeroed variables (global, static) in
RAM/HEAP
Sketch uses 255664 bytes (24%) of program storage space. Maximum is
1044464 bytes. Global variables use 26772 bytes (32%) of dynamic
memory, leaving 55148 bytes for local variables. Maximum is 81920
bytes. esptool.py v2.8 Serial port COM3
Connecting........_____....._____....._____....._____....._____....._____.....____Traceback (most recent call last): File
"C:\Users\Elev\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.3/tools/upload.py",
line 65, in
esptool.main(cmdline) File "C:/Users/Elev/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/2.6.3/tools/esptool\esptool.py",
line 2890, in main
esp.connect(args.before) File "C:/Users/Elev/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/2.6.3/tools/esptool\esptool.py",
line 483, in connect
raise FatalError('Failed to connect to %s: %s' % (self.CHIP_NAME, last_error)) esptool.FatalError: Failed to connect to ESP8266: Timed
out waiting for packet header esptool.FatalError: Failed to connect to
ESP8266: Timed out waiting for packet header
_
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
If still. facing the issue try these settings
To Program Using Arduino Nano
Pin setup in nano:
Connect Nano GND pin to RST pin (ground to reset)
Pin setup in ESP-01
Connect GND to GPIO-0 (Initiates programming mode)
Connect VCC to CH_PD/CH_EN (Power pin to Chip Enable)
Pin setup between nano and ESP-01
Nano to ESP-01
Connect the VCC to VCC and CH_PD/CH_EN
Connect GND to GND and GPIO-0
Connect Tx to Tx
Connect Rx to Rx

CS32F103C8T6 blue-pill clone - cannot flash from AC6 SystemWorkbench

I am trying to flash a blue-pill clone with a CS32F103C8T6 chip using the AC6 SystemWorkBench and a ST-LINK v2 device. It is a project built from STM32CubeMX - I am using a MacOS Mojave machine. Here is the output when trying to flash the device.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 8000 kHz
adapter_nsrst_delay: 100
Info : clock speed 8000 kHz
Info : STLINK v2 JTAG v31 API v2 SWIM v7 VID 0x0483 PID 0x3748
Info : using stlink api v2
Info : Target voltage: 3.162004
Info : Unable to match requested speed 8000 kHz, using 4000 kHz
Info : Stlink adapter speed set to 4000 kHz
Warn : UNEXPECTED idcode: 0x2ba01477
Error: expected 1 of 1: 0x1ba01477
in procedure 'program'
in procedure 'init' called at file "embedded:startup.tcl", line 495
in procedure 'ocd_bouncer'
** OpenOCD init failed **
shutdown command invoked
I have googled and found some similar posts about it, but have no luck solving it.
Does anyone have an idea ?
mvh
Ole K Hornnes
In the OpenOCD config file, you need to add:
set CPUTAPID 0x2ba01477
I've never used AC6 SystemWorkbench and I don't now how you configure the board and the debug adapter in it. So I can't really tell where to look for the config file.
OpenOCD comes with an entire directory of board configurations, usually in a directory OpenOCD / scripts / board. It contains a script called stm32f103c8_blue_pill.cfg, which might be used in your case. Start there...
set CPUTAPID 0x2ba01477 ; Will work for the clone but not for the genuine STM32…
Instead use: set CPUTAPID 0
The zero tells OpenOCD to ignore the id number, so any MCU will then work…
Information Source: OpenOCD TAPs
C:\Ac6\SystemWorkbench\plugins\fr.ac6.mcu.debug_2.5.0.201904120827\resources\openocd\st_scripts\target\stm32f1x.cfg
add this line before first if statement
set CPUTAPID 0
it solves all openocd stlink id errors

ESP32 WROVER-B programming issue

trying to program ESP32-WROVER-B it stops just after start, I have connected button EN (on pin EN) and tried various combinations but it didn't help.
Also tried to change baudrate, fix flash size to 4MB but still nothing.
This is the output:
$ make -j4 flash monitor
Toolchain path: /opt/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc
Toolchain version: crosstool-ng-1.22.0-80-g6c4433a5
Compiler version: 5.2.0
App "websocket_server" version: b4b6984-dirty
Python requirements from C:/ESP32/esp-idf/requirements.txt are satisfied.
Flashing binaries to serial port COM8 (app at offset 0x10000)...
esptool.py v2.6-beta1
Serial port COM8
Connecting........_____..
Chip is ESP32D0WDQ5 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
MAC: 24:6f:28:4c:9b:4c
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 230400
Changed.
Configuring flash size...
Compressed 24240 bytes to 14517...
Wrote 24240 bytes (14517 compressed) at 0x00001000 in 0.7 seconds (effective 295.4 kbit/s)...
A fatal error occurred: Timed out waiting for packet header
make: *** [/c/ESP32/esp-idf/components/esptool_py/Makefile.projbuild:63: flash] Error 2
Any hint?
In case your ESP32 looks like this one you need to keep pressed the RST button while uploading the new code to avoid that error.
Hope this helps you!

Resources