GDall All
I’ve recently acquired a Pi Pico and a Segger J-Link EDU mini, but have had a problem uploading a second time to the Pi Pico via J-Link. The EDU mini firmware has also been update.
I’ve also upload and run via pictool ‘binary method’ repeatedly without any problems…
I’ve used the obligatory blinking LED code shown below…
#include <Arduino.h>
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BUILTIN, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(LED_BUILTIN, HIGH);
delay(1000);
digitalWrite(LED_BUILTIN, LOW);
delay(1000);
}
this is my platformio.ini below…
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; Redirecting...[env:pico]
;platform = GitHub - platformio/platform-raspberrypi: Raspberry Pi: development platform for PlatformIO
platform = raspberrypiboard = pico
framework = arduino;upload_protocol = picotool
;upload_port = /dev/ttyACM0upload_protocol = jlink
;debug_tool = jlink
below is the terminal contents, and the LED Blinking…
Processing pico (platform: raspberrypi; board: pico; framework: arduino)
Verbose mode can be enabled via
-v, --verbose
option
CONFIGURATION: Redirecting...
PLATFORM: Raspberry Pi RP2040 (1.1.0) > Raspberry Pi Pico
HARDWARE: RP2040 133MHz, 264KB RAM, 2MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, jlink, raspberrypi-swd)
PACKAGES:
- framework-arduino-mbed 2.1.0
- tool-jlink 1.72000.0 (7.20.0)
- tool-openocd-raspberrypi 2.1100.0 (11.0)
- tool-rp2040tools 1.0.2
- toolchain-gccarmnoneeabi 1.90201.191206 (9.2.1)
LDF: Library Dependency Finder → Library Dependency Finder (LDF) — PlatformIO latest documentation
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 28 compatible libraries
Scanning dependencies…
No dependencies
Building in release mode
Checking size .pio/build/pico/firmware.elf
Advanced Memory Usage is available via “PlatformIO Home > Project Inspect”
RAM: [== ] 18.6% (used 50236 bytes from 270336 bytes)
Flash: [ ] 3.4% (used 71632 bytes from 2097152 bytes)
Configuring upload protocol…
AVAILABLE: cmsis-dap, jlink, picotool, raspberrypi-swd
CURRENT: upload_protocol = jlink
Uploading .pio/build/pico/firmware.hex
SEGGER J-Link Commander V7.20 (Compiled Apr 28 2021 17:38:41)
DLL version V7.20, compiled Apr 28 2021 17:38:26J-Link Command File read successfully.
Processing script file…J-Link connection not established yet but required for command.
Connecting to J-Link via USB…O.K.
Firmware: J-Link EDU Mini V1 compiled Jun 7 2021 15:44:25
Hardware version: V1.00
S/N: 801032045
License(s): FlashBP, GDB
VTref=3.226V
Target connection not established yet but required for command.
Device “RP2040_M0_0” selected.Connecting to target via SWD
ConfigTargetSettings() start
J-Link script: ConfigTargetSettings()
ConfigTargetSettings() end
InitTarget() start
InitTarget() end
Found SW-DP with ID 0x0BC12477
DPIDR: 0x0BC12477
Scanning AP map to find all available APs
AP[1]: Stopped AP scan as end of AP map has been reached
AP[0]: AHB-AP (IDR: 0x04770031)
Iterating through AP map to find AHB-AP to use
AP[0]: Core found
AP[0]: AHB-AP ROM base: 0xE00FF000
CPUID register: 0x410CC601. Implementer code: 0x41 (ARM)
Found Cortex-M0 r0p1, Little endian.
FPUnit: 4 code (BP) slots and 0 literal slots
CoreSight components:
ROMTbl[0] @ E00FF000
ROMTbl[0][0]: E000E000, CID: B105E00D, PID: 000BB008 SCS
ROMTbl[0][1]: E0001000, CID: B105E00D, PID: 000BB00A DWT
ROMTbl[0][2]: E0002000, CID: B105E00D, PID: 000BB00B FPB
Cortex-M0 identified.
PC = 10004036, CycleCnt = 00000000
R0 = 00000001, R1 = 00000001, R2 = 2000C134, R3 = 00000001
R4 = 00000000, R5 = 00000000, R6 = 00000000, R7 = 00000000
R8 = 00000000, R9 = 00000000, R10= 00000000, R11= 00000000
R12= 00000000
SP(R13)= 2000B270, MSP= 2003FFC0, PSP= 2000B270, R14(LR) = 10004037
XPSR = 01000000: APSR = nzcvq, EPSR = 01000000, IPSR = 000 (NoException)
CFBP = 02000001, CONTROL = 02, FAULTMASK = 00, BASEPRI = 00, PRIMASK = 01
FPU regs: FPU not enabled / not implemented on connected CPU.Downloading file [.pio/build/pico/firmware.hex]…
Comparing flash [100%] Done.
J-Link: Flash download: Bank 0 @ 0x10000000: Skipped. Contents already match
O.K.Reset delay: 0 ms
Reset type NORMAL: Resets core & peripherals via SYSRESETREQ & VECTRESET bit.
Reset: Halt core after reset via DEMCR.VC_CORERESET.
Reset: Reset device via AIRCR.SYSRESETREQ.Script processing completed.
===================================== [SUCCESS] Took 3.91 seconds =====================================
On the second J-Link upload, the output is shown below…
Processing pico (platform: raspberrypi; board: pico; framework: arduino)
Verbose mode can be enabled via
-v, --verbose
option
CONFIGURATION: Redirecting...
PLATFORM: Raspberry Pi RP2040 (1.1.0) > Raspberry Pi Pico
HARDWARE: RP2040 133MHz, 264KB RAM, 2MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, jlink, raspberrypi-swd)
PACKAGES:
- framework-arduino-mbed 2.1.0
- tool-jlink 1.72000.0 (7.20.0)
- tool-openocd-raspberrypi 2.1100.0 (11.0)
- tool-rp2040tools 1.0.2
- toolchain-gccarmnoneeabi 1.90201.191206 (9.2.1)
LDF: Library Dependency Finder → Library Dependency Finder (LDF) — PlatformIO latest documentation
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 28 compatible libraries
Scanning dependencies…
No dependencies
Building in release mode
Checking size .pio/build/pico/firmware.elf
Advanced Memory Usage is available via “PlatformIO Home > Project Inspect”
RAM: [== ] 18.6% (used 50236 bytes from 270336 bytes)
Flash: [ ] 3.4% (used 71632 bytes from 2097152 bytes)
Configuring upload protocol…
AVAILABLE: cmsis-dap, jlink, picotool, raspberrypi-swd
CURRENT: upload_protocol = jlink
Uploading .pio/build/pico/firmware.hex
SEGGER J-Link Commander V7.20 (Compiled Apr 28 2021 17:38:41)
DLL version V7.20, compiled Apr 28 2021 17:38:26J-Link Command File read successfully.
Processing script file…J-Link connection not established yet but required for command.
Connecting to J-Link via USB…O.K.
Firmware: J-Link EDU Mini V1 compiled Jun 7 2021 15:44:25
Hardware version: V1.00
S/N: 801032045
License(s): FlashBP, GDB
VTref=3.221V
Target connection not established yet but required for command.
Device “RP2040_M0_0” selected.Connecting to target via SWD
ConfigTargetSettings() start
J-Link script: ConfigTargetSettings()
ConfigTargetSettings() end
InitTarget() start
InitTarget() end
ConfigTargetSettings() start
J-Link script: ConfigTargetSettings()
ConfigTargetSettings() end
InitTarget() start
InitTarget() end
ConfigTargetSettings() start
J-Link script: ConfigTargetSettings()
ConfigTargetSettings() end
InitTarget() start
InitTarget() end
ConfigTargetSettings() start
J-Link script: ConfigTargetSettings()
ConfigTargetSettings() end
InitTarget() start
InitTarget() end
Cannot connect to target.Target connection not established yet but required for command.
Device “RP2040_M0_0” selected.
Connecting to target via SWD
ConfigTargetSettings() start
J-Link script: ConfigTargetSettings()
ConfigTargetSettings() end
InitTarget() start
InitTarget() end
ConfigTargetSettings() start
J-Link script: ConfigTargetSettings()
ConfigTargetSettings() end
InitTarget() start
InitTarget() end
ConfigTargetSettings() start
J-Link script: ConfigTargetSettings()
ConfigTargetSettings() end
InitTarget() start
InitTarget() end
ConfigTargetSettings() start
J-Link script: ConfigTargetSettings()
ConfigTargetSettings() end
InitTarget() start
InitTarget() end
Cannot connect to target.Script processing completed.
===================================== [SUCCESS] Took 6.23 seconds =====================================
After this second upload blinking LED is no more, and the serial port of the Pi Pico disconnects
cdc_acm 2-1.2:1.0: ttyACM0: USB ACM device
usb 2-1.2: USB disconnect, device number 20
It seems that the RP2040 has gone into a low power stupor and only a reset / power cycle will clear the problem, below are shown two pics of current been drawn 1) Actively blinking LED 2) In its stupor…
I’ve gone back to previous platformio posts and elsewhere on the Net, but the problem persists…