SigFox MKR1200 Unit Testing - If you don't see any output for the first 10 secs, please reset board


I’m using VSC with PlatformIO extension installed running on macOS 10.14.5.

I’ve been following the Unit Testing Tutorial here:

Ran it on a uno board all ok, then decided to use the SigFox MKR1200 board I have as that is going to be my target device moving forward.

The main & test_main.cpp have remained the same, but I have modified my platformIO.ini file to include the environment for the MKR1200, added the lines below:

platform = atmelsam
board = mkrfox1200
framework = arduino

Project builds and appears to upload to the board ok, when the upload finishes, I get the “Available ports” prompt and only see the Bluetooth Port, not the serial port I would expect (/dev/cu.usbmodem4112401). I can enter the port’s full name and all seems ok.

If I then run, ‘platformio test -e mkrfox1200 --verbose’ everything seems to build and then upload ok, then the [test/*] Testing… starts and nothing happens. I just get:

If you don’t see any output for the first 10 secs, please reset board (press reset button)

If I reset the board nothing happens.


$ pio device list
Hardware ID: n/a
Description: n/a

Hardware ID: USB VID:PID=2341:8050 SER=46F9A11D5150484735202020FF0C3220 LOCATION=65-1.2.4
Description: Arduino MKRFox1200

I have also tried updating the platformIO.ini file with the following:

test_port = /dev/cu.usbmodem4112401
test_speed = 9600

This gives an error that there is no such file??

=============== [test/] Testing… (3/3) ============*
If you don’t see any output for the first 10 secs, please reset board (press reset button)

[Errno 2] could not open port /dev/cu.usbmodem4112401: [Errno 2] No such file or directory: ‘/dev/cu.usbmodem4112401’
======================== [TEST SUMMARY] ==============

test/ > mkrfox1200 [FAILED]*
================= [FAILED] Took 12.83 seconds ==============

I also removed the port speed, so that it took the default value of 115200, but to no avail?

When the test is running and I connect to the serial port using “Serial Monitor”… I see the following looping through the terminal constantly:

11 Tests 1 Failures 0 Ignored

11 Tests 1 Failures 0 Ignored

Am I missing something obvious with this??

With this board, is there a delay between it being reset and the USB port being detected? Since it’s SAMD21 based, I’m guessing there is… hence why it’s not being detected immediately after programming/uploading, and during the unit testing… I’m sure I saw some mention of how to add a bit of a delay somewhere…

Ok, this isn’t it… but it is one way to basically add a delay after uploading…

“With this board, is there a delay between it being reset and the USB port being detected? Since it’s SAMD21 based, I’m guessing there is…”

How do I confirm this / check?

I tried using the extra_scripts answer mentioned in the other post, which is being run, as I can see the comment “Delay while uploading” output ok… but I still get a hang on the testing results?!?

There is also a delay in the setup() of my test_main.cpp for 2000ms?

Tweaked the timings a little… the extra_script method now has a 5s delay, and also 5000ms delay in the test_main.cpp and it seems to work ok now!!!


def after_upload(source, target, env):
    print "Delay while uploading..."
    import time
    print "Done!"

env.AddPostAction("upload", after_upload)

And also setup() in test_main.cpp here…

void setup() {
    // NOTE!!! Wait for >2 secs
    // if board doesn't support software reset via Serial.DTR/RTS



Thanks! :slight_smile:

1 Like

Great! I was going to say try taking it out to 5-6 seconds… on linux, I’d be saying run dmesg, and see how long it takes from plugin to device being ready… on windows, you can open the device manager and see when the device appears… not sure the Mac equivalent. Nice to know that workaround still works! :slight_smile:

Oh, btw… I just spotted the other method I was thinking of… so just linking that post here for completeness… edit: and as you’ll see if below, it is of no help here. :open_mouth:

Hmm… I removed the 5000ms delay I added and changed in the settings to 5000ms, all works :slight_smile:

So I then changed in the settings to be 2000ms, and re ran the test expecting it to fail, but it worked.

My setup isn’t quite the same right now, I’m running this directly to the USB3 port on my mac, previously I was using it connect to a hub connect to a monitor connected to my laptop so maybe there was some delay there that was causing the errror?

When I get home I will test again and try to recreate the problem and see what happens.

I forgot about the python script being called in the platfromIO.ini!

I removed the delay here and it broke, I then changed the json settings, back to 5000ms and again it didn’t work.

I think the only effective delay that seems to make this work on this board is the python script being called from platformIO.ini file when set to 5s.

1 Like

lol… ok, that at least means the original solution is still the right one… maybe that only works if the serial monitor was open… after… the configuration option says reopen delay…

Thanks for trying it out! :slight_smile: