First week of trying to get my head round platformio and VScode. I’m using a segger J-link to flash a teensy 3.6, with the hope of being able to use the j-link as a debugger.
I have successfully flashed code onto the board using a template project someone had made for segger embedded studio ide, which confirmed the hardware and connections. I’d like to use platformio and vsCode instead of the segger ide.
I have the same simple test script which I successfully uploaded with the segger ide and it builds successfully in platformio, but won’t upload.
It see’s the jlink connection over usb and seems to read the target reference voltage but for some reason is unable to connect?
My Hardware connections from the teensy board to j-link are …
3.3V to pin 1 (VTref)
Reset to pin 15 (RESET)
G to pin 4 (GND)
DE to pin 6 (GND)
DD to pin 7 (TMS)
DC to pin 9 (TCK)
Here’s my platformio.ini settings …
[env:teensy36]
platform = teensy
board = teensy36
framework = arduino
debug_tool = jlink
; SWD interface
upload_protocol = jlink
; JTAG interface
upload_protocol = jlink-jtag
… and the terminal output upon upload attempt
> Executing task in folder turn: platformio run --target upload <
Processing teensy36 (platform: teensy; board: teensy36; framework: arduino)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/teensy/teensy36.html
PLATFORM: Teensy 4.8.0 > Teensy 3.6
HARDWARE: MK66FX1M0 180MHz, 256KB RAM, 1MB Flash
DEBUG: Current (jlink) External (jlink)
PACKAGES:
- framework-arduinoteensy 1.151.0 (1.51)
- tool-jlink 1.65200.0 (6.52.0)
- tool-teensy 1.151.0 (1.51)
- toolchain-gccarmnoneeabi 1.50401.190816 (5.4.1)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 92 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <Audio> 1.3
| |-- <SerialFlash>
| | |-- <SPI> 1.0
| |-- <SPI> 1.0
| |-- <Wire> 1.0
| |-- <SD> 1.2.2
| | |-- <SPI> 1.0
|-- <SerialFlash>
| |-- <SPI> 1.0
|-- <Wire> 1.0
|-- <SD> 1.2.2
| |-- <SPI> 1.0
|-- <SPI> 1.0
Building in release mode
Linking .pio/build/teensy36/firmware.elf
Building .pio/build/teensy36/firmware.hex
Checking size .pio/build/teensy36/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM: [ ] 3.7% (used 9776 bytes from 262144 bytes)
Flash: [ ] 1.7% (used 18264 bytes from 1048576 bytes)
Configuring upload protocol...
AVAILABLE: jlink, jlink-jtag, teensy-cli, teensy-gui
CURRENT: upload_protocol = jlink-jtag
Uploading .pio/build/teensy36/firmware.hex
SEGGER J-Link Commander V6.52 (Compiled Sep 27 2019 17:51:12)
DLL version V6.52, compiled Sep 27 2019 17:51:01
J-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 V11 compiled Apr 16 2020 17:17:32
Hardware version: V11.00
S/N: 261003007
License(s): FlashBP, GDB
OEM: SEGGER-EDU
VTref=3.328V
Target connection not established yet but required for command.
Device position in JTAG chain (IRPre,DRPre) <Default>: -1,-1 => Auto-detect
Device "MK66FX1M0XXX18" selected.
Connecting to target via JTAG
InitTarget()
Connect Under Reset
Connect Under Reset
InitTarget()
Connect Under Reset
Connect Under Reset
****** Error: InitTarget(): PCode returned with error code -1
InitTarget()
Connect Under Reset
Connect Under Reset
InitTarget()
Connect Under Reset
Connect Under Reset
****** Error: InitTarget(): PCode returned with error code -1
Cannot connect to target.
Target connection not established yet but required for command.
Device "MK66FX1M0XXX18" selected.
Connecting to target via JTAG
InitTarget()
Connect Under Reset
Connect Under Reset
InitTarget()
Connect Under Reset
Connect Under Reset
****** Error: InitTarget(): PCode returned with error code -1
InitTarget()
Connect Under Reset
Connect Under Reset
InitTarget()
Connect Under Reset
Connect Under Reset
****** Error: InitTarget(): PCode returned with error code -1
Cannot connect to target.
Target connection not established yet but required for command.
Device "MK66FX1M0XXX18" selected.
Connecting to target via JTAG
InitTarget()
Connect Under Reset
Connect Under Reset
InitTarget()
Connect Under Reset
Connect Under Reset
****** Error: InitTarget(): PCode returned with error code -1
InitTarget()
Connect Under Reset
Connect Under Reset
InitTarget()
Connect Under Reset
Connect Under Reset
****** Error: InitTarget(): PCode returned with error code -1
Cannot connect to target.
Script processing completed.
=========================================================================== [SUCCESS] Took 17.89 seconds ===========================================================================
Terminal will be reused by tasks, press any key to close it.