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

kw2xrf: adaption to netdev2 #5469

Closed
wants to merge 2 commits into from
Closed

kw2xrf: adaption to netdev2 #5469

wants to merge 2 commits into from

Conversation

jfischer-no
Copy link
Contributor

@jfischer-no jfischer-no commented May 27, 2016

This PR adapts the kw2xrf driver to netdev2 and adds new timer and test modes functionalities.
Also support for CR20A devices will be tested. WIP, not ready for review

depends on #5485, #5487

@jfischer-no jfischer-no added Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation State: WIP State: The PR is still work-in-progress and its code is not in its final presentable form yet Area: drivers Area: Device drivers labels May 27, 2016
@jfischer-no jfischer-no self-assigned this May 27, 2016
@miri64 miri64 assigned miri64 and unassigned jfischer-no May 30, 2016
@miri64
Copy link
Member

miri64 commented May 31, 2016

Needs rebase.

@miri64
Copy link
Member

miri64 commented Jun 2, 2016

Needs rebase and adaption to #4871.

@miri64
Copy link
Member

miri64 commented Aug 5, 2016

Sorry, another adaption needed: #5495. :/

uint32_t pc;
uint32_t* orig_sp;
uint32_t pc = 0;
uint32_t* orig_sp = NULL;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like an unrelated fix.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will/should be removed after rebase.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...when #5727 was merged

@miri64
Copy link
Member

miri64 commented Aug 30, 2016

There seems to be more than just moving to netdev2 here. Is it maybe possible to split this up in several PRs?

@miri64
Copy link
Member

miri64 commented Aug 30, 2016

(I know this is reflected in the description, but not in the title).

@smlng
Copy link
Member

smlng commented Sep 22, 2016

I'd like to test this one. Could you @jfischer-phytec-iot please rebase, and maybe adapt #5834.

Why is #5487 needed?

@jfischer-no
Copy link
Contributor Author

Why is #5487 needed?

to display actual CCA-Mode ...

@jfischer-no
Copy link
Contributor Author

@smlng rebased on #5487 and master, I have dropped #5834. The new driver may have some issues, e.g. state tracing, that appeared with the openthread package.

@smlng
Copy link
Member

smlng commented Sep 26, 2016

@jfischer-phytec-iot: I'm still testing this one. However, you somewhat changed the hardware adress generation, its basically reads backwards from what it was before. Any particular reason to do that? I labeled my nodes with their link-local address - changing the hardware address means changing the lladdr, too - hence, I would have to relabel all (~30) my nodes, which would be a little bit inconvenient 😬

@smlng
Copy link
Member

smlng commented Sep 26, 2016

I looked into the responsible code, but it looks the same as before. But still compiling with current master I get a different hwaddr (and lladdr) compared to this PR? Weird ...

@jfischer-no
Copy link
Contributor Author

However, you somewhat changed the hardware adress generation, its basically reads backwards from what it was before. Any particular reason to do that?

Yes, i changed it 😄 , sorry. Now, least significant bytes of LL references to the the least significant bytes of CPUID.

@smlng
Copy link
Member

smlng commented Sep 26, 2016

So you want to keep it that way, and I have to relabel my nodes? Well, then NACK 😁 ... No, I'm fine with it - I just have to remember it to not get confused, when this one is merged.

@smlng
Copy link
Member

smlng commented Sep 26, 2016

Ah, and could you please fix this conflict in auto_init_kw2xr.c in the meantime.

@smlng
Copy link
Member

smlng commented Sep 26, 2016

I ran some tests on this PR, I tried to ping a samr21-xpro, both running latest RIOT and gnrc_networking example; and I also tried to ping a RPi with Openlabs transceiver. Additionally, I had a network sniffer running on another RPi, these are the results:

  • ping6 pba-d-01-kw2x (netdev2) -> samr21-xpro: I see the ping request of kw2x on the sniffer and a subsequent ACK. Afterwards I see 4 ping replies for each ping request (3 retrans) by the samr21-xpro, but no ACKs by kw2x though the ACKreq flag is set by samr21-xpro. kw2x reports 100% packet loss, though sniffer sees all packets.
  • ping6 pba-d-01-kw2x (netdev2) -> RPi: I only see ping requests no reply by the RPi, result is again 100% packet loss. This might be due to the fact that linux drops all packet with INTRA-PAN flag false even though src and dst PAN are equal.

@jfischer-phytec-iot please set INTRA-PAN flag true if src and dst PAN are equal, see also #5684 and #5685. The latter might fix this already.

@smlng
Copy link
Member

smlng commented Sep 26, 2016

I applied #5685, now UDP send and recv works in both directions with samr21-xpro, pings still don't work same behavior as described above. Same for UDP with RPi: works in both directions. Ping6 does not work, from kw2x to RPi I see requests and replies, but kw2x still reports 100% packet loss. Ping from RPi to kw2x I see only ping requests on the sniffer but no reply by kw2x.

@smlng
Copy link
Member

smlng commented Nov 30, 2016

@jfischer-phytec-iot can we get this merged soon? Might be easier to do if not depending on #5487, please adapt/rebase accordingly. If you don't have time for this right now, I'm willing to overtake this PR and make necessary changes, if you don't mind?!

@jfischer-no
Copy link
Contributor Author

will be done today

@jfischer-no jfischer-no added CI: needs squashing Commits in this PR need to be squashed; If set, CI systems will mark this PR as unmergable and removed State: WIP State: The PR is still work-in-progress and its code is not in its final presentable form yet labels Dec 1, 2016
@smlng
Copy link
Member

smlng commented Dec 13, 2016

Is there consensus on this iwpan shell command stuff? If not, I would recommend to remove it; and even if so, I'd like to see this in a separate PR.

@miri64
Copy link
Member

miri64 commented Dec 14, 2016

@smlng: #5750

@miri64 miri64 added the State: waiting for other PR State: The PR requires another PR to be merged first label Dec 14, 2016
KW2XRF_IDLE,
KW2XRF_AUTODOZE,
}
kw2xrf_powermode_t;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

coding style: no newline required

* @brief Returns Timestamp of the actual received packet
*/
uint32_t kw2xrf_get_timestamp(kw2xrf_t *dev);
#ifdef __cplusplus
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add newline here

@@ -124,13 +142,16 @@ enum mkw2xdrf_dregister {
#define MKW2XDM_IRQSTS3_TMR3IRQ (1 << 2)
#define MKW2XDM_IRQSTS3_TMR2IRQ (1 << 1)
#define MKW2XDM_IRQSTS3_TMR1IRQ (1 << 0)
#define MKW2XDM_IRQSTS3_TMR_IRQ_MASK 0xfu
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(maybe) put in parentheses, and below, too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, is not necessary


#define MKW2XDM_PHY_CTRL1_TMRTRIGEN (1 << 7)
#define MKW2XDM_PHY_CTRL1_SLOTTED (1 << 6)
#define MKW2XDM_PHY_CTRL1_CCABFRTX (1 << 5)
#define MKW2XDM_PHY_CTRL1_RXACKRQD (1 << 4)
#define MKW2XDM_PHY_CTRL1_AUTOACK (1 << 3)
#define MKW2XDM_PHY_CTRL1_XCVSEQ_MASK 0x03u
#define MKW2XDM_PHY_CTRL1_XCVSEQ_MASK 0x07u
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

parentheses

@smlng
Copy link
Member

smlng commented Dec 14, 2016

@miri64 I still don't see that this PR must be based on (or wait for) #5750, I'd rather have this rebased without this dependency and merged quickly.

@jfischer-phytec-iot is it possible to rebase without #5750?

@jfischer-no
Copy link
Contributor Author

@jfischer-phytec-iot is it possible to rebase without #5750?

I will try it.

@smlng
Copy link
Member

smlng commented Dec 20, 2016

ping

1 similar comment
@miri64
Copy link
Member

miri64 commented Jan 10, 2017

ping

@PeterKietzmann
Copy link
Member

@jfischer-phytec-iot we'd like to remove the netdev1 interface after the release. Any chance you prepare this PR until middle of next week so @smlng can take over the netdev2 adoption part of this pr?

@jfischer-no jfischer-no removed the State: waiting for other PR State: The PR requires another PR to be merged first label Jan 16, 2017
return sizeof(netopt_state_t);
}

netopt_state_t _get_state(kw2xrf_t *dev)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be static, otherwise name clash with other drivers, e.g. at86rf233, see Jenkins log here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@PeterKietzmann
Copy link
Member

@jfischer-phytec-iot we would really much like to have this adoption a a part of the 2016.01 release so we can remove the obsolete netdev1 API. Is there any change that you squash all your commits until the afternoon???

@jfischer-no
Copy link
Contributor Author

@PeterKietzmann I will not make as long as checks are red

@smlng
Copy link
Member

smlng commented Jan 20, 2017

needs rebase again, that's why CI does not build

@jfischer-no jfischer-no removed the CI: needs squashing Commits in this PR need to be squashed; If set, CI systems will mark this PR as unmergable label Jan 20, 2017
@jfischer-no
Copy link
Contributor Author

I give up, that was the last drop:
drivers/kw2xrf/kw2xrf_intern.c:35: style (unreadVariable): Variable 'reg' is assigned a value that is never used.

@PeterKietzmann @smlng If anyone makes PR against this branch, I can merge and squash it, but I do not have time for this today.

/* Clear and disable all interrupts */
kw2xrf_write_dreg(dev, MKW2XDM_PHY_CTRL2, 0xff);
int reg = kw2xrf_read_dreg(dev, MKW2XDM_PHY_CTRL3);
reg |= MKW2XDM_PHY_CTRL3_WAKE_MSK | MKW2XDM_PHY_CTRL3_PB_ERR_MSK;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cppcheck actually is right. This variable is set, but never read again.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mhm, maybe a call is missing, in the current driver (kw2xrf.c) I found:

        /* Mask all possible interrupts */
        reg = kw2xrf_read_dreg(MKW2XDM_PHY_CTRL3);
        reg |= MKW2XDM_PHY_CTRL3_WAKE_MSK;
        kw2xrf_write_dreg(MKW2XDM_PHY_CTRL3, reg);

        kw2xrf_write_dreg(MKW2XDM_IRQSTS1, 0x7f);
        kw2xrf_write_dreg(MKW2XDM_IRQSTS2, 0x03);
        kw2xrf_write_dreg(MKW2XDM_IRQSTS3, 0xff);

so reg is written back to the register, that is missing here?!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah the following line

kw2xrf_write_dreg(dev, MKW2XDM_PHY_CTRL3, 0x03);

here actually 0x03 should be reg because MKW2XDM_PHY_CTRL3_WAKE_MSK | MKW2XDM_PHY_CTRL3_PB_ERR_MSK = 0x03 according to the defines.

so fixing this by either remove reg or better as 0x03 is some magic number with

kw2xrf_write_dreg(dev, MKW2XDM_PHY_CTRL3, reg);

should do

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will check squashed branch against backup

Adapt the kw2xrf driver for the netdev2 interface.
This patch also adds overwrites.h, the header provides overwrite
values for the kw2xrf PHY.
@smlng
Copy link
Member

smlng commented Jan 23, 2017

closing, superseded by #6453

@smlng smlng closed this Jan 23, 2017
@miri64 miri64 reopened this Jun 26, 2017
@miri64
Copy link
Member

miri64 commented Jun 26, 2017

Wanted to try something

@miri64 miri64 closed this Jun 26, 2017
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 Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants