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

FW-866. OpenRadio Implementation for OpenMote-B #516

Open
wants to merge 39 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
40d9668
fw-866 updates for openmoteb board
minarady1 Aug 6, 2020
7c1a372
fw-866 updates for iot-lab_A8-M3 board
minarady1 Aug 6, 2020
a86fd1c
fw-866 radio header update
minarady1 Aug 6, 2020
4ef68e8
fw-866 open-tsch updates for iot-lab_M3 board
minarady1 Aug 6, 2020
c639f94
fw-866 open-tsch updates for openmote-b-24ghz board
minarady1 Aug 6, 2020
d0444e1
fw-866 open-tsch updates for openmote-cc2538 board
minarady1 Aug 6, 2020
a3edd27
fw-866 open-tsch updates for openmotestm board
minarady1 Aug 6, 2020
33d6d1b
fw-866 open-tsch updates for openmotestm board
minarady1 Aug 6, 2020
0bfed2c
fw-866 open-tsch updates for python "board"
minarady1 Aug 6, 2020
81ade3f
fw-866 open-tsch updates for samr21_xpro board
minarady1 Aug 6, 2020
4147ab5
fw-866 open-tsch updates for board.h
minarady1 Aug 6, 2020
2a393fa
fw-866 OpenRadio driver update for at86rf215 chip
minarady1 Aug 6, 2020
9606696
fw-866 OpenRadio driver update for at86rf231 chip
minarady1 Aug 6, 2020
301d6ee
fw-866 OpenTSCH update for opentimers
minarady1 Aug 6, 2020
8f727a7
fw-866 OpenRadio integration with IEEE802154E MAC
minarady1 Aug 6, 2020
ab27b2a
fw-866 added separate driver for the radio cc2538rf
minarady1 Aug 6, 2020
1942d1e
fw-866 updating openradio driver for at86rf215
minarady1 Aug 6, 2020
744e556
fw-866 updating slot timing reference in the stack
minarady1 Aug 6, 2020
785a2e1
fw-866 added radio_setConfig definition to radio.c drivers of boards …
minarady1 Aug 6, 2020
5ef02df
fw-866 restoring the data type for the frequency in radio_setFrequenc…
minarady1 Aug 6, 2020
662c56e
fw-866 fixed typos in radio drivers
minarady1 Aug 6, 2020
e4cacd4
fw-866 fixing resetStats identifier in pyhton SConscript.env
minarady1 Aug 6, 2020
163a70c
fw-866 adding SConscript to cc2538rf chip folder
minarady1 Aug 7, 2020
ed65d22
fw-866 restoring the default setting for the radio
minarady1 Aug 7, 2020
97259dd
fw-866 updating SLOT_10ms slot name to SLOT_10ms_24GHZ
minarady1 Aug 7, 2020
a0b074d
Revert "fw-866 open-tsch updates for openmote-cc2538 board"
minarady1 Aug 7, 2020
8e6b14d
fw-866 typos fix and .gitignore update
minarady1 Aug 7, 2020
d9006f5
fw-866 fixing indentation and styling
minarady1 Aug 7, 2020
eeaceb1
fw-866 styling + removing unnecessary header from radio.c and opentim…
minarady1 Aug 7, 2020
a023655
fw-866 updating board drivers for nrf52840 board
minarady1 Aug 10, 2020
a71ee8e
fw-866 styling fixes
minarady1 Aug 10, 2020
1b3882c
fw-866 renaming SLOT_10ms to SLOT_10ms_24GHZ in python and openmote-c…
minarady1 Aug 10, 2020
38170c3
fw-866 renaming SLOT_10ms to SLOT_10ms_24GHZ in openmote-b-24ghz/board.c
minarady1 Aug 10, 2020
4ff6ca7
fw-866 styling
minarady1 Aug 10, 2020
af5bcfe
fw-866 changing L2_SECURITY_ACTIVE to OPENWSN_IEEE802154E_SECURITY_C
minarady1 Aug 10, 2020
457dd04
fw-866 updating board drivers with OpenTSCH support in gina/board.c, …
minarady1 Aug 10, 2020
84f6375
fw-866 styling+comments
minarady1 Aug 10, 2020
783d3fe
fw-866 iot-lab_M3/board.c initializing slots
minarady1 Aug 10, 2020
e1e4ccd
fw-866 styling in python board
minarady1 Aug 13, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ settings
/.sconsign.dblite
*.map
*.lst
*.bak
*~
/projects/telosb/00std_button/path.txt
/projects/telosb/00std_xon_xoff/path.txt
Expand Down
45 changes: 39 additions & 6 deletions bsp/boards/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,57 @@

//=========================== define ==========================================

#define SLOTDURATION_MS board_getSlotDuration()/PORT_TICS_PER_MS

typedef enum {
DO_NOT_KICK_SCHEDULER = 0,
KICK_SCHEDULER = 1,
DO_NOT_KICK_SCHEDULER = 0,
KICK_SCHEDULER = 1,
} kick_scheduler_t;



//=========================== typedef =========================================

typedef struct {
uint16_t slotDuration;

// execution speed related
// also implementation related (e.g. SoC radio or spi-connected radio because of the time to load a packet to/from radio)
uint16_t maxTxDataPrepare;
uint16_t maxRxAckPrepare;
uint16_t maxRxDataPrepare;
uint16_t maxTxAckPrepare;

// radio speed related
// also implementation related (because the time to execute the Tx/Rx command is highly dependent on the radio AND the configuration)
uint16_t delayTx;
uint16_t delayRx;
} slot_board_vars_t; //board specific slot vars

// available slot templates
typedef enum{
SLOT_10ms_24GHZ,
SLOT_20ms_24GHZ,
SLOT_40ms_24GHZ,
SLOT_40ms_FSK_SUBGHZ,
SLOT_40ms_OFDM1MCS0_3_SUBGHZ,
MAX_SLOT_TYPES,
} slotType_t;

//=========================== variables =======================================

//=========================== prototypes ======================================

void board_init(void);
void board_sleep(void);
void board_reset(void);

void board_init(void);
void board_sleep(void);
void board_reset(void);
uint16_t board_getSlotDuration (void);
slot_board_vars_t board_selectSlotTemplate(slotType_t slot_type);
/**
\}
\}
*/
//=========================== private =========================================

void board_init_slot_vars(void);
#endif
33 changes: 32 additions & 1 deletion bsp/boards/gina/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
//#define ISR_BUTTON 1
//=========================== variables =======================================

slot_board_vars_t slot_board_vars [MAX_SLOT_TYPES];
slotType_t selected_slot_type;

//=========================== prototypes ======================================

//=========================== main ============================================
Expand Down Expand Up @@ -77,8 +80,10 @@ void board_init(void) {
i2c_init();
radio_init();
sctimer_init();

board_init_slot_vars();
//ADC_init();

// enable interrupts
__bis_SR_register(GIE);

Expand All @@ -99,6 +104,32 @@ void board_init(void) {
}
}

//==== IEEE802154E timing: bootstrapping slot info lookup table
// 1 clock tick = 30.5 us
void board_init_slot_vars(void){

// 20ms slot
slot_board_vars [SLOT_20ms_24GHZ].slotDuration = 655 ; // tics
slot_board_vars [SLOT_20ms_24GHZ].maxTxDataPrepare = 110 ; // 3355us (based on measurement)
slot_board_vars [SLOT_20ms_24GHZ].maxRxAckPrepare = 20 ; // 610us (based on measurement)
slot_board_vars [SLOT_20ms_24GHZ].maxRxDataPrepare = 33 ; // 1000us (based on measurement)
slot_board_vars [SLOT_20ms_24GHZ].maxTxAckPrepare = 50 ; // 1525us (based on measurement)
slot_board_vars [SLOT_20ms_24GHZ].delayTx = 18 ; // 549us (based on measurement)
slot_board_vars [SLOT_20ms_24GHZ].delayRx = 0 ; // 0us (can not measure)
}

// To get the current slotDuration at any time (in tics)
// if you need the value in MS, divide by PORT_TICS_PER_MS (which varies by board and clock frequency and defined in board_info.h)
uint16_t board_getSlotDuration (void){
return slot_board_vars [selected_slot_type].slotDuration;
}

// Setter/Getter function for slot_board_vars
slot_board_vars_t board_selectSlotTemplate (slotType_t slot_type){
selected_slot_type = slot_type;
return slot_board_vars [selected_slot_type];
}

void board_sleep(void) {
__bis_SR_register(GIE+LPM3_bits); // sleep, but leave ACLK on
}
Expand Down
18 changes: 0 additions & 18 deletions bsp/boards/gina/board_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,24 +60,6 @@ to return the board's description.
#define PORT_PIN_RADIO_RESET_HIGH() // nothing
#define PORT_PIN_RADIO_RESET_LOW() // nothing

//===== IEEE802154E timing

#define SLOTDURATION 20 // in miliseconds

// time-slot related
#define PORT_TsSlotDuration 655 // 20ms

// execution speed related
#define PORT_maxTxDataPrepare 110 // 3355us (not measured)
#define PORT_maxRxAckPrepare 20 // 610us (not measured)
#define PORT_maxRxDataPrepare 33 // 1000us (not measured)
#define PORT_maxTxAckPrepare 50 // 1525us (not measured)

// radio speed related
#define PORT_delayTx 18 // 549us (not measured)
#define PORT_delayRx 0 // 0us (can not measure)
// radio watchdog

//===== adaptive_sync accuracy

#define SYNC_ACCURACY 1 // ticks
Expand Down
33 changes: 31 additions & 2 deletions bsp/boards/iot-lab_A8-M3/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@
#include "nvic.h"
#include "debugpins.h"

//=========================== variable ========================================
//=========================== variables =======================================

slot_board_vars_t slot_board_vars [MAX_SLOT_TYPES];
slotType_t selected_slot_type;

//=========================== private =========================================

Expand Down Expand Up @@ -98,12 +101,38 @@ void board_init(void){
debugpins_init();
//enable nvic for the radio
NVIC_radio();

board_init_slot_vars();
#if defined(BOARD_CRYPTOENGINE_ENABLED)
cryptoengine_init();
#endif
}


//==== bootstrapping slot info lookup table
void board_init_slot_vars(void){

Copy link
Member

Choose a reason for hiding this comment

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

Initialize the slot_board_vars variable here, i.e. using the memset(&slot_board_vars[0], 0, sizeof(slot_board_vars));

Need to check the value of sizeof(slot_board_vars).

// 20ms slot
slot_board_vars [SLOT_20ms_24GHZ].slotDuration = 655 ; // ms
slot_board_vars [SLOT_20ms_24GHZ].maxTxDataPrepare = 110 ; // 3355us (not measured)
slot_board_vars [SLOT_20ms_24GHZ].maxRxAckPrepare = 20 ; // 610us (not measured)
slot_board_vars [SLOT_20ms_24GHZ].maxRxDataPrepare = 33 ; // 1000us (not measured)
slot_board_vars [SLOT_20ms_24GHZ].maxTxAckPrepare = 50 ; // 1525us (not measured)
slot_board_vars [SLOT_20ms_24GHZ].delayTx = 18 ; // 549us (not measured)
slot_board_vars [SLOT_20ms_24GHZ].delayRx = 0 ; // 0us (can not measure)
}

// To get the current slotDuration at any time
// used during initialization by sixtop to fire the first sixtop EB
uint16_t board_getSlotDuration (void){
return slot_board_vars [selected_slot_type].slotDuration;
}

// Setter/Getter function for slot_board_vars
slot_board_vars_t board_selectSlotTemplate (slotType_t slot_type){
selected_slot_type = slot_type;
return slot_board_vars [selected_slot_type];
}

void board_sleep(void) {
DBGMCU_Config(DBGMCU_STOP, ENABLE);
// Enable PWR and BKP clock
Expand Down
17 changes: 0 additions & 17 deletions bsp/boards/iot-lab_A8-M3/board_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,23 +50,6 @@ to return the board's description.
#define PORT_PIN_RADIO_RESET_HIGH() //GPIOC->ODR |= 0X0040;// nothing
#define PORT_PIN_RADIO_RESET_LOW() //GPIOC->ODR &= ~0X0040;// nothing

//===== IEEE802154E timing

#define SLOTDURATION 20 // in miliseconds

// time-slot related
#define PORT_TsSlotDuration 655 // 20ms

// execution speed related
#define PORT_maxTxDataPrepare 110 // 3355us (not measured)
#define PORT_maxRxAckPrepare 20 // 610us (not measured)
#define PORT_maxRxDataPrepare 33 // 1000us (not measured)
#define PORT_maxTxAckPrepare 50 // 1525us (not measured)

// radio speed related
#define PORT_delayTx 18 // 549us (not measured)
#define PORT_delayRx 0 // 0us (can not measure)
// radio watchdog

//===== adaptive_sync accuracy

Expand Down
34 changes: 32 additions & 2 deletions bsp/boards/iot-lab_M3/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
#include "gpio.h"
#include "cryptoengine.h"

//=========================== variables =======================================
slot_board_vars_t slot_board_vars [MAX_SLOT_TYPES];
slotType_t selected_slot_type;

//=========================== main ============================================

extern int mote_main(void);
Expand All @@ -36,8 +40,7 @@ void board_enableHardFaultExceptionHandler(void);

//=========================== public ==========================================

void board_init(void)
{
void board_init(void){
RCC_Configuration();//Configure rcc
NVIC_Configuration();//configure NVIC and Vector Table

Expand Down Expand Up @@ -94,12 +97,39 @@ void board_init(void)
debugpins_init();
//enable nvic for the radio
NVIC_radio();
board_init_slot_vars();

#if defined(BOARD_CRYPTOENGINE_ENABLED)
cryptoengine_init();
#endif
}


//==== bootstrapping slot info lookup table
void board_init_slot_vars(void){

// 20ms slot
slot_board_vars [SLOT_20ms_24GHZ].slotDuration = 655 ; // ms
slot_board_vars [SLOT_20ms_24GHZ].maxTxDataPrepare = 110 ; // 3355us (not measured)
slot_board_vars [SLOT_20ms_24GHZ].maxRxAckPrepare = 20 ; // 610us (not measured)
slot_board_vars [SLOT_20ms_24GHZ].maxRxDataPrepare = 33 ; // 1000us (not measured)
slot_board_vars [SLOT_20ms_24GHZ].maxTxAckPrepare = 50 ; // 1525us (not measured)
slot_board_vars [SLOT_20ms_24GHZ].delayTx = 18 ; // 549us (not measured)
slot_board_vars [SLOT_20ms_24GHZ].delayRx = 0 ; // 0us (can not measure)
}

// To get the current slotDuration at any time
// used during initialization by sixtop to fire the first sixtop EB
uint16_t board_getSlotDuration (void){
return slot_board_vars [selected_slot_type].slotDuration;
}

// Setter/Getter function for slot_board_vars
slot_board_vars_t board_selectSlotTemplate (slotType_t slot_type){
selected_slot_type = slot_type;
return slot_board_vars [selected_slot_type];
}

void board_sleep(void) {
DBGMCU_Config(DBGMCU_STOP, ENABLE);
// Enable PWR and BKP clock
Expand Down
17 changes: 0 additions & 17 deletions bsp/boards/iot-lab_M3/board_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,23 +49,6 @@ to return the board's description.
#define PORT_PIN_RADIO_RESET_LOW() //GPIOC->ODR &= ~0X0040;// nothing
//#define PORT_PIN_RADIO_RESET_LOW() GPIOC->ODR &= ~(1<<1);

//===== IEEE802154E timing

#define SLOTDURATION 20 // in miliseconds

// time-slot related
#define PORT_TsSlotDuration 655 // 20ms

// execution speed related
#define PORT_maxTxDataPrepare 110 // 3355us (not measured)
#define PORT_maxRxAckPrepare 20 // 610us (not measured)
#define PORT_maxRxDataPrepare 33 // 1000us (not measured)
#define PORT_maxTxAckPrepare 50 // 1525us (not measured)

// radio speed related
#define PORT_delayTx 18 // 549us (not measured)
#define PORT_delayRx 0 // 0us (can not measure)
// radio watchdog

//===== adaptive_sync accuracy

Expand Down
46 changes: 46 additions & 0 deletions bsp/boards/nrf52840/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,57 @@ void board_init(void) {

i2c_init();

board_init_slot_vars();

#if defined(BOARD_SENSORS_ENABLED)
sensors_init();
#endif
}

//==== IEEE802154E timing: bootstrapping slot info lookup table
// 1 clock tick = 30.5 us
void board_init_slot_vars(void){


//10ms slot
slot_board_vars [SLOT_10ms_24GHZ].slotDuration = 328 ; // tics
slot_board_vars [SLOT_10ms_24GHZ].maxTxDataPrepare = 13 ; // ~397us (measured 364us)
slot_board_vars [SLOT_10ms_24GHZ].maxRxAckPrepare = 13 ; // ~397us (measured 364us)
slot_board_vars [SLOT_10ms_24GHZ].maxRxDataPrepare = 13 ; // ~397us (measured 364us)
slot_board_vars [SLOT_10ms_24GHZ].maxTxAckPrepare = 13 ; // ~397us (measured 364us)
slot_board_vars [SLOT_10ms_24GHZ].delayTx = 10 ; // 305us (measured 282us; radio_txNow() to RADIO_IRQHandler() / NRF_RADIO->EVENTS_READY)
slot_board_vars [SLOT_10ms_24GHZ].delayRx = 5 ; // ~153us (measured 147us; radio_rxNow() to RADIO_IRQHandler() / NRF_RADIO->EVENTS_READY)

// 20ms slot
slot_board_vars [SLOT_20ms_24GHZ].slotDuration = 655 ; // tics
slot_board_vars [SLOT_20ms_24GHZ].maxTxDataPrepare = 13 ; // ~397us (measured 364us)
slot_board_vars [SLOT_20ms_24GHZ].maxRxAckPrepare = 13 ; // ~397us (measured 364us)
slot_board_vars [SLOT_20ms_24GHZ].maxRxDataPrepare = 13 ; // ~397us (measured 364us)
slot_board_vars [SLOT_20ms_24GHZ].maxTxAckPrepare = 13 ; // ~397us (measured 364us)
#if BOARD_PCA10056
// nrf52840-DK
slot_board_vars [SLOT_20ms_24GHZ].delayTx = 1 ; // 305us (measured 282us; radio_txNow() to RADIO_IRQHandler() / NRF_RADIO->EVENTS_READY)
slot_board_vars [SLOT_20ms_24GHZ].delayRx = 0 ; // ~153us (measured 147us; radio_rxNow() to RADIO_IRQHandler() / NRF_RADIO->EVENTS_READY)
#endif
#if BOARD_PCA10059
// nrf52840-DONGLE
slot_board_vars [SLOT_20ms_24GHZ].delayTx = 10 ; // 305us (measured 282us; radio_txNow() to RADIO_IRQHandler() / NRF_RADIO->EVENTS_READY)
slot_board_vars [SLOT_20ms_24GHZ].delayRx = 5 ; // ~153us (measured 147us; radio_rxNow() to RADIO_IRQHandler() / NRF_RADIO->EVENTS_READY)
#endif
}

// To get the current slotDuration at any time (in tics)
// if you need the value in MS, divide by PORT_TICS_PER_MS (which varies by board and clock frequency and defined in board_info.h)
uint16_t board_getSlotDuration (void){
return slot_board_vars [selected_slot_type].slotDuration;
}

// Setter/Getter function for slot_board_vars
slot_board_vars_t board_selectSlotTemplate (slotType_t slot_type){
selected_slot_type = slot_type;
return slot_board_vars [selected_slot_type];
}

/**
* Puts the board to sleep
*/
Expand Down
Loading