[riot-users] Communicate two samr21-xpro Emcute example and gnrc_border_route example

Andy Rosete andyrosete17 at gmail.com
Mon Apr 24 23:55:15 CEST 2017


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: Imágenes integradas 1] [image: Imágenes integradas 2]
(gnrc_border_route)                                              (emcute
with the ip added)


if its executed ping6 command it can receive a response of gnrc example
[image: Imágenes integradas 3]

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: Imágenes integradas 4]

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;
}

--------------------------------------------------------------------------------------------------

thread_flag.c
thread_flags_t thread_flags_wait_any(thread_flags_t mask)
{
 *   thread_t *me = (thread_t*) sched_active_thread;*
    _thread_flags_wait_any(mask);
    thread_flags_t result = _thread_flags_clear_atomic(me, mask);
    return result;
}

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

Please is somebody know what do I need to do, I will appreciate a lot an
advice.
------------ próxima parte ------------
Se ha borrado un adjunto en formato HTML...
URL: <http://lists.riot-os.org/pipermail/users/attachments/20170424/acc0c1e5/attachment-0001.html>
------------ próxima parte ------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 247601 bytes
Desc: no disponible
URL: <http://lists.riot-os.org/pipermail/users/attachments/20170424/acc0c1e5/attachment-0004.png>
------------ próxima parte ------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 163310 bytes
Desc: no disponible
URL: <http://lists.riot-os.org/pipermail/users/attachments/20170424/acc0c1e5/attachment-0005.png>
------------ próxima parte ------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 198124 bytes
Desc: no disponible
URL: <http://lists.riot-os.org/pipermail/users/attachments/20170424/acc0c1e5/attachment-0006.png>
------------ próxima parte ------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 212259 bytes
Desc: no disponible
URL: <http://lists.riot-os.org/pipermail/users/attachments/20170424/acc0c1e5/attachment-0007.png>


More information about the users mailing list