Arduino Nano 33 BLE infinite loop upload issue


While working on code it’s common to make mistakes, but some mistakes are more severe than other.

I was playing around with BLE on Arduino Nano 33 BLE board and I thought that it would be good idea to delete BLE.central() in loop() as I had some issues with BLE communication. After uploading program immediately noticed orange blinking diode…

What I’m suspecting was happening is that BLE was initialized every time loop() was called and caused board to be busy. Naturally after realizing issue uploaded reverted code but this time upload was stuck on:

Forcing reset using 1200bps open/close on port COM5

Unplugging USB cable results in communication lost so that’s not helpful. Doing reset did same…

At this point I thought that board is toasted ;/

So I tried what any cornered animal do, smashing reset button, and it worked 😀

More precisely what worked was passing “force reset stage” and “landing” at the time that bossac starts it’s upload job on that port while board is not busy (when doing continuous board reset there is a short period when board initialize and program is initializing and if timing is right bossac will start uploading program).

Here is log for that upload:

Sketch uses 299760 bytes (30%) of program storage space. Maximum is 983040 bytes.
Global variables use 69280 bytes (26%) of dynamic memory, leaving 192864 bytes for local variables. Maximum is 262144 bytes.
Forcing reset using 1200bps open/close on port COM5
PORTS {COM5, } / {} => {}
PORTS {} / {} => {}
PORTS {} / {} => {}
PORTS {} / {} => {}
PORTS {} / {} => {}
PORTS {} / {COM3, } => {COM3, }
Found upload port: COM3
C:\Users\user\AppData\Local\Arduino15\packages\arduino\tools\bossac\1.9.1-arduino2/bossac.exe -d –port=COM3 -U -i -e -w C:\Windows\TEMP\arduino_build_766921/test.ino.bin -R
Set binary mode
version()=Arduino Bootloader (SAM-BA extended) 2.0 [Arduino:IKXYZ]
Connected at 921600 baud
identifyChip()=nRF52840-QIAA
write(addr=0,size=0x34)
writeWord(addr=0x30,value=0x400)
writeWord(addr=0x20,value=0)
version()=Arduino Bootloader (SAM-BA extended) 2.0 [Arduino:IKXYZ]
Device : nRF52840-QIAA
Version : Arduino Bootloader (SAM-BA extended) 2.0 [Arduino:IKXYZ]
Address : 0x0
Pages : 256
Page Size : 4096 bytes
Total Size : 1024KB
Planes : 1
Lock Regions : 0
Locked : none
Security : false
Erase flash
chipErase(addr=0)

Done in 0.000 seconds
Write 299768 bytes to flash (74 pages)
[ ] 0% (0/74 pages)write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0, size=0x1000)
write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0x1000, size=0x1000)
write(addr=0x34,size=0x1000)
writeBuffer(scr_addr=0x34, dst_addr=0x2000, size=0x1000)
[= ] 4% (3/74 pages)write(addr=0x34,size=0x1000)

Clearly timing is key here.

, , ,

Comments are closed.