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

(Legacy) develop_FW-866 OpenRadio interface #504

Open
wants to merge 48 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
6ffee84
Initial commit of code compiling and working and synching but not ful…
minarady1 Mar 10, 2020
92a27e9
wrote radio_set_modulation and radio_local_bootstrap
minarady1 Mar 11, 2020
9035323
some updates
minarady1 Mar 12, 2020
9999fe1
open radio working :)
minarady1 Mar 12, 2020
ff29667
some updates, mainly trying to debug
minarady1 Mar 13, 2020
eebd083
updates
minarady1 Mar 13, 2020
133dc1c
radio at86rf files
minarady1 Mar 13, 2020
984444a
Integrating cc2538rf into the open radio interface
minarady1 Mar 19, 2020
9273ca3
using openradio in openwsn
minarady1 Mar 20, 2020
a6468d7
open radio interface finally working and integrated into openwsn
minarady1 Mar 23, 2020
1669b80
full radio set added to openradio
minarady1 Mar 26, 2020
999f50f
Complete open radio interface for openmote-b tested with 7 modulations.
minarady1 Mar 30, 2020
917665d
Restoring default configuration
minarady1 Mar 30, 2020
64006b5
restoring default config
minarady1 Mar 30, 2020
0de94cb
resorting default configurations and removing unnecessary code used f…
minarady1 Mar 30, 2020
185038e
restoring bsp_radio_tx default code
minarady1 Mar 30, 2020
ecc3bd2
restoring sniffer code
minarady1 Mar 30, 2020
56ed0cf
restoring sniffer code
minarady1 Mar 30, 2020
480f1dc
restoring sniffer code
minarady1 Mar 30, 2020
9226da2
restoring bsp_radio_rx code
minarady1 Mar 30, 2020
6dda3e9
A project for demonstrating the open radio interface on openmote-b:
minarady1 Mar 30, 2020
39a1bdc
Merge branch 'develop_FW-866' of https://github.com/minarady1/openwsn…
minarady1 Mar 30, 2020
f0d59e5
openradio interface cleaning in progress
minarady1 Apr 15, 2020
6bae185
modivided slot 40 for FSK and added slot 41 for ofdm1 mcs3
minarady1 Apr 16, 2020
75b7eb1
introduced slot_template instead of slot duration
minarady1 Apr 16, 2020
d2b9c40
cleaneing openradio interface + adding comments + using slot template…
minarady1 Apr 16, 2020
0166d42
comments+cleaning
minarady1 Apr 16, 2020
aa7237b
Merge branch 'develop' into develop_FW-866
minarady1 Apr 16, 2020
2464d80
minor fixes
minarady1 Apr 16, 2020
f23a799
macpong
minarady1 Apr 16, 2020
4882b35
Merge branch 'develop_FW-866' of https://github.com/minarady1/openwsn…
minarady1 Apr 16, 2020
c9f560e
changing slot templates to struct variables instead of #def constants
minarady1 Apr 17, 2020
e5fdab3
slot_duration struct update
minarady1 Apr 17, 2020
4e484f2
adding few helper functions to handle slot info
minarady1 Apr 17, 2020
74ca322
quick update
minarady1 Apr 17, 2020
48f3080
fixed dynamic slot selection + code formatting
minarady1 Apr 21, 2020
6ecca16
Final fixes to the dynamic slot selection at runtime. This feature no…
minarady1 Apr 22, 2020
49d565f
cleaning up code for bsp, projacts, MAC, IAR project files and .gitig…
minarady1 Apr 23, 2020
a506320
Updated radio drivers for python board + at86rf231 board to be compli…
minarady1 Apr 23, 2020
6a8f446
restoring defaults
minarady1 Apr 23, 2020
5e6ca11
FW-866 fixed slot template timing references as per PR comments
minarady1 Apr 24, 2020
ba85ad8
FW-866 merged board_setSlotType (slotType) and slot_board_vars_t boar…
minarady1 Apr 24, 2020
c861218
FW-866 fixing indentation, variable names for openradio + adjusting 2…
minarady1 Apr 24, 2020
5110952
FW-866 restoring tx/rx common project
minarady1 Apr 24, 2020
5538db7
increased testbed bootload timeout
minarady1 May 6, 2020
1a1926b
fw-866
minarady1 Jul 1, 2020
cdf2911
fw-866
minarady1 Aug 5, 2020
e5b34b3
fw-866
minarady1 Aug 5, 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
66 changes: 65 additions & 1 deletion bsp/boards/openmote-b/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ static void SysCtrlSleepSetting(void);
static void SysCtrlRunSetting(void);
static void SysCtrlWakeupSetting(void);

//=========================== variables ============================================
slot_board_vars_t slot_board_vars [MAX_SLOT_TYPES-1];

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

extern int mote_main(void);
Expand All @@ -76,7 +79,7 @@ void board_init(void) {
uart_init();
radio_init();
i2c_init();

board_init_slot_vars();
// sensors_init();
cryptoengine_init();
}
Expand Down Expand Up @@ -160,6 +163,67 @@ bool board_timer_expired(uint32_t future) {
}
}

//==== bootstrapping slot info lookup table
void board_init_slot_vars(void){
//10ms slot
Copy link
Member

Choose a reason for hiding this comment

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

we don't care about anything than 3 settings, and 40ms timeslots.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the 10ms and 20ms are used in other board, should I definitely remove them? @changtengfei @TimothyClaeys

slot_board_vars [SLOT_10ms].PORT_SLOTDURATION = 10 ; // ms
slot_board_vars [SLOT_10ms].PORT_TsSlotDuration = 328 ; // counter counts one extra count, see datasheet
slot_board_vars [SLOT_10ms].PORT_maxTxDataPrepare = 10 ; // 305us (measured 82us)
slot_board_vars [SLOT_10ms].PORT_maxRxAckPrepare = 10 ; // 305us (measured 83us)
slot_board_vars [SLOT_10ms].PORT_maxRxDataPrepare = 4 ; // 122us (measured 22us)
slot_board_vars [SLOT_10ms].PORT_maxTxAckPrepare = 10 ; // 122us (measured 94us)
#ifdef L2_SECURITY_ACTIVE
slot_board_vars [SLOT_10ms].PORT_delayTx = 14 ; // 366us (measured xxxus)
#else
slot_board_vars [SLOT_10ms].PORT_delayTx = 12 ; // 366us (measured xxxus)
#endif
slot_board_vars [SLOT_10ms].PORT_delayRx = 0 ; // 0us (can not measure)

// 20ms slot
slot_board_vars [SLOT_20ms_24GHZ].PORT_SLOTDURATION = 20 ; // ms
slot_board_vars [SLOT_20ms_24GHZ].PORT_TsSlotDuration = 1310 ; // 20ms
slot_board_vars [SLOT_20ms_24GHZ].PORT_maxTxDataPrepare = 110 ; // 3355us (not measured)
slot_board_vars [SLOT_20ms_24GHZ].PORT_maxRxAckPrepare = 20 ; // 610us (not measured)
slot_board_vars [SLOT_20ms_24GHZ].PORT_maxRxDataPrepare = 33 ; // 1000us (not measured)
slot_board_vars [SLOT_20ms_24GHZ].PORT_maxTxAckPrepare = 50 ; // 1525us (not measured)
slot_board_vars [SLOT_20ms_24GHZ].PORT_delayTx = 18 ; // 549us (not measured)
slot_board_vars [SLOT_20ms_24GHZ].PORT_delayRx = 0 ; // 0us (can not measure)

//40ms slot for 24ghz cc2538
slot_board_vars [SLOT_40ms_24GHZ].PORT_SLOTDURATION = 40 ; // ms
slot_board_vars [SLOT_40ms_24GHZ].PORT_TsSlotDuration = 1310 ; // 40ms
slot_board_vars [SLOT_40ms_24GHZ].PORT_maxTxDataPrepare = 10 ; // 305us
slot_board_vars [SLOT_40ms_24GHZ].PORT_maxRxAckPrepare = 10 ; // 305us
slot_board_vars [SLOT_40ms_24GHZ].PORT_maxRxDataPrepare = 4 ; // 122us
slot_board_vars [SLOT_40ms_24GHZ].PORT_maxTxAckPrepare = 10 ; // 305us
#ifdef L2_SECURITY_ACTIVE = ;
slot_board_vars [SLOT_40ms_24GHZ].PORT_delayTx = 14 ; // 366us (measured xxxus)
#else = ;
slot_board_vars [SLOT_40ms_24GHZ].PORT_delayTx = 12 ; // 366us (measured xxxus)
#endif = ;
slot_board_vars [SLOT_40ms_24GHZ].PORT_delayRx = 0 ; // 0us (can not measure)

//40ms slot for FSK
slot_board_vars [SLOT_40ms_FSK_SUBGHZ].PORT_SLOTDURATION = 40 ; // ms
slot_board_vars [SLOT_40ms_FSK_SUBGHZ].PORT_TsSlotDuration = 1310 ; // 40ms
slot_board_vars [SLOT_40ms_FSK_SUBGHZ].PORT_maxTxDataPrepare = 50 ; // 1525 us (based on measurement)
slot_board_vars [SLOT_40ms_FSK_SUBGHZ].PORT_maxRxAckPrepare = 10 ; // 305µs (based on measurement)
slot_board_vars [SLOT_40ms_FSK_SUBGHZ].PORT_maxRxDataPrepare = 10 ; // 305µs (based on measurement)
slot_board_vars [SLOT_40ms_FSK_SUBGHZ].PORT_maxTxAckPrepare = 33 ; // 1000µs (based on measurement)
slot_board_vars [SLOT_40ms_FSK_SUBGHZ].PORT_delayTx = 66 ; // 2000µs (based on measurement)
slot_board_vars [SLOT_40ms_FSK_SUBGHZ].PORT_delayRx = 16 ; // 488µs. This parameter is usually set to 0, however for Atmel on openmote-b, it takes at least 1ms for the transmission to occure because of spi delay (or other implementation specific overhead), so reciver is expected to wait a little more before turning on the radio.

//40ms slot for OFDM1 MCS0-3
slot_board_vars [SLOT_40ms_OFDM1MCS0_3_SUBGHZ].PORT_SLOTDURATION = 40 ; // ms
slot_board_vars [SLOT_40ms_OFDM1MCS0_3_SUBGHZ].PORT_TsSlotDuration = 1310 ; // 40ms
slot_board_vars [SLOT_40ms_OFDM1MCS0_3_SUBGHZ].PORT_maxTxDataPrepare = 50 ; //1525us (based on measurement)
slot_board_vars [SLOT_40ms_OFDM1MCS0_3_SUBGHZ].PORT_maxRxAckPrepare = 10 ; //305us (based on measurement)
slot_board_vars [SLOT_40ms_OFDM1MCS0_3_SUBGHZ].PORT_maxRxDataPrepare = 10 ; //305us (based on measurement)
slot_board_vars [SLOT_40ms_OFDM1MCS0_3_SUBGHZ].PORT_maxTxAckPrepare = 33 ; //1000us (based on measurement)
slot_board_vars [SLOT_40ms_OFDM1MCS0_3_SUBGHZ].PORT_delayTx = 41 ; //1251us (based on measurement)
slot_board_vars [SLOT_40ms_OFDM1MCS0_3_SUBGHZ].PORT_delayRx = 16 ; // 488µs. This parameter is usually set to 0, however for Atmel on openmote-b, it takes at least 1ms for the transmission to occure because of spi delay (or other implementation specific overhead), so reciver is expected to wait a little more before turning on the radio.
}

/**
* Resets the board
*/
Expand Down
105 changes: 23 additions & 82 deletions bsp/boards/openmote-b/board_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,92 +75,33 @@
#define MAX_RADIOS 7
Copy link
Member

Choose a reason for hiding this comment

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

no need for this. You have a variable which holds your timeslot templates, and can derive the number of templates from there (by dividing by the length of one.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is not for templates, it is for radioSetting array openradio lookup table in radio.c radio_functions_t dyn_funcs [MAX_RADIOS];


//===== IEEE802154E timing

#if SLOT_TEMPLATE==10
// time-slot related
#define SLOTDURATION 10 // ms
#define PORT_TsSlotDuration 328 // counter counts one extra count, see datasheet
// execution speed related
#define PORT_maxTxDataPrepare 10 // 305us (measured 82us)
#define PORT_maxRxAckPrepare 10 // 305us (measured 83us)
#define PORT_maxRxDataPrepare 4 // 122us (measured 22us)
#define PORT_maxTxAckPrepare 10 // 122us (measured 94us)
// radio speed related
#ifdef L2_SECURITY_ACTIVE
#define PORT_delayTx 14 // 366us (measured xxxus)
#else
#define PORT_delayTx 12 // 366us (measured xxxus)
#endif
#define PORT_delayRx 0 // 0us (can not measure)
// radio watchdog
#endif

#if SLOT_TEMPLATE==20
#define SLOTDURATION 20 // ms
#define PORT_TsSlotDuration 1310 //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)
#endif

//40ms slot for 24ghz cc2538
#if SLOT_TEMPLATE==41
#define SLOTDURATION 40 // ms
#define PORT_TsSlotDuration 1310 // 40ms

// execution speed related
#define PORT_maxTxDataPrepare 10 // 305us
#define PORT_maxRxAckPrepare 10 // 305us
#define PORT_maxRxDataPrepare 4 // 122us
#define PORT_maxTxAckPrepare 10 // 305us
// radio speed related
#ifdef L2_SECURITY_ACTIVE
#define PORT_delayTx 14 // 366us (measured xxxus)
#else
#define PORT_delayTx 12 // 366us (measured xxxus)
#endif
#define PORT_delayRx 0 // 0us (can not measure)
// radio watchdog
#endif

//40ms slot for FSK
#if SLOT_TEMPLATE==42
#define SLOTDURATION 40 // ms
#define PORT_TsSlotDuration 1310 // 40ms

typedef struct {
uint8_t SLOTDURATION;
uint8_t PORT_TsSlotDuration;

// execution speed related
#define PORT_maxTxDataPrepare 50 // 1525 us (based on measurement)
#define PORT_maxRxAckPrepare 10 // 305µs (based on measurement)
#define PORT_maxRxDataPrepare 10 // 305µs (based on measurement)
#define PORT_maxTxAckPrepare 33 // 1000µs (based on measurement)
// radio speed related
#define PORT_delayTx 66 // 2000µs (based on measurement)
#define PORT_delayRx 16 // 488µs. This parameter is usually set to 0, however for Atmel on openmote-b, it takes at least 1ms for the transmission to occure because of spi delay (or other implementation specific overhead), so reciver is expected to wait a little more before turning on the radio.
#endif


//40ms slot for OFDM1 MCS0-3
#if SLOT_TEMPLATE==43
#define SLOTDURATION 40 // ms
#define PORT_TsSlotDuration 1310 // 40ms
// also implementation related (e.g. SoC radio or spi-connected radio because of the time to load a packet to/from radio)
uint8_t PORT_maxTxDataPrepare;
uint8_t PORT_maxRxAckPrepare;
uint8_t PORT_maxRxDataPrepare;
uint8_t PORT_maxTxAckPrepare;

// execution speed related
#define PORT_maxTxDataPrepare 50 //1525us (based on measurement)
#define PORT_maxRxAckPrepare 10 //305us (based on measurement)
#define PORT_maxRxDataPrepare 10 //305us (based on measurement)
#define PORT_maxTxAckPrepare 33 //1000us (based on measurement)
// radio speed related
#define PORT_delayTx 41 //1251us (based on measurement)
#define PORT_delayRx 16 // 488µs. This parameter is usually set to 0, however for Atmel on openmote-b, it takes at least 1ms for the transmission to occure because of spi delay (or other implementation specific overhead), so reciver is expected to wait a little more before turning on the radio.
#endif

// also implementation related (because the time to execute the Tx/Rx command is highly dependent on the radio AND the configuration)
uint8_t PORT_delayTx;
uint8_t PORT_delayRx;
} slot_board_vars_t; //board specific slot vars
Copy link
Contributor

@fjmolinas fjmolinas Apr 17, 2020

Choose a reason for hiding this comment

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

Does it make sense defining this in bsp/boards/board.h? you could have something
like this as a default config:

typedef struct {
    uint8_t SLOTDURATION;
    uint8_t PORT_TsSlotDuration;
    uint8_t PORT_maxTxDataPrepare;
    uint8_t PORT_maxRxAckPrepare;
    uint8_t PORT_maxRxDataPrepare;
    uint8_t PORT_maxTxAckPrepare;
    uint8_t PORT_delayTx;
    uint8_t PORT_delayRx;
} slot_board_vars_t;

/* This would be a default configuration */

#ifndef 10MS_SLOTDURATION
#define 10MS_SLOTDURATION             20   /* in miliseconds */
#endif
#ifndef 10MS_PORT_TsSlotDuration
#define 10MS_PORT_TsSlotDuration     655   /* 655 ticks at @32768Hz */
#endif
#ifndef 10MS_PORT_maxTxDataPrepare
#define 10MS_PORT_maxTxDataPrepare   110   /* 3355us (not measured) */
#endif
#ifndef 10MS_PORT_maxRxAckPrepare
#define 10MS_PORT_maxRxAckPrepare    20    /*  610us (not measured) */
#endif
#ifndef 10MS_PORT_maxRxDataPrepare
#define 10MS_PORT_maxRxDataPrepare   33    /* 1000us (not measured) */
#endif
#ifndef 10MS_PORT_maxTxAckPrepare
#define 10MS_PORT_maxTxAckPrepare    50    /* 1525us (not measured) */
#endif
#ifndef 10MS_PORT_delayTx
#define 10MS_PORT_delayTx            10   /*  549us (not measured) */
#endif
#ifndef 10MS_PORT_delayRx
#define 10MS_PORT_delayRx            0    /*    0us (can not measure) */
#endif

#define SLOT_10_MS_BOARD_CONFIG_DEFAULT  { .SLOTDURATION = 10MS_SLOTDURATION, \
                                           .PORT_TsSlotDuration = 10MS_PORT_TsSlotDuration, \
                                           .PORT_maxTxDataPrepare = 10MS_PORT_maxTxDataPrepare, \
                                           .PORT_maxRxAckPrepare = 10MS_PORT_maxRxAckPrepare, \
                                           .PORT_maxRxDataPrepare = 10MS_PORT_maxRxDataPrepare, \
                                           .PORT_maxTxAckPrepare = 10MS_PORT_maxTxAckPrepare, \
                                           .PORT_delayTx = 10MS_PORT_delayTx, \
                                           .PORT_delayRx = 10MS_PORT_delayRx, \
                                           }

static const slot_board_vars_t slot_10ms_board_vars[] =
{
#ifdef SLOT_10MS_BOARD_VARS
    SLOT_10MS_BOARD_VARS,
#else
    SLOT_10MS_BOARD_VARS_DEFAULT,
#endif
...
/* that for all slots */
...
#ifdef SLOT_40MS_OFDM1MCS0_3_SUBGHZ_BOARD_VARS
    SLOT_40MS_OFDM1MCS0_3_SUBGHZ_BOARD_VARS,
#else
    SLOT_40MS_OFDM1MCS0_3_SUBGHZ_BOARD_VARS_DEFAULT,
#endif
};

And then per board_info you would keep the original defines and do the following:

#define SLOT_10MS_BOARD_VARS  { .SLOTDURATION = 10MS_SLOTDURATION, \
                             .PORT_TsSlotDuration =10MS_ PORT_TsSlotDuration, \
                             .PORT_maxTxDataPrepare = 10MS_PORT_maxTxDataPrepare, \
                             .PORT_maxRxAckPrepare =10MS_ PORT_maxRxAckPrepare, \
                             .PORT_maxRxDataPrepare = 10MS_PORT_maxRxDataPrepare, \
                             .PORT_maxTxAckPrepare = 10MS_PORT_maxTxAckPrepare, \
                             .PORT_delayTx = 10MS_PORT_delayTx, \
                             .PORT_delayRx = 10MS_PORT_delayRx, \
                             }

I think this would also make the migration easier and the init function could
simply be:

void board_init_slot_vars(const slot_board_config_t *slot_board_config) {
    slot_board_vars = *slot_board_config;
}

The nice thing is this change could be split from this PR, and since currently only one SLOTDURATION is possible there would be no need to change any define per BOARD_INFO just add:

```c
#define SLOT_BOARD_VARS  { .SLOTDURATION = SLOTDURATION, \
                             .PORT_TsSlotDuration =PORT_TsSlotDuration, \
                             .PORT_maxTxDataPrepare = PORT_maxTxDataPrepare, \
                             .PORT_maxRxAckPrepare = PORT_maxRxAckPrepare, \
                             .PORT_maxRxDataPrepare = PORT_maxRxDataPrepare, \
                             .PORT_maxTxAckPrepare = PORT_maxTxAckPrepare, \
                             .PORT_delayTx = PORT_delayTx, \
                             .PORT_delayRx = PORT_delayRx, \
                             }


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

//===== adaptive_sync accuracy

Expand Down
60 changes: 56 additions & 4 deletions openstack/02a-MAClow/IEEE802154E.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@

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

ieee154e_vars_t ieee154e_vars;
ieee154e_stats_t ieee154e_stats;
ieee154e_dbg_t ieee154e_dbg;

ieee154e_vars_t ieee154e_vars;
ieee154e_stats_t ieee154e_stats;
ieee154e_dbg_t ieee154e_dbg;
slot_154e_vars_t slot_154e_vars [MAX_SLOT_TYPES-1];
//=========================== prototypes ======================================

// SYNCHRONIZING
Expand Down Expand Up @@ -172,6 +172,58 @@ void ieee154e_init(void) {
ieee154e_vars.serialInhibitTimerId = opentimers_create(TIMER_INHIBIT, TASKPRIO_NONE);
}

/**
\brief This function initializes the lookup table for the slot templates.

Call this function once, preferrably at end of the ieee154e_init function
*/
void ieee154e_slot_template_init(void)
{
//10ms slot
slot_154e_vars [SLOT_10ms].TsTxOffset = (2120/PORT_US_PER_TICK); // 2120us
slot_154e_vars [SLOT_10ms].TsLongGT = (1100/PORT_US_PER_TICK); // 1100us
slot_154e_vars [SLOT_10ms].TsTxAckDelay = (1000/PORT_US_PER_TICK); // 1000us
slot_154e_vars [SLOT_10ms].TsShortGT = (500/PORT_US_PER_TICK); // 500us; The standardlized value for this is 400/2=200us(7ticks). Currectly 7 doesn't work for short packet; change it back to 7 when found the problem.
slot_154e_vars [SLOT_10ms].wdRadioTx = (1342/PORT_US_PER_TICK); // 1000us (needs to be >delayTx) (SCuM need a larger value; 45 is tested and works)
slot_154e_vars [SLOT_10ms].wdDataDuration = (5000/PORT_US_PER_TICK); // 5000us (measured 4280us with max payload)
slot_154e_vars [SLOT_10ms].wdAckDuration = (3000/PORT_US_PER_TICK); // 3000us (measured 1000us)

// 20ms slot for 24ghz cc2538
slot_154e_vars [SLOT_20ms_24GHZ].TsTxOffset = (5215/PORT_US_PER_TICK); // 5215us
slot_154e_vars [SLOT_20ms_24GHZ].TsLongGT = (1311/PORT_US_PER_TICK); // 1311us
slot_154e_vars [SLOT_20ms_24GHZ].TsTxAckDelay = (5521/PORT_US_PER_TICK); // 5521us
slot_154e_vars [SLOT_20ms_24GHZ].TsShortGT = (700/PORT_US_PER_TICK); // 700us
slot_154e_vars [SLOT_20ms_24GHZ].wdRadioTx = (1342/PORT_US_PER_TICK); // 1000us (needs to be >delayTx) (SCuM need a larger value; 45 is tested and works)
slot_154e_vars [SLOT_20ms_24GHZ].wdDataDuration = (5000/PORT_US_PER_TICK); // 5000us (measured 4280us with max payload)
slot_154e_vars [SLOT_20ms_24GHZ].wdAckDuration = (3000/PORT_US_PER_TICK); // 3000us (measured 1000us)

//40ms slot for 24ghz cc2538
slot_154e_vars [SLOT_40ms_24GHZ].TsTxOffset = (5215/PORT_US_PER_TICK); // 5215us
slot_154e_vars [SLOT_40ms_24GHZ].TsLongGT = (1311/PORT_US_PER_TICK); // 1311us
slot_154e_vars [SLOT_40ms_24GHZ].TsTxAckDelay = (5521/PORT_US_PER_TICK); // 5521us
slot_154e_vars [SLOT_40ms_24GHZ].TsShortGT = (700/PORT_US_PER_TICK); // 700us
slot_154e_vars [SLOT_40ms_24GHZ].wdRadioTx = (1342/PORT_US_PER_TICK); // 1000us (needs to be >delayTx) (SCuM need a larger value; 45 is tested and works)
slot_154e_vars [SLOT_40ms_24GHZ].wdDataDuration = (5000/PORT_US_PER_TICK); // 5000us (measured 4280us with max payload)
slot_154e_vars [SLOT_40ms_24GHZ].wdAckDuration = (3000/PORT_US_PER_TICK); // 3000us (measured 1000us)

//40ms slot for FSK
slot_154e_vars [SLOT_40ms_FSK_SUBGHZ].TsTxOffset = (4000/PORT_US_PER_TICK); // measured: 131 ticks
slot_154e_vars [SLOT_40ms_FSK_SUBGHZ].TsLongGT = (2000/PORT_US_PER_TICK); // measured: 66 ticks
slot_154e_vars [SLOT_40ms_FSK_SUBGHZ].TsTxAckDelay = (3700/PORT_US_PER_TICK); // measured: 121 ticks
slot_154e_vars [SLOT_40ms_FSK_SUBGHZ].TsShortGT = (1831/PORT_US_PER_TICK); // measured: 60 ticks
slot_154e_vars [SLOT_40ms_FSK_SUBGHZ].wdRadioTx = (7000/PORT_US_PER_TICK); // 230 ticks 7019us delayTx+Tx time for 10 bytes( (needs to be >delayTx) (SCuM need a larger value; 45 is tested and works)
slot_154e_vars [SLOT_40ms_FSK_SUBGHZ].wdDataDuration = (30000/PORT_US_PER_TICK); // 983 ticks ; estimated based on max payload
slot_154e_vars [SLOT_40ms_FSK_SUBGHZ].wdAckDuration = (20000/PORT_US_PER_TICK); // 655 ticks; estimated

//40ms slot for OFDM1 MCS0-3
slot_154e_vars [SLOT_40ms_OFDM1MCS0_3_SUBGHZ].TsTxOffset = (3500/PORT_US_PER_TICK); // measured: 115 ticks;
slot_154e_vars [SLOT_40ms_OFDM1MCS0_3_SUBGHZ].TsLongGT = (2000/PORT_US_PER_TICK); // measured: 66 ticks;
slot_154e_vars [SLOT_40ms_OFDM1MCS0_3_SUBGHZ].TsTxAckDelay = (3700/PORT_US_PER_TICK); // measured: 121 ticks
slot_154e_vars [SLOT_40ms_OFDM1MCS0_3_SUBGHZ].TsShortGT = (1831/PORT_US_PER_TICK); // measured: 60 ticks
slot_154e_vars [SLOT_40ms_OFDM1MCS0_3_SUBGHZ].wdRadioTx = (7000/PORT_US_PER_TICK); // 230 ticks 7019us delayTx+Tx time for 10 bytes( (needs to be >delayTx) (SCuM need a larger value; 45 is tested and works)
slot_154e_vars [SLOT_40ms_OFDM1MCS0_3_SUBGHZ].wdDataDuration = (30000/PORT_US_PER_TICK); // 983 ticks; estimated based on max payload
slot_154e_vars [SLOT_40ms_OFDM1MCS0_3_SUBGHZ].wdAckDuration = (20000/PORT_US_PER_TICK); // 655 ticks; estimated
}
//=========================== public ==========================================

/**
Expand Down
12 changes: 12 additions & 0 deletions openstack/02a-MAClow/IEEE802154E.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,18 @@ typedef enum {

#define TIMESLOT_TEMPLATE_ID 0x00
#define CHANNELHOPPING_TEMPLATE_ID 0x00
//===== Slot Template Configurations

//general MAC slot template
typedef struct {
uint8_t TsTxOffset;
uint8_t TsLongGT;
uint8_t TsTxAckDelay;
uint8_t TsShortGT;
uint8_t wdRadioTx;
uint8_t wdDataDuration;
uint8_t wdAckDuration;
} slot_154e_vars_t;

// Atomic durations
// expressed in 32kHz ticks:
Expand Down