Closed Josar closed 6 years ago
I have not seen this issue, so let me ask a few questions to be sure I understand. I assume the issue is with gcoap acting as a server, where the request is a GET for /.well-known/core.
Do you have the CLI installed? If so, send a GET for /cli/stats to gcoap. You should receive a payload with an integer encoded as a string in response.
At what point do you see the -EPROTO UDP response -- when gcoap attempts to send its response?
Have you defined any CoAP resources for the server?
Do you see the same results when the gcoap server runs on Linux native?
My setup is as follows.
RasperryPi with openlabs radio. Jiminy Xmega board, atXmega256a3u with atmel at86rf233.
When i run the gcoap example a can receive the values with the rpi. So yes gcoap as server.
As soon as i compile gcoap.c for the xmega without debug there seems some variables which are not properly initialized but where zeroed when used with debug.
The packet is send from the rpi and received from xmeega but it does not pass sock_udp_recv.
with debug enabled the values which are checked are as follows
Address Format specified unspecified 0, Format 0
Port 0 != 33085
IP good ipv6_addr_unspecified: 0
IP good tmp.addr: 1
without
Address Format specified unspecified 1, Format -29115
Port 41 != 33630
IP good ipv6_addr_unspecified: 1
IP good tmp.addr: 1
Running gcoap as client is not working out of the box but there was no time and need to test this, yet. But it most probably has something todo with the upper layer not receivign the answer, as well. As the receiver again gets the answer from the rpi.
Thanks for the additional information. The immediate problem is that the values in sock->remote are not zeroed out. sock->remote is always zeroed at gcoap startup. Specifically, gcoap_init() starts the gcoap thread, which runs _event_loop(). This function calls sock_udp_create(), which zeroes sock->remote.
So, it looks like the problem is a matter of overwriting rather than initialization. I wonder if the stack size on this board is an issue. GCOAP_STACK_SIZE is defined in gcoap.h, and includes extra space if debug is enabled. Does increasing GCOAP_STACK_SIZE work around the problem?
@Josar did you try @kb2ma suggestions?
I think GCOAP_STACK_SIZE
was the problem.
Hello I got an strange behavior when compiling the gcoap example. Maye someone has an idea.
I run Riot on an atxmega256a3u with an at86rf233.
When I compile with ENABLE_DEBUG (1) tin gcoap.c then everything works as expected and I am able to get .well-known/core information from the node. But when I disable debug I always get the error -EPROTO from gnrc_sock_udp.
Which checks
With debug:
Without Debug:
So the question is where are these values assigned to the sock, so I can investigate this further. And what could cause this strange behavior.
Thanks in advance Josua Arndt
Answer from the mailing list:
Description
Steps to reproduce the issue
Run gcoap example without debug.
Expected results
With debug enabled and debug dsiabled answering coap request should work.
Actual results
Does not.
Versions
Riot on atxmega256a3u with an at86rf233. RPI with openlabs transceiver and libcoap.