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

Mrf24j40 #5792

Closed
wants to merge 9 commits into from
Closed

Mrf24j40 #5792

wants to merge 9 commits into from

Conversation

Nenaco
Copy link

@Nenaco Nenaco commented Aug 31, 2016

Work in progress - Support for radio module MRF24J40. Please feel free to make changes and help to make this radio work together with netdev2.

@PeterKietzmann PeterKietzmann added 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 Aug 31, 2016
@OlegHahm
Copy link
Member

Cool!

@OlegHahm
Copy link
Member

OlegHahm commented Sep 2, 2016

@PeterKietzmann, you have the device available at HAW?

0x78, 0x70, 0x68, 0x60, 0x58, 0x50, 0x48, 0x40,
0x38, 0x30, 0x28, 0x20, 0x18, 0x10, 0x08, 0x00 };


Copy link
Member

Choose a reason for hiding this comment

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

That's a lot of empty space o___o

Copy link
Author

Choose a reason for hiding this comment

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

Hello miri64,
thanks a lot for the hint - I 'll make a correction tomorrow.

Regards,
Neo

Copy link
Author

Choose a reason for hiding this comment

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

I have a small hint why the mrf24j40 doesn't send data up to now.
The MRF24J40 seem to expect a different FIFO format for Receive FIFO and Transmit-Normal-FIFO. If I interpret the figure 3-11 inside the datasheet it seems that the TX FIFO needs the "Header Length" inserted at address 0.
Has anyone an idea where/how to get the header length?

Regards,
Neo

Copy link
Author

Choose a reason for hiding this comment

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

If I understand the figure 3-11 of the datasheet right and if netdev2 is configured to use long-address mode - then the "Header Length" is 23 - is this correct?

Regards,
Neo

@PeterKietzmann
Copy link
Member

Hi @Nenaco! Is this PR still WIP? Where are you at?

@Nenaco
Copy link
Author

Nenaco commented Oct 9, 2016

Hello Peter,
yes, it is still WIP. The code which is at the moment in the PR is able
to send data without retries. I have also a version which is able to
handle retries (not yet checked in).
This works for me at the moment. Therefore I don't force the development
at the moment.
I hoped that someone else could help to bring the driver to a higher level.

Regards,
Neo

Am 05.10.2016 um 08:37 schrieb Peter Kietzmann:

Hi @Nenaco https://github.com/Nenaco! Is this PR still WIP? Where
are you at?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#5792 (comment), or
mute the thread
https://github.com/notifications/unsubscribe-auth/ATsbrONAPGRDxwyACSVH5NxtZ9ccYk26ks5qw0WXgaJpZM4Jxtzc.

Copy link
Member

@miri64 miri64 left a comment

Choose a reason for hiding this comment

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

Please use the default values provided in #5977

/**
* @brief Maximum possible packet size in byte
*/
#define MRF24J40_MAX_PKT_LENGTH (127)
Copy link
Member

Choose a reason for hiding this comment

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

Please consider using the values provided in #5977 instead

*/
#define MRF24J40_MIN_CHANNEL (11U)
#define MRF24J40_MAX_CHANNEL (26U)
#define MRF24J40_DEFAULT_CHANNEL (26U)
Copy link
Member

Choose a reason for hiding this comment

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

Dito

Copy link
Member

@PeterKietzmann PeterKietzmann Nov 15, 2016

Choose a reason for hiding this comment

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

In addition, you should set this channel during initialization.
EDIT: After startup, ifconfig showls channel 0 but 802.15.4 has no channel 0.

*
* @todo Read some global network stack specific configuration value
*/
#define MRF24J40_DEFAULT_PANID (0x0023)
Copy link
Member

Choose a reason for hiding this comment

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

Yido

* 31 -> -0dB
*/

#define MRF24J40_DEFAULT_TXPOWER (31U)
Copy link
Member

Choose a reason for hiding this comment

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

Dito

/**
* @brief Device descriptor for MRF24J40 radio devices
*/
typedef struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't there be a "uint8_t header_len" in this struct? As used in mrf24j40.c, line 202.

Copy link
Member

Choose a reason for hiding this comment

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

I think @phectori is right. @Nenaco I'm wondering how you even compiled this way, or was removal by accident?

@phectori
Copy link
Contributor

The driver works for me with some minor changes, see: mrf24j40-test

My test setup consists of two nucleo-f401 boards and two mrf24j40 modules.

The branch in the link above also has a driver test in the tests folder. This is an adaptation of the at86rf2xx test, it sends raw 802.15.4 messages.

I have also tested the "gnrc_networking" and "gnrc_border_router" examples, they both work.

Thank you for this driver!

* 24 -> Value = 0xD3
* 25 -> Value = 0xE3
* 26 -> Value = 0xF3
*/
Copy link
Member

Choose a reason for hiding this comment

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

Instead of the upper block, just mentino the page where to find this mapping.

tmp = mrf24j40_reg_read_short(dev, MRF24J40_REG_TXMCR);
tmp &= 0b11100000;
tmp |= 0b00011000;
tmp |= 0b00000100;
Copy link
Member

Choose a reason for hiding this comment

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

Are there not macros for this usage? It would be cool to see what's gonging on here.

mrf24j40_reg_write_short(dev, MRF24J40_REG_WAKECON, MRF24J40_WAKECON_MASK__IMMWAKE); /* enable Immediate Wake-up mode */

/* set default options */
mrf24j40_set_option(dev, NETDEV2_IEEE802154_PAN_COMP, true);
Copy link
Member

Choose a reason for hiding this comment

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

Option has been removed within #5897

@PeterKietzmann
Copy link
Member

@phectori what exactly was needed to get gnrc_networking running? Did you try to communicate with an other device than mrf24j40? Are you in charge of a sniffer (e.g. RasPi + 802.15.4 radio)?

@phectori
Copy link
Contributor

phectori commented Nov 15, 2016

@PeterKietzmann Alle the changes are in the branch I referred to before. The changes are also listed in this commit: commit

In summary:

  • For some reason I needed to comment the if-statement at this line: line
  • I changed the argument types of some of the the functions in the "netdev2_driver_t" structure.
  • And I added the uint8_t header_len to the mrf24j40_t struct.

I don't quite understand why the first change is necessary, maybe you have an idea?

I only tested the mrf24j40 with another mrf24j40, both on the same board (nucleo-f401). I do not have a raspberry pi + 802.15.4 radio setup right now.

@PeterKietzmann
Copy link
Member

Thanks for your quick answer! Yes, I already used your branch and it is really helpful. However, you must have added the mrf24j40 module to your application Makefile or the board Makefile in order to use gnrc_networking with a STM board + external transceiver as network interface, I guess? However, that's not my main point. More looking for the information weather you can be sure about the RF channel in use.

@phectori
Copy link
Contributor

phectori commented Nov 15, 2016

Yes, I have added the module to the application Makefile, like in this branch.

Hmm, I'm not sure about the channel. The driver should use channel 26 as defined in mrf24j40_internal.c. The four first bits of that register define the channel, but I have no way to check this actually happens.

@Nenaco
Copy link
Author

Nenaco commented Nov 15, 2016

Hello Peter,
that's nice - it seems that there is getting life into the work on that
driver!
What is the further work? Shall I include the inputs into my branch? Or
do you include the
driver into the RIOT-master branch doing the work there ?

Regards
Neo

P.S. sorry for the delay - I was outside for some days

Am 15.11.2016 um 16:12 schrieb Peter Kietzmann:

Thanks for your quick answer! Yes, I already used your branch and it
is really helpful. However, you must have added the |mrf24j40| module
to your application Makefile or the board Makefile in order to use
|gnrc_networking| with a STM board + external transceiver as network
interface, I guess? However, that's not my main point. More looking
for the information weather you can be sure about the RF channel in use.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#5792 (comment), or
mute the thread
https://github.com/notifications/unsubscribe-auth/ATsbrCZdfj5N9fUIGFmnq4EZvZjAHayNks5q-cvAgaJpZM4Jxtzc.

@PeterKietzmann
Copy link
Member

@Nenaco you should definitely address all comments and take care of the code until it fits our coding conventions and works as expected (see our Developement Procedures and Contribution Guidlines). A rebase on the latest RIOT master would be great. In the end (still not defined when this will be) I will merge your code into RIOT master, but not integrate it by myself.
Did you test this device+driver against other 802.15.4 devices? Until now I just set up one stm32f4disco+mrf radio and a sniffer (RasPi + openlabs transceiver). Then I adapted your PR, mainly likein @phectori's branch. Did not see any 15.4 packets in the air. Is there maybe a special frame format or a bug in the channel selection? For example, using ifconfig shows channel 0 (which does not exist in 802.15.4) until a new channel was set. Might also be that the value isn't stored in netdev during initialization. I don't know, I'm asking for some input :-)!

@Nenaco
Copy link
Author

Nenaco commented Nov 16, 2016

Hello Peter,
I tested the device against my sniffer (beaglebone green + mrf24j40-cape

  • promiscous mode + tcpdump) and also against a full custom design
    equiped with a stm32-l0 and a at86rf233 radio modul.
    I'm using also the beaglebone + mrf24j40 as border router and UDP
    traffic runs as expected.
    About your problem - In my application code base I have sometimes
    controlled the MCU pins directly by MCU-registers accesses.....I have
    also used my own pin and interface configuration.
    Maybe I have forgotten something or removed something accidetally.
    Phecotri's board seams to work with the code - therefore I think it
    could not be too worse.
    I wanted to clean-up a little bit more with the Realese 2016.10.
    On which SPI interface (AF?)/GPIOs have you connected the MRF24J40?
    Maybe I can also connect a MRF24J40 module onto the stm32f4discovery
    board.....I have also one.......
    Have you got register-access to all registers? 8-bit/16-bit registers?
    Do you see interrupts comming from the MRF?
    Best regards

Neo

Am 16.11.2016 um 08:56 schrieb Peter Kietzmann:

@Nenaco https://github.com/Nenaco you should definitely address all
comments and take care of the code until it fits our coding
conventions and works as expected (see our Developement Procedures
https://github.com/RIOT-OS/RIOT/wiki/Development-procedures and
Contribution Guidlines
https://github.com/RIOT-OS/RIOT/wiki/Contributing-to-RIOT). A rebase
on the latest RIOT master would be great. In the end (still not
defined when this will be) I will merge your code into RIOT master,
but not integrate it by myself.
Did you test this device+driver against other 802.15.4 devices? Until
now I just set up one stm32f4disco+mrf radio and a sniffer (RasPi +
openlabs transceiver). Then I adapted your PR, mainly likein @phectori
https://github.com/phectori's branch. Did not see any 15.4 packets
in the air. Is there maybe a special frame format or a bug in the
channel selection? For example, using |ifconfig| shows channel |0|
(which does not exist in 802.15.4) until a new channel was set. Might
also be that the value isn't stored in netdev during initialization. I
don't know, I'm asking for some input :-)!


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#5792 (comment), or
mute the thread
https://github.com/notifications/unsubscribe-auth/ATsbrNxfmUjcZr2CW6CP376GCLrr6GBVks5q-rc5gaJpZM4Jxtzc.

@phectori
Copy link
Contributor

phectori commented Dec 8, 2016

Any progress here?

@Nenaco If you have no time to finish the driver, I have no problem starting a new PR and making the changes suggested here.

@PeterKietzmann
Copy link
Member

@Nenaco would you mind if we continue in #6277 and close this PR? I just gave it a shot with the other PR and it works pretty great at a first sight. And it also contains your work and your commits. By the way, thanks a lot for your pioneer work!

@PeterKietzmann
Copy link
Member

Ok, there is progress in #6277, let's continue there. @Nenaco would be great if you 'd scan over the code there.

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants