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

drivers/nrf24l01+ : added netdev implementation for nrf24l01+ transceiver #1808

Closed

Conversation

PeterKietzmann
Copy link
Member

This PR is based on #1704. It contains a connection between the lowlevel part for the nrf24l01+ transceiver-driver and the netdev interface. I assume there will be several deficits, especially because this device fulfills no standard. So let's discuss this!

@PeterKietzmann PeterKietzmann added State: WIP State: The PR is still work-in-progress and its code is not in its final presentable form yet Type: new feature The issue requests / The PR implemements a new feature for RIOT Discussion: RFC The issue/PR is used as a discussion starting point about the item of the issue/PR Area: drivers Area: Device drivers labels Oct 13, 2014
void print_register(char reg, int num_bytes);

#define STATIC_RX_BUF_SIZE 128
static char static_rx_buf[STATIC_RX_BUF_SIZE];
Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe this static receive-buffer can be replaced by the "global packet buffer" in future?

Copy link
Member

Choose a reason for hiding this comment

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

It should. Otherwise it's no use ;-)

@miri64
Copy link
Member

miri64 commented Oct 13, 2014

I don't have time for a in-depth review right now, but things I've spotted so far:

  • add your device to drivers/include/netdev/default.h
  • would it be possible to replace your test application with a slight adaption of tests/netdev? Test applications for every device even though we have a general interface seem a little overkill for me.
  • Further stuff are line comments…

*
* @detail Sends any frames, handled internal.
*/
NETDEV_PROTO_PROPRIETARY = 0x0008,
Copy link
Member

Choose a reason for hiding this comment

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

Why is it up here? Setting this value to 8 but leaving the lower values below makes the code harder to read, I think.

Copy link
Member

Choose a reason for hiding this comment

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

Also: this name is pretty arbitrary. Should other proprietary protocols also use this protocol type? If yes, what good does this information make? The idea of this type definition was to give a higher layer an idea of what to expect from the device or protocol layer (sorry if this was not clear from the documentation) and just saying "this is basically a black box, deal with it" is not very helpful and opens the door to future device driver development just using this flag.

A better name would be NETDEV_PROTO_NRV24L01X (X for +), I guess. We have room for at least 65536 different protocols here, so don't be shy to be specific. ;-)

#ifndef __REGS_H
#define __REGS_H

#define INITIAL_ADDRESS_WIDTH 5
Copy link
Contributor

Choose a reason for hiding this comment

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

tabs in the middle of the line

@PeterKietzmann
Copy link
Member Author

@authmillenon, I started using my implementation with the tests/netdev. Especially for the address setting there are some specialities, if you remember out last (private) mails. So as we don't want to increase the numer of tests, you think it's a reasonable solution to use #ifdef MODULE_NRF24L01p inside the application code to select/unselect the specific parts? Or what was in you mind when you said "replace your test application with a slight adaption of tests/netdev"

#endif /* NETDEV_DEFAULT */
#endif /* MODULE_NATIVENET */
#endif /* MODULE_NRF24L01P */
Copy link
Member

Choose a reason for hiding this comment

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

Hey!! :(

diff --git a/drivers/include/netdev/default.h b/drivers/include/netdev/default.h
index 50d4983..d044a93 100644
--- a/drivers/include/netdev/default.h
+++ b/drivers/include/netdev/default.h
@@ -36,4 +36,12 @@
 #endif /* NETDEV_DEFAULT */
 #endif /* MODULE_NATIVENET */

+#ifdef MODULE_NRF24L01P
+#include "nrf24l01p.h"
+
+#ifndef NETDEV_DEFAULT
+#define NETDEV_DEFAULT   ((netdev_t *)(&nrf24l01p_netdev))
+#endif /* NETDEV_DEFAULT */
+#endif /* MODULE_NRF24L01P */
+
 #endif /* __NETDEV_DEFAULT_H_ */

@PeterKietzmann PeterKietzmann force-pushed the add_nrf24l01p_netdev branch 2 times, most recently from 8dd9e0a to 235e09d Compare October 21, 2014 15:43
@PeterKietzmann
Copy link
Member Author

I adapted the driver and the netdev-test so one can use them together

@PeterKietzmann
Copy link
Member Author

Some tests failed for stm32f4discovery board. Any ideas why? Is this maybe because I introduced the feature transceiver for this board?

@LudwigKnuepfer
Copy link
Member

It does not make sense add the transceiver feature to the board if the transceiver is not part of the board itself.

@PeterKietzmann
Copy link
Member Author

Where else can I put it instead? Because transceiver is a required feature for the netdev-test.

@LudwigKnuepfer
Copy link
Member

That is a conceptional problem. I'll think about it. Maybe @Kijewski wants to do the same.

@@ -849,7 +860,7 @@ static int send_packet(void)
}

puts("");

Copy link
Member

Choose a reason for hiding this comment

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

trailing whitespace

uint32_t address = NETDEV_TEST_ADDRESS;
int res = dev->driver->set_option(dev, NETDEV_OPT_ADDRESS,
&address, sizeof(uint32_t));
#else
Copy link
Member

Choose a reason for hiding this comment

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

Your driver should handle the case of smaller values, not the application.

Copy link
Member Author

Choose a reason for hiding this comment

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

I thought we agreed having 4 bytes is fine? What didn't I understand?

Copy link
Member

Choose a reason for hiding this comment

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

If a user sets the option with a 1 byte (or 2 byte, 3 byte maybe but this is ridiculous :-D) number this should be excepted. If the address is 4 byte long in fact only the lowest byte is set [edit] from the 1 byte number and the rest is 0.

@LudwigKnuepfer
Copy link
Member

@PeterKietzmann #1879 got merged, rebase and refer to it for usage.

@OlegHahm OlegHahm added the Community: Hack'n'ACK candidate This PR is a candidate for review and discussion during one of RIOT's monthly Hack'n'ACK parties label Jan 6, 2015
@PeterKietzmann PeterKietzmann removed Community: Hack'n'ACK candidate This PR is a candidate for review and discussion during one of RIOT's monthly Hack'n'ACK parties Discussion: RFC The issue/PR is used as a discussion starting point about the item of the issue/PR State: waiting for other PR State: The PR requires another PR to be merged first labels Jan 8, 2015
@PeterKietzmann
Copy link
Member Author

Hi. Just for clarification: I will follow up with this PR when the network stack is "stable". Maybe the NetworkStackTaskForce will do this :-)

@haukepetersen
Copy link
Contributor

Sounds like the only valid plan to me!

@PeterKietzmann
Copy link
Member Author

I will close this PR and open a new one when I adapted the device to the new ng_netdev

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: drivers Area: Device drivers State: WIP State: The PR is still work-in-progress and its code is not in its final presentable form yet Type: new feature The issue requests / The PR implemements a new feature for RIOT
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants