Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I can't use w5100 to work on Release-2020.04 by using RIOT/examples/emcute_mqttsn/. #14035

Closed
ouyangkan opened this issue May 6, 2020 · 15 comments
Labels
Area: network Area: Networking Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)

Comments

@ouyangkan
Copy link

ouyangkan commented May 6, 2020

Description

I test w5100 on example RIOT/examples/emcute_mqttsn/ .

This is the pid of my thread:

1. idle
2. main
3. ipv6
4. udp
5. w5100
6. emcute

I can use ping6 to ping my gateway. Below is the debug of RIOT-2020.04/core/msg.c. It was succesful.

msg_send: 2: Direct msg copy from 2 to 3.
msg_send: 3: Direct msg copy from 3 to 5.

But I can't use the con direction on shell cmd in examples/emcute_mqttsn.(con xxxx 10000)

[emcute] syncsend: sending round 0
msg_send() core/msg.c:108: Sending from 2 to 4. block=0 src->state=11 target->state=4
msg_send: 2: Direct msg copy from 2 to 4.
msg_send() core/msg.c:108: Sending from 4 to 3. block=0 src->state=11 target->state=4
msg_send: 4: Direct msg copy from 4 to 3.
_msg_receive: 3: _msg_receive.
_msg_receive: 3: _msg_receive(): No thread in waiting list.
_msg_receive(): 3: No msg in queue. Going blocked.
_msg_receive: 4: _msg_receive.
_msg_receive: 4: _msg_receive(): No thread in waiting list.
_msg_receive(): 4: No msg in queue. Going blocked.

This is the usage of vertion 2020.01 in the same case:
ping6 :

msg_send: 2: Direct msg copy from 2 to 3.
msg_send: 3: Direct msg copy from 3 to 5.

emcute:

msg_send: 2: Direct msg copy from 2 to 4.
msg_send: 4: Direct msg copy from 4 to 3.
msg_send: 3: Direct msg copy from 3 to 5.

Steps to reproduce the issue

1.using RIOT/examples/emcute_mqttsn/
2.change Makefile
1)BOARD ?= stm32f4discovery
2)# Add w5100 to use
USEMODULE += w5100
3.compile and burning

@ouyangkan ouyangkan changed the title I can't use net module like w5100 to work in Release-2020.04 by example. I can't use net module like w5100 to work on Release-2020.04 by example. May 6, 2020
@ouyangkan ouyangkan changed the title I can't use net module like w5100 to work on Release-2020.04 by example. I can't use w5100 to work on Release-2020.04 by using RIOT/examples/emcute_mqttsn/. May 7, 2020
@ouyangkan
Copy link
Author

ouyangkan commented May 8, 2020

I test it on BOARD ?= native

Expected results(RIOT-2020.01)

con xxxx::xxxx:xxxx:xxxx:xxxx  10000
msg_send() core/msg.c:105: Sending from 2 to 4. block=0 src->state=11 target->state=4
msg_send: 2: Direct msg copy from 2 to 4.
msg_send() core/msg.c:105: Sending from 4 to 3. block=0 src->state=11 target->state=4
msg_send: 4: Direct msg copy from 4 to 3.
queue_msg(): queuing message
_msg_receive: 3: _msg_receive.
index = 4
_msg_receive: 3: _msg_receive(): We've got a queued message.
_msg_receive: 3: _msg_receive(): No thread in waiting list.
msg_send() core/msg.c:105: Sending from 3 to 5. block=0 src->state=11 target->state=4
msg_send: 3: Direct msg copy from 3 to 5.
_msg_receive: 5: _msg_receive.
index = -1
_msg_receive: 5: _msg_receive(): No thread in waiting list.
_msg_receive(): 5: No msg in queue. Going blocked.
_msg_receive: 3: _msg_receive.
index = -1
_msg_receive: 3: _msg_receive(): No thread in waiting list.
_msg_receive(): 3: No msg in queue. Going blocked.

Actual results(RIOT-2020.04)

con xxxx::xxxx:xxxx:xxxx:xxxx  10000
msg_send() core/msg.c:113: Sending from 2 to 4. block=0 src->state=11 target->state=4
msg_send: 2: Direct msg copy from 2 to 4.
msg_send() core/msg.c:113: Sending from 4 to 3. block=0 src->state=11 target->state=4
msg_send: 4: Direct msg copy from 4 to 3.
_msg_receive: 3: _msg_receive.
index = -1
_msg_receive: 3: _msg_receive(): No thread in waiting list.
_msg_receive(): 3: No msg in queue. Going blocked.
_msg_receive: 4: _msg_receive.
index = -1
_msg_receive: 4: _msg_receive(): No thread in waiting list.
_msg_receive(): 4: No msg in queue. Going blocked.
msg_send() core/msg.c:113: Sending from 2 to 4. block=0 src->state=11 target->state=4
msg_send: 2: Direct msg copy from 2 to 4.
msg_send() core/msg.c:113: Sending from 4 to 3. block=0 src->state=11 target->state=4
msg_send: 4: Direct msg copy from 4 to 3.
_msg_receive: 3: _msg_receive.
index = -1
_msg_receive: 3: _msg_receive(): No thread in waiting list.
_msg_receive(): 3: No msg in queue. Going blocked.
_msg_receive: 4: _msg_receive.
index = -1
_msg_receive: 4: _msg_receive(): No thread in waiting list.
_msg_receive(): 4: No msg in queue. Going blocked.

I also tested gnrc_sock_udp, he also has no index, I do n’t know how to have index in _msg_receive.

@MrKevinWeiss MrKevinWeiss added Area: network Area: Networking Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) labels May 8, 2020
@ouyangkan
Copy link
Author

ouyangkan commented May 9, 2020

I modified gnrc_ep_set in RIOT-2020.04/sys/net/gnrc/sock/include/gnrc_sock_internal.h . Make it the same as the previous versions;

static inline void gnrc_ep_set(sock_ip_ep_t *out, const sock_ip_ep_t *in,
                               size_t in_size)
{
    memcpy(out, in, in_size);
    // if (gnrc_netif_highlander()) {
        /* set interface implicitly */
        gnrc_netif_t *netif = gnrc_netif_iter(NULL);
        printf("sock_internal: netif = %d\n", out->netif);

        if (netif != NULL) {
            out->netif = netif->pid;
            printf("sock_internal: netif = %d\n", out->netif);

        }
    // }
}

@MrKevinWeiss Now it is working normally. Excuse me, if I want to directly use whether to add some flag to make it pass judgment.

@MrKevinWeiss
Copy link
Contributor

I still think this still may be an issue. Maybe @jia200x or @miri64 can comment on this?

@miri64
Copy link
Member

miri64 commented May 12, 2020

Is xxxx::xxxx:xxxx:xxxx:xxxx a link-local address (starts with fe80::)?

@ouyangkan
Copy link
Author

Is xxxx::xxxx:xxxx:xxxx:xxxx a link-local address (starts with fe80::)?

Yes, I built MQTT broker on fe80::. And emcute_con to it.

@miri64
Copy link
Member

miri64 commented May 12, 2020

Then your real workaround should be appending the outgoing interface's ID using %: xxxx::xxxx:xxxx:xxxx:xxxx%<if_id>. I try to find out, what is wrong with the optimization in gnrc_ep_set though.

@miri64
Copy link
Member

miri64 commented May 12, 2020

Ah, easy: The app does not include -DGNRC_NETIF_SINGLE so highlander always returns NULL.

@miri64
Copy link
Member

miri64 commented May 12, 2020

So the workaround is the legit solution for your problem ;-).

@miri64
Copy link
Member

miri64 commented May 12, 2020

Grml... sock_udp_str2ep() does not parse that... let me fix that.

@miri64
Copy link
Member

miri64 commented May 12, 2020

(the workaround for now is to set GNRC_NETIF_SINGLE in the emcute example).

@ouyangkan
Copy link
Author

Thank you for your reply. It will be very helpful.

@miri64
Copy link
Member

miri64 commented May 12, 2020

With #14064 this is now also the case in master.

@miri64
Copy link
Member

miri64 commented May 12, 2020

Grml... sock_udp_str2ep() does not parse that... let me fix that.

I was looking at the asymcute code, rather than the emcute code, so this does not help you. But see #14068 for the fix.

@ouyangkan
Copy link
Author

ouyangkan commented May 13, 2020

I added -DGNRC_NETIF_SINGLE and deleted the previous one. Now my stm32 is working, Thanks a lot. 😄 👍

@miri64 miri64 closed this as completed May 13, 2020
@miri64
Copy link
Member

miri64 commented May 13, 2020

Then I guess your problem is fixed :-)

@miri64 miri64 added this to the Release 2020.07 milestone Jul 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: network Area: Networking Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)
Projects
None yet
Development

No branches or pull requests

3 participants