Communicate two samr21-xpro Emcute example and gnrc_border_route example

Hi

I’m trying to communicate two devices (samr21-xpro) one of them with emcute (mqtt-sn) example and the gnrc_border_route example, but the con command of emcute example return TimeOut error.

I’ve added the ip of the gnrc_border_route example to emcute example

image.pngimage.png (gnrc_border_route) (emcute with the ip added)

if its executed ping6 command it can receive a response of gnrc example image.png

But when the con command is executed it return a TimeOut error (res= -4) (it say successfully connected but it must be a bug) image.png

After fill the code with debug lines i saw that the line that fail is thread_t me = (thread_t) sched_active_thread;

this code segment for example

emcute.c

static int syncsend(uint8_t resp, size_t len, bool unlock) { int res = EMCUTE_TIMEOUT; waiton = resp; timer.arg = (void )sched_active_thread; / clear flags, in case the timer was triggered last time right before the

  • remove was called / thread_flags_clear(TFLAGS_ANY); for (unsigned retries = 0; retries < EMCUTE_N_RETRY; retries++) { sock_udp_send(&sock, tbuf, len, &gateway); xtimer_set(&timer, (EMCUTE_T_RETRY * US_PER_SEC)); t***hread_flags_t flags = thread_flags_wait_any(TFLAGS_ANY); if (flags & TFLAGS_RESP) { xtimer_remove(&timer); res = result; retries = EMCUTE_N_RETRY; }

}

/* cleanup sync state */ waiton = 0xff; if (unlock) { mutex_unlock(&txlock); } DEBUG(“The final result = %d\n”, res); return res; }

Hi Andy,

After fill the code with debug lines i saw that the line that fail is *thread_t *me = (thread_t*) sched_active_thread;*

That line basically cannot fail(tm). What do you mean by "the line fails"?

this code segment for example

emcute.c static int syncsend(uint8_t resp, size_t len, bool unlock) { [...]       * t**hread_flags_t flags = thread_flags_wait_any(TFLAGS_ANY);*

[...]

because it try to inittialize the thread pointer but the flag is always different if (flags & TFLAGS_RESP)

The values are: The flag = 0x00000002 (This mean TIMEOUT) and TFLAGS_RESP = 0x00000001

What do you mean by "the flag is always different"? Does it have a value other than TIMEOUT or TFLAGS_RESP?

Could you please check the output of the "ps" command after "con" fails? Just to rule out a stack overflow.

Kaspar