I’m trying to debug the above in PIO hosted by VSCode. I can upload a sketch and have it run, but debugging fails on a number of things and I’ve got to the point where I think it should work, but don’t know where to look to work out what I’ve done wrong…
I should mention I’m a noob at embedded development, but have tons of C/C++, Java etc.
So,
I’ve soldered leads to the 5 pads on the underside of the board and got them plugged into the jlink according like this.
I have a pio.init like this
[env:nano_33_iot]
platform = atmelsam
board = nano_33_iot
framework = arduino
upload_protocol = jlink
debug_tool = jlink
And a sketch like this:
#include <Arduino.h>
int i = 0;
void setup() {
Serial.begin(9600);
while (!Serial);
Serial.println(“Ready to start counting”);
}void loop() {
if (i < 1000) {
Serial.println(i++);
}
}
I set a breakpoint at println immediately after the while, but when I run debug and F5 from the initial breakpoint the program stops at the
while(!Serial)
and I see
Program
received signal SIGTRAP, Trace/breakpoint trap.
0x000005f4 in ?? ()
If F5 from there, I get another SIGTRAP and am at the same place on the while. That’s as far as it gets.
When I look at the device monitor there’s nothing shown.
— Available ports:
— Enter port index or full name:
When I upload the sketch I can see a com port.
— More details at Redirecting...
— Miniterm on COM6 9600,8,N,1 —
— Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H —
I’ve checked the soldering and my pin connections several times but apart from that, what have I missed???