driver/kw2xrf: added ng_netdev implementation for the Freescale kw2x radio#2756
driver/kw2xrf: added ng_netdev implementation for the Freescale kw2x radio#2756OlegHahm merged 2 commits intoRIOT-OS:masterfrom
Conversation
|
This driver (same is true for the Atmel AT86RF2xx driver) has a fundamental design flaw. In the current form it is NOT possible to use this driver on a shared SPI bus. Reason: The driver does an SPI transfer in interrupt context -> see On top of that, this implementation is calling a So for the Atmel driver I started to solve it for now by removing the @gebart @thomaseichinger @jfischer-phytec-iot @jremmert-phytec-iot : Any ideas how we could proceed with this? @jremmert-phytec-iot: otherwise the driver looks good to me, will test when I am back in Office in two weeks.... |
|
I had exactly this problem during my tests of the csma mac layer, this led to unexpected behaviour. The problem is "solved" in the same way you are doing in the atmel driver.
Currently I see the following solutions:
If I understood it correctly, the mechanism used in the Linux Kernel implementation of the AT86RF2xx drivers is not really comparable to our problem. They trigger the SPI interaction in the ISR; the interaction is then requested and queued; ISR context ends here. If the interaction is ready, a callback function is invoked. |
This is true for the kw22, and if we only use a single thread to talk to
This method can still miss deadlines for ack packets of you take too long
I suggest using a thread with a higher priority to handle the radio and its Btw, how is the priority inversion handled by RIOT when a lower priority |
|
Sounds good. In case of an ongoing SPI interaction on the low prio task it would behave like 3 (see former post), correct? The higher prio task gets runnable for a short time, tries to aquire SPI access which should fail and goes to TASK_BLOCKED-state until the SPI is released respectively the low prio task is ready. I will test this next week. |
|
Introduced an irq-worker thread that runs the spi-transaction in thread-context. A first test worked well, but I will test this in more detail later the day. In the first run I have chosen a stack-size of 128byte, which leads to isr-hard fault. Now it is running with 256byte. |
|
i think the additional spi-worker-thread is not the way to go. I think i introduces too much overhead -> we need one additional task switch when receiving packets for example, and this we should try to work around. Also this approach is quite expensive in terms of memory usage. However, I have not come up with a clear idea of how to handle the spi problem. I will spend some time on the Atmel radio and see if I have better ideas... |
|
Hi guys. I opened issue #2769 as I think this is a general discussion not only concerning this PR. Please correct/extend the issue if necessary and move the discussion to that place if this if ok for you. Also (if we won't find a solution quickly) I guess we could further this PR with the "exclusive-access-method" and improve the driver when a good solution is available. What do you think? |
|
Hi Peter, thats a good idea! |
0f19a72 to
0db0145
Compare
|
Reverted the irq-worker thread. Will now wait for @haukepetersen to udpate the Atmel driver and adapt this accordingly. Short guide what is needed to test this:
|
c91f5aa to
eaf8d6f
Compare
|
@haukepetersen @kaspar030 How to handle the initialization of this one? I have not proceed to implement the initialization process, since #2901 appeared. Moreover do we need a seperate test function for each driver or will there be one for all netdev drivers. In my eyes the initialization process needs some rework to make it board independent. Excepting this issue this driver should be close to be ready. I have not seperated the netdev-stuff from the non-netdev stuff as in the atmel driver. What do you think? Is the seperation mandatory or can we merge this first and postpone the separation? |
drivers/kw2xrf/kw2xrf.c
Outdated
There was a problem hiding this comment.
Since you're only using the first byte anyway, why not !=?
There was a problem hiding this comment.
_set_tx_power() is called from _set(netdev-option) which receives an 16bit variable, accordingly the value_len of *val is 2. But to be consistent with the atmel driver I will move this check directly to the netconf_option setter and check for <sizeof(uint16_t)
|
Sure, I changed |
@authmillenon, that's not required for the nameless stack any more anyway, right? |
Makefile.dep
Outdated
There was a problem hiding this comment.
This still seems tautological.
There was a problem hiding this comment.
you mean, because this is already added in the auto-init mechanism? But the atmel-driver also includes this here.
There was a problem hiding this comment.
I mean that this creates a dependency from A to A. The Atmel driver maps from a wild card (2%%) to 2xx.
There was a problem hiding this comment.
Oh true, will remove
|
Okay for squashing. |
squash: removed tab indent
|
squashed and rebased |
|
Is preloading actually supported by this driver? Couldn't find the function. |
|
Yes, preloading is supported. The flag will be set here: Before sending, this flag is checked: |
squash: driver: fixed typo to pass doccheck squash: driver: bug fixes after test squash: adapted Makefiles for correct build behaviour restructured, no spi interaction in isr anymore major bugfixes and restructurization comments addressed introduce new netconf option, ..AUTOCCA squash: minor bugfix and add auto-init mechanism squash: minor fixes to make travis happy
|
Sorry, might be that I'm a bit confused right now, but what do I have to call to load data in the buffer and what do I have to call to trigger the immediate sending? |
|
To send data using the netdev-if and preloading:
Send data out immediately:
|
|
Ah, thanks for explanation. I wasn't aware of this mechanism. |
|
How do I need to configure the test to run with the pba-d-01-kw22? |
|
Sorry, had a shaky hand... |
|
You can find a branch on Johann´s git-repository: https://github.com/jfischer-phytec-iot/RIOT/tree/wip%40mkw2xd%2Bauto-init
|
|
Thanks. I cannot always receive on the IoT-LAB M3, but this seems in general a bit flakey. ACK |
|
Travis failed on native because of coap test app: This seems totally unrelated, any idea why this failed? When I try this manually, it builds the coap app. |
|
I guess it is unrelated. Kicked Travis. |
|
Thanks, since Travis is happy now we can merge this? @OlegHahm who is intendet to do that? I have no merging priviledges. |
|
I can and will do. |
driver/kw2xrf: added ng_netdev implementation for the Freescale kw2x radio
|
And Congrats to your first commits that went into upstream RIOT! 🎆 |
|
🎆 🎉 🎆 🎉 🎆 🎉 |
|
Very cool! Thanks for reviewing! |
This pr replaces #2329 and implements the driver for the new ng_netdev interface. The transceiver interface is not supported anymore in this pr.
Driver can be used for all version of the Freescale kw2x SiP and maybe for future Devices.
Current Status:
Initialization and test is not board independent.