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

driver xbee and uart #4731

Closed
l3nko opened this issue Feb 2, 2016 · 7 comments
Closed

driver xbee and uart #4731

l3nko opened this issue Feb 2, 2016 · 7 comments
Assignees
Labels
Area: drivers Area: Device drivers Area: network Area: Networking Platform: ARM Platform: This PR/issue effects ARM-based platforms Type: question The issue poses a question regarding usage of RIOT

Comments

@l3nko
Copy link

l3nko commented Feb 2, 2016

Hi, i'm testing the xbee driver with an arduino-due board.
The current driver for xbee not work with the board, the driver stop run at line 126 of xbee.c:
while (dev->resp_limit != dev->resp_count) { mutex_lock(&(dev->resp_lock)); }

The same configuration and board work with riot release 2015.09.

Maybe the problem is into uart driver, but I think the xbee driver need to have a timeout. Because now riot is locked and it not log any info to detect the problem.

@OlegHahm OlegHahm added Type: question The issue poses a question regarding usage of RIOT Platform: ARM Platform: This PR/issue effects ARM-based platforms Area: network Area: Networking Area: drivers Area: Device drivers labels Feb 2, 2016
Yonezawa-T2 added a commit to Yonezawa-T2/RIOT that referenced this issue Feb 4, 2016
Yonezawa-T2 added a commit to Yonezawa-T2/RIOT that referenced this issue Feb 4, 2016
Yonezawa-T2 added a commit to Yonezawa-T2/RIOT that referenced this issue Feb 4, 2016
@Yonezawa-T2
Copy link
Contributor

Created PR #4734.

Yonezawa-T2 added a commit to Yonezawa-T2/RIOT that referenced this issue Feb 4, 2016
@Yonezawa-T2
Copy link
Contributor

Following commits add extra debug outputs.

Yonezawa-T2@0b437f4
Yonezawa-T2@c16cd92

Set ENABLE_DEBUG and XBEE_ENABLE_DETAILED_DEBUG to 1.

You may also be interested in #4445 if you have other problems.

@l3nko
Copy link
Author

l3nko commented Feb 4, 2016

I've tried the driver with the arduino-due and it still fails, but I think is a problem of uart.
But the xbee driver not work perfectly:
xbee_init not fails if _api_at_cmd fails, at example if _get_addr_long return a value <0 xbee_init must fail, something like:

if(_get_addr_long(dev, dev->addr_long.uint8, 8) < 0) {
        DEBUG("xbee: Initialization failed\n");
        return -1;
}

At last, not log the debug info "xbee: response timeout" into isr_resp_timeout but move it into _api_at_cmd, because in the first case it run in another thread and it can't always print the debug.

@Yonezawa-T2
Copy link
Contributor

Created PR #4749.

@l3nko
Copy link
Author

l3nko commented Feb 10, 2016

Good, i've tested the new driver and it works as wanted.
I've noticed some other problems on xbee driver, in send function :

    dev->tx_buf[0] = API_START_DELIMITER;
    dev->tx_buf[4] = 0;         /* set to zero to disable response frame */
    /* set size, API id and address field depending on dst address length  */
    if (_is_broadcast(hdr)) {
        dev->tx_buf[1] = (uint8_t)((size + 5) >> 8);
        dev->tx_buf[2] = (uint8_t)(size + 5);
        dev->tx_buf[3] = API_ID_TX_SHORT_ADDR;
        dev->tx_buf[4] = 0xff;
        dev->tx_buf[5] = 0xff;
    }
    if (hdr->dst_l2addr_len == 2) {
        dev->tx_buf[1] = (uint8_t)((size + 5) >> 8);
        dev->tx_buf[2] = (uint8_t)(size + 5);
        dev->tx_buf[3] = API_ID_TX_SHORT_ADDR;
        memcpy(dev->tx_buf + 5, gnrc_netif_hdr_get_dst_addr(hdr), 2);
        pos = 7;
    }
    else {
        dev->tx_buf[1] = (uint8_t)((size + 11) >> 8);
        dev->tx_buf[2] = (uint8_t)(size + 11);
        dev->tx_buf[3] = API_ID_TX_LONG_ADDR;
        memcpy(dev->tx_buf + 5, gnrc_netif_hdr_get_dst_addr(hdr), 8);
        pos = 13;
    }
  1. in first if: tx_buf[4] is overwrite, destination short address is at index 5 and 6
  2. second if maybe it would be else if (hdr->dst_l2addr_len == 2)

Last question: destination long address how is obtained? because with my xbee it not matches.

@Yonezawa-T2
Copy link
Contributor

@l3nko

I've noticed some other problems on xbee driver, in send function :
Yes. See #4445.

Last question: destination long address how is obtained? because with my xbee it not matches.

I don't sure that I understand your question correctly. XBee use short address as its source address unless its short address is configured to 0xFFFF. This also fixed in #4445.

Yonezawa-T2 added a commit to Yonezawa-T2/RIOT that referenced this issue Mar 23, 2016
Yonezawa-T2 added a commit to Yonezawa-T2/RIOT that referenced this issue Mar 28, 2016
Yonezawa-T2 added a commit to Yonezawa-T2/RIOT that referenced this issue Apr 18, 2016
Yonezawa-T2 added a commit to Yonezawa-T2/RIOT that referenced this issue Apr 19, 2016
@kYc0o
Copy link
Contributor

kYc0o commented Apr 19, 2016

This issue can be closed, as #4445 has been merged.

@kYc0o kYc0o added this to the Release 2016.04 milestone Apr 19, 2016
@miri64 miri64 closed this as completed Apr 19, 2016
kYc0o added a commit that referenced this issue Apr 19, 2016
xbee: add timeout for AT command response (fixes #4731)
miri64 pushed a commit to miri64/RIOT that referenced this issue Apr 19, 2016
kYc0o added a commit that referenced this issue Apr 19, 2016
xbee: add timeout for AT command response (fixes #4731) (backport)
cgundogan pushed a commit to cgundogan/RIOT that referenced this issue Apr 20, 2016
lebrush pushed a commit to lebrush/RIOT that referenced this issue Jun 27, 2016
jia200x pushed a commit to jia200x/RIOT that referenced this issue Nov 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: drivers Area: Device drivers Area: network Area: Networking Platform: ARM Platform: This PR/issue effects ARM-based platforms Type: question The issue poses a question regarding usage of RIOT
Projects
None yet
Development

No branches or pull requests

5 participants