I have been trying to test PlatformIO on Ubuntu 64 with an nRF52 DK using the mbed framework. I think I have installed all of the command line tools and the VSCode based IDE. All of which seem to work.
My test program is a simple blinky with the following main.cpp:
#include <mbed.h>
DigitalOut led1(P0_17);
// main() runs in its own thread in the OS
int main() {
while (true) {
led1 = !led1;
wait(0.1);
}
}
Yes, the nRF52-DK appears as a media disk. You can flash the drive by copying the firmware.hex file to the folder. Does that interfere with the PlatformIO upload method?
Having the trailing / on the upload port looks wrong - /dev/ttyACM0 should be a dynamically created device node, not a directory. What do you get if you execute the following command in the shell:
platformio run -t upload --upload-port /media/paul/JLINK
The build ends with this:
Checking program size
text data bss dec hex filename
8892 256 53256 62404 f3c4 .pioenvs/nrf52_dk/firmware.elf
Building .pioenvs/nrf52_dk/userfirmware.hex
Building .pioenvs/nrf52_dk/firmware.hex
Looking for upload disk…
Use manually specified: /media/paul/JLINK
Uploading .pioenvs/nrf52_dk/firmware.hex
*** [upload] /media/paul/JLINK/firmware.hex: No such file or directory
[ERROR] Took 5.05 seconds
I have removed the manually installed v3.4.1 PIO Core now. Now there is only v3.5.1a1 installed with the VSCode PlatformIO. Now when I run pio device list --logical in the built in terminal I get:
When the nRF52-DK is plugged in it appears in the Dolphin devices list automatically, but unmounted, as JLINK. The PlatformIO Devices tab in the VSCode plugin correctly identifies the device as:
/dev/ttyACM0 J-Link - CDC USB VID:PID=1366:1015 SER=000682902707 LOCATION=3-3:1.0
Upload still fails as before.
If I set ‘upload_port = /media/paul/JLINK’ in platformio.ini it also fails as before. Then if I manually open the mount point using the Dolphin file manager and upload with upload_port set to /media/paul/JLINK it works! However, I think this is a sub-optimal process as we should not have to manually coerce the mounting process to be able to upload.
This is a serial port… We can use it only if the board is pre-flashed with special bootloader…
I see that this board has on-board J-Link debugger. We can use it for debugging and programming. Does PIO+VSCode work for this board in debugging mode?