Can't get "mbed test" to work (sync failed)

14 May 2018

Hi,

I'm trying to get a test running on a Nucleo-L476RG dev board (osx 10.13, mbed-cli 1.4.0)

Here's what I did (from the command line):

setup a project with a library:

mbed new test_project
mbed new --library my_lib

add a library test:

mkdir -p my_lib/TESTS/TestGroup1/TestCase1

I added a test in my_lib/TESTS/TestGroup1/TestCase1/main.cpp copy pasted example from https://os.mbed.com/docs/v5.7/tools/testing-applications.html

compile and run test:

mbed -m NUCLEO_L476RG -t GCC_ARM test --compile
mbed test -m NUCLEO_L476RG -t GCC_ARM -n my_lib-tests-testgroup1-testcase1

When running the test, mbedgt copies the image to the board (led flashing), but fails with a "SYNC_FAILED".

Below is the output of "mbed test -m NUCLEO_L476RG -t GCC_ARM -n my_lib-tests-testgroup1-testcase1 -v"

It seems to me that the problem is that the application on the device is not sending anything back on the serial port. What could be wrong?

[mbed] Working path "/Users/martijn/Projects/test_project" (program)
[mbed] Exec "mbedgt --test-spec /Users/martijn/Projects/test_project/BUILD/tests/NUCLEO_L476RG/GCC_ARM/test_spec.json -n my_lib-tests-testgroup1-testcase1 -V" in /Users/martijn/Projects/test_project
mbedgt: greentea test automation tool ver. 1.3.3
mbedgt: test specification file '/Users/martijn/Projects/test_project/BUILD/tests/NUCLEO_L476RG/GCC_ARM/test_spec.json' (specified with --test-spec option)
mbedgt: using '/Users/martijn/Projects/test_project/BUILD/tests/NUCLEO_L476RG/GCC_ARM/test_spec.json' from current directory!
mbedgt: detecting connected mbed-enabled devices...
mbedgt: detected 1 device
	+---------------+----------------------+-------------------------+----------------------+--------------------------+
	| platform_name | platform_name_unique | serial_port             | mount_point          | target_id                |
	+---------------+----------------------+-------------------------+----------------------+--------------------------+
	| NUCLEO_L476RG | NUCLEO_L476RG[0]     | /dev/tty.usbmodem143233 | /Volumes/NODE_L476RG | 07650221623165685D75F330 |
	+---------------+----------------------+-------------------------+----------------------+--------------------------+
mbedgt: processing target 'NUCLEO_L476RG' toolchain 'GCC_ARM' compatible platforms... (note: switch set to --parallel 1)
	+---------------+----------------------+------------------------------+----------------------+--------------------------+
	| platform_name | platform_name_unique | serial_port                  | mount_point          | target_id                |
	+---------------+----------------------+------------------------------+----------------------+--------------------------+
	| NUCLEO_L476RG | NUCLEO_L476RG[0]     | /dev/tty.usbmodem143233:9600 | /Volumes/NODE_L476RG | 07650221623165685D75F330 |
	+---------------+----------------------+------------------------------+----------------------+--------------------------+
mbedgt: test case filter (specified with -n option)
	my_lib-tests-testgroup1-testcase1
	{u'my_lib-tests-testgroup1-testcase1': <mbed_greentea.tests_spec.Test instance at 0x103ba0170>}
	test filtered in 'my_lib-tests-testgroup1-testcase1'
mbedgt: running 1 test for platform 'NUCLEO_L476RG' and toolchain 'GCC_ARM'
	use 1 instance of execution threads for testing
mbedgt: checking for 'host_tests' directory above image directory structure
	'host_tests' directory not found: two directory levels above image path checked
mbedgt: selecting test case observer...
	calling mbedhtrun: mbedhtrun -m NUCLEO_L476RG -p /dev/tty.usbmodem143233:9600 -f "BUILD/tests/NUCLEO_L476RG/GCC_ARM/my_lib/TESTS/TestGroup1/TestCase1/TestCase1.bin" -d /Volumes/NODE_L476RG -c default -t 07650221623165685D75F330 -r default -C 4 --sync 5
mbedgt: mbed-host-test-runner: started
[1521456884.11][HTST][INF] host test executor ver. 1.3.1
[1521456884.11][HTST][INF] copy image onto target...
[1521456884.11][COPY][INF] Waiting up to 60 sec for '07650221623165685D75F330' mount point (current is '/Volumes/NODE_L476RG')...
[1521456896.84][HTST][INF] starting host test process...
[1521456896.85][CONN][INF] starting connection process...
[1521456896.85][CONN][INF] notify event queue about extra 60 sec timeout for serial port pooling
[1521456896.85][CONN][INF] initializing serial port listener...
[1521456896.85][PLGN][INF] Waiting up to 60 sec for '07650221623165685D75F330' serial port (current is '/dev/tty.usbmodem143233')...
[1521456896.85][HTST][INF] setting timeout to: 60 sec
[1521456897.47][SERI][INF] serial(port=/dev/tty.usbmodem143233, baudrate=9600, read_timeout=0.01, write_timeout=5)
[1521456897.48][SERI][INF] reset device using 'default' plugin...
[1521456897.88][SERI][INF] waiting 1.00 sec after reset
[1521456898.88][SERI][INF] wait for it...
[1521456898.88][SERI][TXD] mbedmbedmbedmbedmbedmbedmbedmbedmbedmbed
[1521456898.88][CONN][INF] sending up to 5 __sync packets (specified with --sync=5)
[1521456898.88][CONN][INF] sending preamble '2c945314-628c-4030-ae56-4b217cfe0a1d'
[1521456898.88][SERI][TXD] {{__sync;2c945314-628c-4030-ae56-4b217cfe0a1d}}
[1521456903.89][CONN][INF] resending new preamble 'aab015d5-aecc-4119-9029-538ef4f2bee4' after 5.01 sec
[1521456903.89][SERI][TXD] {{__sync;aab015d5-aecc-4119-9029-538ef4f2bee4}}
[1521456908.89][CONN][INF] resending new preamble 'ae059e22-4fc7-4076-8657-459e5fc59d4a' after 5.00 sec
[1521456908.89][SERI][TXD] {{__sync;ae059e22-4fc7-4076-8657-459e5fc59d4a}}
[1521456913.90][CONN][INF] resending new preamble 'fee31a08-007e-4866-bc5e-6148dfbf7ab6' after 5.00 sec
[1521456913.90][SERI][TXD] {{__sync;fee31a08-007e-4866-bc5e-6148dfbf7ab6}}
[1521456918.90][CONN][INF] resending new preamble 'c09522d6-1886-41a9-af90-304c86b42dc1' after 5.00 sec
[1521456918.90][SERI][TXD] {{__sync;c09522d6-1886-41a9-af90-304c86b42dc1}}
[1521456918.92][HTST][ERR] None
[1521456918.92][HTST][WRN] stopped to consume events due to __notify_sync_failed event
[1521456918.92][HTST][INF] __exit_event_queue received
[1521456918.92][HTST][INF] test suite run finished after 22.08 sec...
[1521456918.92][HTST][INF] CONN exited with code: 0
[1521456918.92][HTST][INF] No events in queue
[1521456918.92][HTST][INF] host test result() call skipped, received: sync_failed
[1521456918.92][HTST][WRN] missing __exit event from DUT
[1521456918.92][HTST][INF] calling blocking teardown()
[1521456918.92][HTST][INF] teardown() finished
[1521456918.92][HTST][INF] {{result;sync_failed}}
mbedgt: retry mbedhtrun 1/1
mbedgt: ['mbedhtrun', '-m', u'NUCLEO_L476RG', '-p', '/dev/tty.usbmodem143233:9600', '-f', u'"BUILD/tests/NUCLEO_L476RG/GCC_ARM/my_lib/TESTS/TestGroup1/TestCase1/TestCase1.bin"', '-d', '/Volumes/NODE_L476RG', '-c', 'default', '-t', u'07650221623165685D75F330', '-r', 'default', '-C', '4', '--sync', '5'] failed after 1 count
mbedgt: checking for GCOV data...
mbedgt: mbed-host-test-runner: stopped and returned 'SYNC_FAILED'
mbedgt: test case summary event not found
	no test case report present, assuming test suite to be a single test case!
	test suite: my_lib-tests-testgroup1-testcase1
	test case: my_lib-tests-testgroup1-testcase1
mbedgt: test on hardware with target id: 07650221623165685D75F330
mbedgt: test suite 'my_lib-tests-testgroup1-testcase1' ............................................... SYNC_FAILED in 35.18 sec
	test case: 'my_lib-tests-testgroup1-testcase1' ............................................... ERROR in 35.18 sec
mbedgt: test case summary: 0 passes, 1 failure
mbedgt: all tests finished!
mbedgt: shuffle seed: 0.0050083971
mbedgt: test suite report:
+-----------------------+---------------+-----------------------------------+-------------+--------------------+-------------+
| target                | platform_name | test suite                        | result      | elapsed_time (sec) | copy_method |
+-----------------------+---------------+-----------------------------------+-------------+--------------------+-------------+
| NUCLEO_L476RG-GCC_ARM | NUCLEO_L476RG | my_lib-tests-testgroup1-testcase1 | SYNC_FAILED | 35.18              | default     |
+-----------------------+---------------+-----------------------------------+-------------+--------------------+-------------+
mbedgt: test suite results: 1 SYNC_FAILED
mbedgt: test case report:
+-----------------------+---------------+-----------------------------------+-----------------------------------+--------+--------+--------+--------------------+
| target                | platform_name | test suite                        | test case                         | passed | failed | result | elapsed_time (sec) |
+-----------------------+---------------+-----------------------------------+-----------------------------------+--------+--------+--------+--------------------+
| NUCLEO_L476RG-GCC_ARM | NUCLEO_L476RG | my_lib-tests-testgroup1-testcase1 | my_lib-tests-testgroup1-testcase1 | 0      | 1      | ERROR  | 35.18              |
+-----------------------+---------------+-----------------------------------+-----------------------------------+--------+--------+--------+--------------------+
mbedgt: test case results: 1 ERROR
mbedgt: completed in 36.08 sec
mbedgt: exited with code 1
[mbed] ERROR: "mbedgt" returned error code 1.
[mbed] ERROR: Command "mbedgt --test-spec /Users/martijn/Projects/test_project/BUILD/tests/NUCLEO_L476RG/GCC_ARM/test_spec.json -n my_lib-tests-testgroup1-testcase1 -V" in "/Users/martijn/Projects/test_project"
---
14 May 2018

I'm now trying to get tests running on a NRF52_DK board.

I was able to get a test running as described above. But, when I tried adding a test to a project I was already working on, I got the SYNC errors again..?

same mbed-os version (5.8.4) same mbed-cli (1.5.0) same mbed-greentea (1.3.3) same mbed-host-tests (1.3.1)

When I have some more time, I'll try to see what's going over the serial line.

In the meantime, any ideas what might be wrong?

I tried changing the DAPLink configuration "auto reset" and "enable automation", but this doesn't make a difference...

10 Jan 2019

@ Martijn Sanderse,

I am using DISCO_L475VG_IOT01A board and trying to run the same test case and getting the same error

May i know what may be the reason?

Could you please suggest me the solution

11 Jan 2019

I finally found it, my usb hub was somehow interfering with the serial communication...

Upgrading to a decent usb hub did the trick.