Skip to content

Commit

Permalink
Merge pull request RIOT-OS#10268 from SemjonKerner/add_nrf154
Browse files Browse the repository at this point in the history
cpu/nrf52/radio: initial support for nrf52's ieee802.15.4 radio
  • Loading branch information
haukepetersen committed Mar 4, 2019
2 parents 1642a03 + 3efeb80 commit 7cb1049
Show file tree
Hide file tree
Showing 16 changed files with 660 additions and 3 deletions.
2 changes: 2 additions & 0 deletions boards/common/nrf52/Makefile.dep
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
include $(RIOTCPU)/nrf52/Makefile.dep

ifneq (,$(filter skald,$(USEMODULE)))
USEMODULE += nrfble
endif
7 changes: 7 additions & 0 deletions boards/common/nrf52/include/cfg_timer_default.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,17 @@ static const timer_conf_t timer_config[] = {
.channels = 3,
.bitmode = TIMER_BITMODE_BITMODE_32Bit,
.irqn = TIMER1_IRQn
},
{
.dev = NRF_TIMER2,
.channels = 3,
.bitmode = TIMER_BITMODE_BITMODE_08Bit,
.irqn = TIMER2_IRQn
}
};

#define TIMER_0_ISR isr_timer1
#define TIMER_1_ISR isr_timer2

#define TIMER_NUMOF (sizeof(timer_config) / sizeof(timer_config[0]))
/** @} */
Expand Down
6 changes: 6 additions & 0 deletions boards/nrf52840dk/Makefile.dep
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
include $(RIOTBOARD)/common/nrf52xxxdk/Makefile.dep

ifneq (,$(filter gnrc_netdev_default netdev_default,$(USEMODULE)))
ifeq (,$(filter nrfmin,$(USEMODULE)))
USEMODULE += nrf802154
endif
endif
4 changes: 4 additions & 0 deletions boards/nrf52840dk/Makefile.features
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
include $(RIOTBOARD)/common/nrf52xxxdk/Makefile.features

# Various other features (if any)
FEATURES_PROVIDED += radio_nrf802154
FEATURES_PROVIDED += periph_pwm
5 changes: 5 additions & 0 deletions cpu/nrf52/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,9 @@ DIRS = periph $(RIOTCPU)/cortexm_common $(RIOTCPU)/nrf5x_common
# (file triggers compiler bug. see #5775)
SRC_NOLTO += vectors.c

# build the nrf802154 driver if selected
ifneq (,$(filter nrf802154,$(USEMODULE)))
DIRS += radio/nrf802154
endif

include $(RIOTBASE)/Makefile.base
6 changes: 6 additions & 0 deletions cpu/nrf52/Makefile.dep
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ifneq (,$(filter nrf802154,$(USEMODULE)))
FEATURES_REQUIRED += periph_timer
FEATURES_REQUIRED += radio_nrf802154
USEMODULE += luid
USEMODULE += netdev_ieee802154
endif
4 changes: 4 additions & 0 deletions cpu/nrf52/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,9 @@ export MCUBOOT_SLOT0_SIZE = 0x8000
export MCUBOOT_SLOT1_SIZE = 0x3C000
export MCUBOOT_SLOT2_SIZE = 0x3C000

ifneq (,$(filter nrf802154,$(USEMODULE)))
CFLAGS += -DGNRC_NETIF_MSG_QUEUE_SIZE=16
endif

include $(RIOTCPU)/nrf5x_common/Makefile.include
include $(RIOTMAKE)/arch/cortexm.inc.mk
61 changes: 61 additions & 0 deletions cpu/nrf52/include/nrf802154.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
* Copyright (C) 2019 Freie Universität Berlin
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/

/**
* @defgroup drivers_nrf52_802154 IEEE802.15.4 Driver for nRF52840 SoCs
* @ingroup drivers_netdev
* @brief Driver for using the nRF52's radio in IEEE802.15.4 mode
*
* ## Implementation state ##
* Netdev events supported:
*
* - NETDEV_EVENT_RX_COMPLETE
* - NETDEV_EVENT_TX_COMPLETE
*
* Transmission options not yet impemented:
* - Send acknowledgement for packages
* - Request acknowledgement
* - Retransmit unacked packages
* - Carrier Sense Multiple Access (CSMA) and Implementation of Clear Channel
* Assessment Control (CCACTRL)
*
* @{
*
* @file
* @brief Driver interface for using the nRF52 in IEEE802.15.4 mode
*
* @author Hauke Petersen <[email protected]>
* @author Semjon Kerner <[email protected]>
*/

#ifndef NRF802154_H
#define NRF802154_H

#include "net/netdev/ieee802154.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
* @brief Export the netdev device descriptor
*/
extern netdev_ieee802154_t nrf802154_dev;

/**
* @brief IEEE 802.15.4 radio timer configuration
*
* this radio relies on a dedicated hardware timer to maintain IFS
* the default timer may be overwritten in the board configuration
*/
#ifndef NRF802154_TIMER
#define NRF802154_TIMER TIMER_DEV(1)
#endif

#endif /* NRF802154_H */
/** @} */
3 changes: 3 additions & 0 deletions cpu/nrf52/radio/nrf802154/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
MODULE = nrf802154

include $(RIOTBASE)/Makefile.base
Loading

0 comments on commit 7cb1049

Please sign in to comment.