From fab04fd3cbd638ca81857591c4314acdc2a46e08 Mon Sep 17 00:00:00 2001 From: jmmunoz86 Date: Tue, 11 Sep 2018 11:34:32 +0200 Subject: [PATCH 01/37] using 2fsk-50 kbps --- bsp/boards/openmote-b/radio_subghz.c | 4 ++-- openstack/02a-MAClow/IEEE802154E.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bsp/boards/openmote-b/radio_subghz.c b/bsp/boards/openmote-b/radio_subghz.c index c476b15091..13c248ba2b 100644 --- a/bsp/boards/openmote-b/radio_subghz.c +++ b/bsp/boards/openmote-b/radio_subghz.c @@ -152,8 +152,8 @@ void radio_subghz_init(void) { while(1); //UNKNOWN DEVICE, FINISH } // Write registers to radio -- default configuration OFDM 400kbps - for( i = 0; i < (sizeof(basic_settings_ofdm_1_mcs2)/sizeof(registerSetting_t)); i++) { - at86rf215_spiWriteReg( basic_settings_ofdm_1_mcs2[i].addr, basic_settings_ofdm_1_mcs2[i].data); + for( i = 0; i < (sizeof(basic_settings_fsk_option1)/sizeof(registerSetting_t)); i++) { + at86rf215_spiWriteReg( basic_settings_fsk_option1[i].addr, basic_settings_fsk_option1[i].data); }; radio_subghz_read_isr(); diff --git a/openstack/02a-MAClow/IEEE802154E.h b/openstack/02a-MAClow/IEEE802154E.h index b99a0edfea..335808c118 100644 --- a/openstack/02a-MAClow/IEEE802154E.h +++ b/openstack/02a-MAClow/IEEE802154E.h @@ -39,8 +39,8 @@ static const uint8_t ebIEsBytestream[] = { #define EB_IE_LEN 28 #define NUM_CHANNELS 16 // number of channels to channel hop on -#define DEFAULT_CH_SPACING 1200 // default channel spacing for subghz -#define DEFAULT_FREQUENCY_CENTER 863625 // defualt freque +#define DEFAULT_CH_SPACING 200 // default channel spacing for subghz +#define DEFAULT_FREQUENCY_CENTER 863125 // defualt freque #define TXRETRIES 3 // number of MAC retries before declaring failed #define TX_POWER 31 // 1=-25dBm, 31=0dBm (max value) #define RESYNCHRONIZATIONGUARD 5 // in 32kHz ticks. min distance to the end of the slot to successfully synchronize From 40c3b583ba5d019d5fb6c0b009de24d8521b7d33 Mon Sep 17 00:00:00 2001 From: jmmunoz86 Date: Wed, 12 Sep 2018 16:57:50 +0200 Subject: [PATCH 02/37] update config 2-fsk 50kbps --- bsp/chips/at86rf215/at86rf215.h | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/bsp/chips/at86rf215/at86rf215.h b/bsp/chips/at86rf215/at86rf215.h index 7f0a89c318..38be0d14d5 100644 --- a/bsp/chips/at86rf215/at86rf215.h +++ b/bsp/chips/at86rf215/at86rf215.h @@ -3983,25 +3983,26 @@ static const registerSetting_t basic_settings_fsk_option1 []={ {RG_RF09_IRQM, 0x1F}, // TRXERR, BATLOW, EDC, TRXRDY, WAKEUP interrupts enabled {RG_RF24_IRQM, 0x00}, {RG_RF09_RXBWC, 0x00}, - {RG_RF09_RXDFE, 0x1A}, + {RG_RF09_RXDFE, 0x2A}, {RG_RF09_AGCC, 0x01}, + {RG_RF09_AGCS, 0x37}, {RG_RF09_EDD, 0x7A}, {RG_RF09_TXCUTC, 0xC0}, {RG_RF09_TXDFE, 0x98}, - {RG_RF09_PAC, 0x64},// Tx Power 5 bits >>. 0x64 = txPwr=>0x04, max: 0x1F. + {RG_RF09_PAC, 0x7F},// Tx Power 5 bits >>. 0x64 = txPwr=>0x04, max: 0x1F. {RG_BBC0_IRQM, 0x1F},// TXFE, RXEM, RXAM, RXFE, RXFS interrupts enabled {RG_BBC1_IRQM, 0x00}, - {RG_BBC0_PC, 0x1D},// No FCS filter, 32 bits FCS, FSK. + {RG_BBC0_PC, 0x15},// No FCS filter, 32 bits FCS, FSK. {RG_BBC0_FSKDM, 0x01},//Direct modulation and preemphasis enabled. {RG_BBC0_FSKC0, 0xD6}, {RG_BBC0_FSKC1, 0x00}, - {RG_BBC0_FSKC2, 0x40}, +// {RG_BBC0_FSKC2, 0x00}, {RG_BBC0_FSKC3, 0x85}, - {RG_BBC0_FSKC4, 0x0A}, //FEC enabled. IEEE MODE - {RG_BBC0_FSKPE0, 0x74}, - {RG_BBC0_FSKPE1, 0x7F}, - {RG_BBC0_FSKPE2, 0x80}, - {RG_BBC0_FSKPHRTX, 0x00},// No data whitening SFD0 used. + {RG_BBC0_FSKC4, 0x00}, //FEC enabled. IEEE MODE + {RG_BBC0_FSKPE0, 0x02}, + {RG_BBC0_FSKPE1, 0x03}, + {RG_BBC0_FSKPE2, 0xFC}, + {RG_BBC0_FSKPHRTX, 0x08},// No data whitening SFD0 used. }; static const registerSetting_t basic_settings_fsk_option2 []={ From 27c95f2488441ea3fc78b5e26420db66bee99032 Mon Sep 17 00:00:00 2001 From: jmmunoz86 Date: Wed, 12 Sep 2018 16:58:25 +0200 Subject: [PATCH 03/37] def TS 40 ms --- bsp/boards/openmote-b/board_info.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/bsp/boards/openmote-b/board_info.h b/bsp/boards/openmote-b/board_info.h index 3f2f065c00..fdda4f909b 100644 --- a/bsp/boards/openmote-b/board_info.h +++ b/bsp/boards/openmote-b/board_info.h @@ -59,7 +59,7 @@ //===== IEEE802154E timing -//#define SLOTDURATION_10MS // by default, we use 10ms time slot +// #define SLOTDURATION_10MS // by default, we use 10ms time slot #ifdef SLOTDURATION_10MS // time-slot related @@ -77,16 +77,16 @@ #endif #define PORT_delayRx 0 // 0us (can not measure) // radio watchdog -#else +#else // 40 ms // time-slot related -#define PORT_TsSlotDuration 492 // counter counts one extra count, see datasheet +#define PORT_TsSlotDuration 1300 // counter counts one extra count, see datasheet // execution speed related -#define PORT_maxTxDataPrepare 66 // 2014us (measured 746us) -#define PORT_maxRxAckPrepare 30 // 305us (measured 83us) -#define PORT_maxRxDataPrepare 33 // 1007us (measured 84us) -#define PORT_maxTxAckPrepare 32 // 305us (measured 219us) +#define PORT_maxTxDataPrepare 130 // 2014us (measured 746us) +#define PORT_maxRxAckPrepare 60 // 305us (measured 83us) +#define PORT_maxRxDataPrepare 66 // 1007us (measured 84us) +#define PORT_maxTxAckPrepare 64 // 305us (measured 219us) // radio speed related -#define PORT_delayTx 42 // 214us (measured 219us) +#define PORT_delayTx 70 // 214us (measured 219us) #define PORT_delayRx 0 // 0us (can not measure) // radio watchdog #endif From 624449bb91224e9441439b9c03ed6e49d71a2be6 Mon Sep 17 00:00:00 2001 From: jmmunoz86 Date: Wed, 12 Sep 2018 16:58:55 +0200 Subject: [PATCH 04/37] using 2-fsk 50 kbps --- bsp/boards/openmote-b/radio_subghz.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bsp/boards/openmote-b/radio_subghz.c b/bsp/boards/openmote-b/radio_subghz.c index 13c248ba2b..c8055196aa 100644 --- a/bsp/boards/openmote-b/radio_subghz.c +++ b/bsp/boards/openmote-b/radio_subghz.c @@ -151,7 +151,7 @@ void radio_subghz_init(void) { if ((at86rf215_spiReadReg(RG_RF_PN) != 0x34) | (at86rf215_spiReadReg(RG_RF_VN) != 0x03)) { while(1); //UNKNOWN DEVICE, FINISH } - // Write registers to radio -- default configuration OFDM 400kbps + // Write registers to radio -- default configuration 2fsk-50 for( i = 0; i < (sizeof(basic_settings_fsk_option1)/sizeof(registerSetting_t)); i++) { at86rf215_spiWriteReg( basic_settings_fsk_option1[i].addr, basic_settings_fsk_option1[i].data); }; From 79336db9c4ba34910d2ae3006767219c615e3641 Mon Sep 17 00:00:00 2001 From: jmmunoz86 Date: Wed, 12 Sep 2018 17:00:33 +0200 Subject: [PATCH 05/37] using only sub-GHz interface --- openstack/02a-MAClow/IEEE802154E.c | 45 +++++++++++++++++------------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/openstack/02a-MAClow/IEEE802154E.c b/openstack/02a-MAClow/IEEE802154E.c index a31998a672..aa6564d885 100644 --- a/openstack/02a-MAClow/IEEE802154E.c +++ b/openstack/02a-MAClow/IEEE802154E.c @@ -124,6 +124,7 @@ void ieee154e_init(void) { ieee154e_vars.ch_spacing = DEFAULT_CH_SPACING; ieee154e_vars.frequency = DEFAULT_FREQUENCY_CENTER; + ieee154e_vars.radioType = 1; // default hopping template memcpy( @@ -547,23 +548,23 @@ port_INLINE void activity_synchronize_newSlot(void) { changeState(S_SYNCLISTEN); // turn off the radio (in case it wasn't yet) - ieee154e_vars.radio_functions[RADIOTPYE_2D4GHZ].radio_rfOff_cb(); - ieee154e_vars.radio_functions[RADIOTPYE_2D4GHZ].radio_setStartFrameCb_cb(ieee154e_startOfFrame); - ieee154e_vars.radio_functions[RADIOTPYE_2D4GHZ].radio_setEndFrameCb_cb(ieee154e_endOfFrame); + ieee154e_vars.radio_functions[RADIOTPYE_SUBGHZ].radio_rfOff_cb(); + ieee154e_vars.radio_functions[RADIOTPYE_SUBGHZ].radio_setStartFrameCb_cb(ieee154e_startOfFrame); + ieee154e_vars.radio_functions[RADIOTPYE_SUBGHZ].radio_setEndFrameCb_cb(ieee154e_endOfFrame); // update record of current channel ieee154e_vars.channel = (openrandom_get16b()&0x0F) + 11; - ieee154e_vars.channel = 26; + ieee154e_vars.channel = 0; // configure the radio to listen to the default synchronizing channel //(uint16_t channel_spacing, uint32_t frequency_0, uint16_t channel); - ieee154e_vars.radio_functions[RADIOTPYE_2D4GHZ].radio_setFrequency_cb(DEFAULT_CH_SPACING,DEFAULT_FREQUENCY_CENTER,ieee154e_vars.channel); + ieee154e_vars.radio_functions[RADIOTPYE_SUBGHZ].radio_setFrequency_cb(DEFAULT_CH_SPACING,DEFAULT_FREQUENCY_CENTER,ieee154e_vars.channel); // switch on the radio in Rx mode. - ieee154e_vars.radio_functions[RADIOTPYE_2D4GHZ].radio_rxEnable_cb(); - ieee154e_vars.radio_functions[RADIOTPYE_2D4GHZ].radio_rxNow_cb(); + ieee154e_vars.radio_functions[RADIOTPYE_SUBGHZ].radio_rxEnable_cb(); + ieee154e_vars.radio_functions[RADIOTPYE_SUBGHZ].radio_rxNow_cb(); } else { // I'm listening last slot ieee154e_stats.numTicsOn += ieee154e_vars.slotDuration; @@ -575,17 +576,17 @@ port_INLINE void activity_synchronize_newSlot(void) { // change the synchronizing channel if ((ieee154e_vars.state==S_SYNCLISTEN) && (ieee154e_vars.singleChannelChanged == TRUE)) { // turn off the radio (in case it wasn't yet) - ieee154e_vars.radio_functions[RADIOTPYE_2D4GHZ].radio_rfOff_cb(); + ieee154e_vars.radio_functions[RADIOTPYE_SUBGHZ].radio_rfOff_cb(); // update record of current channel ieee154e_vars.channel = ieee154e_calculateFrequency(ieee154e_vars.singleChannel); // configure the radio to listen to the default synchronizing channel - ieee154e_vars.radio_functions[RADIOTPYE_2D4GHZ].radio_setFrequency_cb(ieee154e_vars.ch_spacing,ieee154e_vars.frequency,ieee154e_vars.channel); + ieee154e_vars.radio_functions[RADIOTPYE_SUBGHZ].radio_setFrequency_cb(ieee154e_vars.ch_spacing,ieee154e_vars.frequency,ieee154e_vars.channel); // switch on the radio in Rx mode. - ieee154e_vars.radio_functions[RADIOTPYE_2D4GHZ].radio_rxEnable_cb(); - ieee154e_vars.radio_functions[RADIOTPYE_2D4GHZ].radio_rxNow_cb(); + ieee154e_vars.radio_functions[RADIOTPYE_SUBGHZ].radio_rxEnable_cb(); + ieee154e_vars.radio_functions[RADIOTPYE_SUBGHZ].radio_rxNow_cb(); ieee154e_vars.singleChannelChanged = FALSE; } @@ -670,7 +671,7 @@ port_INLINE void activity_synchronize_endOfFrame(PORT_TIMER_WIDTH capturedTime) // retrieve the received data frame from the radio's Rx buffer ieee154e_vars.dataReceived->payload = &(ieee154e_vars.dataReceived->packet[FIRST_FRAME_BYTE]); - ieee154e_vars.radio_functions[RADIOTPYE_2D4GHZ].radio_getReceivedFrame_cb(ieee154e_vars.dataReceived->payload, + ieee154e_vars.radio_functions[RADIOTPYE_SUBGHZ].radio_getReceivedFrame_cb(ieee154e_vars.dataReceived->payload, &ieee154e_vars.dataReceived->length, sizeof(ieee154e_vars.dataReceived->packet), &ieee154e_vars.dataReceived->l1_rssi, @@ -679,7 +680,7 @@ port_INLINE void activity_synchronize_endOfFrame(PORT_TIMER_WIDTH capturedTime) &ieee154e_vars.dataReceived->l1_mcs); // break if packet too short - if (ieee154e_vars.dataReceived->lengthlength>LENGTH_IEEE154_MAX) { + if (ieee154e_vars.dataReceived->lengthlength>LENGTH_IEEE154_MAX) { // break from the do-while loop and execute abort code below openserial_printError(COMPONENT_IEEE802154E,ERR_INVALIDPACKETFROMRADIO, (errorparameter_t)0, @@ -688,7 +689,7 @@ port_INLINE void activity_synchronize_endOfFrame(PORT_TIMER_WIDTH capturedTime) } // toss CRC (2 last bytes) - packetfunctions_tossFooter(ieee154e_vars.dataReceived, ieee154e_vars.radio_functions[RADIOTPYE_2D4GHZ].radio_getCRCLen_cb()); + packetfunctions_tossFooter(ieee154e_vars.dataReceived, ieee154e_vars.radio_functions[RADIOTPYE_SUBGHZ].radio_getCRCLen_cb()); // break if invalid CRC if (ieee154e_vars.dataReceived->l1_crc==FALSE) { @@ -747,7 +748,7 @@ port_INLINE void activity_synchronize_endOfFrame(PORT_TIMER_WIDTH capturedTime) } // turn off the radio - ieee154e_vars.radio_functions[RADIOTPYE_2D4GHZ].radio_rfOff_cb(); + ieee154e_vars.radio_functions[RADIOTPYE_SUBGHZ].radio_rfOff_cb(); // compute radio duty cycle ieee154e_vars.radioOnTics += (sctimer_readCounter()-ieee154e_vars.radioOnInit); @@ -2825,11 +2826,17 @@ different channel offsets in the same slot. \returns The calculated frequency channel, an integer between 11 and 26. */ port_INLINE uint8_t ieee154e_calculateFrequency(uint8_t channelOffset) { - if (ieee154e_vars.singleChannel >= 11 && ieee154e_vars.singleChannel <= 26 ) { - return ieee154e_vars.radio_functions[ieee154e_vars.radioType].radio_calculateFrequency_cb(ieee154e_vars.singleChannel,ieee154e_vars.asnOffset, NUM_CHANNELS, ieee154e_vars.chTemplate, TRUE); // single channel + if (ieee154e_vars.radioType == RADIOTPYE_2D4GHZ){ + if (ieee154e_vars.singleChannel >= 11 && ieee154e_vars.singleChannel <= 26 ) { + return ieee154e_vars.radio_functions[ieee154e_vars.radioType].radio_calculateFrequency_cb(ieee154e_vars.singleChannel,ieee154e_vars.asnOffset, NUM_CHANNELS, ieee154e_vars.chTemplate, TRUE); // single channel + } else { + // channel hopping enabled, use the channel depending on hopping template + return ieee154e_vars.radio_functions[ieee154e_vars.radioType].radio_calculateFrequency_cb(channelOffset,ieee154e_vars.asnOffset, NUM_CHANNELS, ieee154e_vars.chTemplate, FALSE); + } } else { - // channel hopping enabled, use the channel depending on hopping template - return ieee154e_vars.radio_functions[ieee154e_vars.radioType].radio_calculateFrequency_cb(channelOffset,ieee154e_vars.asnOffset, NUM_CHANNELS, ieee154e_vars.chTemplate, FALSE); + if (ieee154e_vars.radioType == RADIOTPYE_SUBGHZ){ + return ieee154e_vars.radio_functions[ieee154e_vars.radioType].radio_calculateFrequency_cb(channelOffset,ieee154e_vars.asnOffset, NUM_CHANNELS, ieee154e_vars.chTemplate, TRUE); + } } } From ad8f24c37c612556e069488ff2001d0ce60ba870 Mon Sep 17 00:00:00 2001 From: jmmunoz86 Date: Wed, 12 Sep 2018 17:01:07 +0200 Subject: [PATCH 06/37] TS 40 ms --- openstack/02a-MAClow/IEEE802154E.h | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/openstack/02a-MAClow/IEEE802154E.h b/openstack/02a-MAClow/IEEE802154E.h index 335808c118..52089c26bb 100644 --- a/openstack/02a-MAClow/IEEE802154E.h +++ b/openstack/02a-MAClow/IEEE802154E.h @@ -167,10 +167,10 @@ enum ieee154e_atomicdurations_enum { TsTxAckDelay = 33, // 1000us TsShortGT = 9, // 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. #else - TsTxOffset = 131, // 4000us - TsLongGT = 43, // 1300us - TsTxAckDelay = 151, // 4606us - TsShortGT = 16, // 500us + TsTxOffset = 260, // 4000us + TsLongGT = 86, // 1300us + TsTxAckDelay = 300, // 4606us + TsShortGT = 80, // 500us #endif TsSlotDuration = PORT_TsSlotDuration, // 10000us // execution speed related @@ -182,12 +182,18 @@ enum ieee154e_atomicdurations_enum { // delayTx = PORT_delayTx, // between GO signal and SFD // delayRx = PORT_delayRx, // between GO signal and start listening // radio watchdog +#ifdef SLOTDURATION_10MS wdRadioTx = 33, // 1000us (needs to be >delayTx) (SCuM need a larger value, 43 is tested and works) wdDataDuration = 164, // 5000us (measured 4280us with max payload) +#else + wdRadioTx = 80, // 1000us (needs to be >delayTx) (SCuM need a larger value, 43 is tested and works) + wdDataDuration = 690, // 23000us (measured 4280us with max payload) +#endif + #ifdef SLOTDURATION_10MS wdAckDuration = 80, // 2400us (measured 1000us) #else - wdAckDuration = 98, // 3000us (measured 1000us) + wdAckDuration = 240, // 5400us using 50 kbps #endif }; From 904fd3431120a6f305dca63c6ef893f1b6e80d9f Mon Sep 17 00:00:00 2001 From: jmmunoz86 Date: Wed, 12 Sep 2018 17:01:41 +0200 Subject: [PATCH 07/37] modif slotframe length to 31 TS --- openstack/02b-MAChigh/schedule.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openstack/02b-MAChigh/schedule.h b/openstack/02b-MAChigh/schedule.h index 94cf3b0079..645eb86078 100644 --- a/openstack/02b-MAChigh/schedule.h +++ b/openstack/02b-MAChigh/schedule.h @@ -17,7 +17,7 @@ The superframe reappears over time and can be arbitrarily long. */ -#define SLOTFRAME_LENGTH 101 //should be 101 +#define SLOTFRAME_LENGTH 31 //should be 101 //draft-ietf-6tisch-minimal-06 #define SCHEDULE_MINIMAL_6TISCH_ACTIVE_CELLS MAX_NUM_RADIOS From edf69f9c41651e634b21c6e9c9981d893664ffce Mon Sep 17 00:00:00 2001 From: jmmunoz86 Date: Wed, 12 Sep 2018 17:02:10 +0200 Subject: [PATCH 08/37] using radiotype = 1 (sub-GHz) --- openstack/02b-MAChigh/sixtop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openstack/02b-MAChigh/sixtop.c b/openstack/02b-MAChigh/sixtop.c index bef24f3ede..b22ad669f5 100644 --- a/openstack/02b-MAChigh/sixtop.c +++ b/openstack/02b-MAChigh/sixtop.c @@ -631,7 +631,7 @@ owerror_t sixtop_send_internal( // msg->l2_radioType = (radioType_t)(msg->l2_dsn&0x01); // } - msg->l2_radioType = 0; + msg->l2_radioType = 1; // change owner to IEEE802154E fetches it from queue msg->owner = COMPONENT_SIXTOP_TO_IEEE802154E; From 8cfe8ebff9c68d2b2e754c90ded5a6161513acd6 Mon Sep 17 00:00:00 2001 From: jmmunoz86 Date: Wed, 12 Sep 2018 17:02:39 +0200 Subject: [PATCH 09/37] update project 40 ms TS --- .../03oos_openwsn/03oos_openwsn.ewd | 30 +- .../03oos_openwsn/03oos_openwsn.ewp | 26 +- .../03oos_openwsn/03oos_openwsn.ewt | 3228 +++++++++-------- 3 files changed, 1688 insertions(+), 1596 deletions(-) diff --git a/projects/openmote-b/03oos_openwsn/03oos_openwsn.ewd b/projects/openmote-b/03oos_openwsn/03oos_openwsn.ewd index 9c03e55807..b34f0c58f2 100644 --- a/projects/openmote-b/03oos_openwsn/03oos_openwsn.ewd +++ b/projects/openmote-b/03oos_openwsn/03oos_openwsn.ewd @@ -11,7 +11,7 @@ C-SPY 2 - 28 + 29 1 1 + @@ -1362,6 +1366,10 @@ $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin 0 + + $TOOLKIT_DIR$\plugins\rtos\Mbed\MbedArmPlugin.ENU.ewplugin + 0 + $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin 0 @@ -1398,6 +1406,10 @@ $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 + + $EW_DIR$\common\plugins\TargetAccessServer\TargetAccessServer.ENU.ewplugin + 0 + $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 @@ -1414,7 +1426,7 @@ C-SPY 2 - 28 + 29 1 0 + @@ -2765,6 +2781,10 @@ $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin 0 + + $TOOLKIT_DIR$\plugins\rtos\Mbed\MbedArmPlugin.ENU.ewplugin + 0 + $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin 0 @@ -2801,6 +2821,10 @@ $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 + + $EW_DIR$\common\plugins\TargetAccessServer\TargetAccessServer.ENU.ewplugin + 0 + $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 diff --git a/projects/openmote-b/03oos_openwsn/03oos_openwsn.ewp b/projects/openmote-b/03oos_openwsn/03oos_openwsn.ewp index 52480b7986..62238c6688 100644 --- a/projects/openmote-b/03oos_openwsn/03oos_openwsn.ewp +++ b/projects/openmote-b/03oos_openwsn/03oos_openwsn.ewp @@ -11,7 +11,7 @@ General 3 - 28 + 29 1 1 + @@ -1059,7 +1063,7 @@ General 3 - 28 + 29 1 0 + diff --git a/projects/openmote-b/03oos_openwsn/03oos_openwsn.ewt b/projects/openmote-b/03oos_openwsn/03oos_openwsn.ewt index a719ad1075..a127861c63 100644 --- a/projects/openmote-b/03oos_openwsn/03oos_openwsn.ewt +++ b/projects/openmote-b/03oos_openwsn/03oos_openwsn.ewt @@ -9,9 +9,9 @@ 1 C-STAT - 260 + 261 - 260 + 261 0 @@ -24,1055 +24,1085 @@ 100 - 1.4.4 + 1.5.0 - + - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - + - - + + - + - + - + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - + + + + + + + + - + - + - + - - - - - - + + + + + + - + - - - + + + - - - + + + - + - - + + - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - + + + + + + + - + - - - - - - - - - + + + + + + + + + - + - + - - - - - - + + + + + + - - + + - + - + - - + + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - + + + - - + + - + - - - - - - + + + + + + - - + + - + - - - - - - - - - - - + + + + + + + + + + + - - - - + + + + - - - - - + + + + + + - - - - + + + + + - + - - - - - + + + + + + + + + + + + + + - - - - + + + + + - - - - - - - - - - - - + + + + + + + + + + + + - - - - + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - + + + + + + - - - - - - - - - + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + + + - - - + + + - - - - - - + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - - + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - + + - - - - - + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - - + + + + + + + + + - - - + + + - - - - - - - - - + + + + + + + + + - - - - - - - - - + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - + + + + + + + - - - - - - - - - + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - + + - - - - - - - + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - + - - - - - - - - - - - - + + + + + + + + + + + + - + - + - - - + + + - - - - - - + + + + + + - - - - + + + + - - + + - - + + - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + + + + + + + + - - - - - + + + + + - + - + - + - + - - - + + + - - - - + + + + - - - - - - - - + + + + + + + + - - - - - + + + + + - - - - + + + + - - + + - + - + - - - - - - - - + + + + + + + + - + - - - + + + - - - - + + + + - - + + - + - - - + + + - - - + + + - + - - + + - - - - - + + + + + - + - - + + - - - - + + + + - - + + - - - + + + - - - - - + + + + + - + - + - + - + - + @@ -1165,9 +1195,9 @@ 0 C-STAT - 260 + 261 - 260 + 261 0 @@ -1180,1055 +1210,1085 @@ 100 - 1.4.4 + 1.5.0 - + - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - + - - + + - + - + - + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - + + + + + + + + - + - + - + - - - - - - + + + + + + - + - - - + + + - - - + + + - + - - + + - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - + + + + + + + - + - - - - - - - - - + + + + + + + + + - + - + - - - - - - + + + + + + - - + + - + - + - - + + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - + + + - - + + - + - - - - - - + + + + + + - - + + - + - - - - - - - - - - - + + + + + + + + + + + - - - - + + + + - - - - - + + + + + + - - - - + + + + + - + - - - - - + + + + + + + + + + + + + + - - - - + + + + + - - - - - - - - - - - - + + + + + + + + + + + + - - - - + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - + + + + + + - - - - - - - - - + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + + + - - - + + + - - - - - - + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - - + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - + + - - - - - + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - - + + + + + + + + + - - - + + + - - - - - - - - - + + + + + + + + + - - - - - - - - - + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - + + + + + + + - - - - - - - - - + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - + + - - - - - - - + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - + - - - - - - - - - - - - + + + + + + + + + + + + - + - + - - - + + + - - - - - - + + + + + + - - - - + + + + - - + + - - + + - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + + + + + + + + - - - - - + + + + + - + - + - + - + - - - + + + - - - - + + + + - - - - - - - - + + + + + + + + - - - - - + + + + + - - - - + + + + - - + + - + - + - - - - - - - - + + + + + + + + - + - - - + + + - - - - + + + + - - + + - + - - - + + + - - - + + + - + - - + + - - - - - + + + + + - + - - + + - - - - + + + + - - + + - - - + + + - - - - - + + + + + - + - + - + - + - + From 51571fbe951f6a77b42650b10e2899c2b41270a3 Mon Sep 17 00:00:00 2001 From: jmmunoz86 Date: Thu, 13 Sep 2018 18:28:15 +0200 Subject: [PATCH 10/37] timing for 2fsk50kbps. --- bsp/boards/openmote-b/board_info.h | 52 +++++++++---------- bsp/boards/openmote-b/radio_subghz.h | 2 +- openstack/02a-MAClow/IEEE802154E.c | 2 +- openstack/02a-MAClow/IEEE802154E.h | 8 +-- openstack/02b-MAChigh/schedule.h | 2 +- .../03oos_macpong/03oos_macpong.ewp | 44 ++++++++-------- 6 files changed, 56 insertions(+), 54 deletions(-) diff --git a/bsp/boards/openmote-b/board_info.h b/bsp/boards/openmote-b/board_info.h index fdda4f909b..c01cca7f23 100644 --- a/bsp/boards/openmote-b/board_info.h +++ b/bsp/boards/openmote-b/board_info.h @@ -62,33 +62,33 @@ // #define SLOTDURATION_10MS // by default, we use 10ms time slot #ifdef SLOTDURATION_10MS -// time-slot related -#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 + // time-slot related + #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 #else // 40 ms -// time-slot related -#define PORT_TsSlotDuration 1300 // counter counts one extra count, see datasheet -// execution speed related -#define PORT_maxTxDataPrepare 130 // 2014us (measured 746us) -#define PORT_maxRxAckPrepare 60 // 305us (measured 83us) -#define PORT_maxRxDataPrepare 66 // 1007us (measured 84us) -#define PORT_maxTxAckPrepare 64 // 305us (measured 219us) -// radio speed related -#define PORT_delayTx 70 // 214us (measured 219us) -#define PORT_delayRx 0 // 0us (can not measure) -// radio watchdog + // time-slot related + #define PORT_TsSlotDuration 1300 // counter counts one extra count, see datasheet + // execution speed related + #define PORT_maxTxDataPrepare 66 // 2014us (measured 746us) + #define PORT_maxRxAckPrepare 30 // 305us (measured 83us) + #define PORT_maxRxDataPrepare 33 // 1007us (measured 84us) + #define PORT_maxTxAckPrepare 32 // 305us (measured 219us) + // radio speed related + #define PORT_delayTx 27 // 214us (measured 219us) + #define PORT_delayRx 0 // 0us (can not measure) + // radio watchdog #endif //===== adaptive_sync accuracy diff --git a/bsp/boards/openmote-b/radio_subghz.h b/bsp/boards/openmote-b/radio_subghz.h index 4264947fc4..620a612cfd 100644 --- a/bsp/boards/openmote-b/radio_subghz.h +++ b/bsp/boards/openmote-b/radio_subghz.h @@ -19,7 +19,7 @@ #define LENGTH_CRC_SUBGHZ 4 #define NUM_CHANNELS_SUBGHZ 4 // number of channels to channel hop on -#define delayTx_SUBGHZ 40 +#define delayTx_SUBGHZ 66 #define delayRx_SUBGHZ 0 //=========================== typedef ========================================= diff --git a/openstack/02a-MAClow/IEEE802154E.c b/openstack/02a-MAClow/IEEE802154E.c index aa6564d885..cb6d3b4f4e 100644 --- a/openstack/02a-MAClow/IEEE802154E.c +++ b/openstack/02a-MAClow/IEEE802154E.c @@ -531,7 +531,7 @@ bool debugPrint_macStats(void) { //======= SYNCHRONIZING port_INLINE void activity_synchronize_newSlot(void) { - // using only 2.4Ghz radio to synchronize. + // using only sub-GHz radio to synchronize. // I'm in the middle of receiving a packet if (ieee154e_vars.state==S_SYNCRX) { diff --git a/openstack/02a-MAClow/IEEE802154E.h b/openstack/02a-MAClow/IEEE802154E.h index 52089c26bb..8a6155de6f 100644 --- a/openstack/02a-MAClow/IEEE802154E.h +++ b/openstack/02a-MAClow/IEEE802154E.h @@ -167,9 +167,9 @@ enum ieee154e_atomicdurations_enum { TsTxAckDelay = 33, // 1000us TsShortGT = 9, // 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. #else - TsTxOffset = 260, // 4000us + TsTxOffset = 180, // 4000us TsLongGT = 86, // 1300us - TsTxAckDelay = 300, // 4606us + TsTxAckDelay = 180, // 4606us TsShortGT = 80, // 500us #endif TsSlotDuration = PORT_TsSlotDuration, // 10000us @@ -186,8 +186,8 @@ enum ieee154e_atomicdurations_enum { wdRadioTx = 33, // 1000us (needs to be >delayTx) (SCuM need a larger value, 43 is tested and works) wdDataDuration = 164, // 5000us (measured 4280us with max payload) #else - wdRadioTx = 80, // 1000us (needs to be >delayTx) (SCuM need a larger value, 43 is tested and works) - wdDataDuration = 690, // 23000us (measured 4280us with max payload) + wdRadioTx = 120, // 1000us (needs to be >delayTx) (SCuM need a larger value, 43 is tested and works) + wdDataDuration = 754, // 23000us (measured 4280us with max payload) #endif #ifdef SLOTDURATION_10MS diff --git a/openstack/02b-MAChigh/schedule.h b/openstack/02b-MAChigh/schedule.h index 645eb86078..1816be3190 100644 --- a/openstack/02b-MAChigh/schedule.h +++ b/openstack/02b-MAChigh/schedule.h @@ -17,7 +17,7 @@ The superframe reappears over time and can be arbitrarily long. */ -#define SLOTFRAME_LENGTH 31 //should be 101 +#define SLOTFRAME_LENGTH 11 //should be 101 //draft-ietf-6tisch-minimal-06 #define SCHEDULE_MINIMAL_6TISCH_ACTIVE_CELLS MAX_NUM_RADIOS diff --git a/projects/openmote-b/03oos_macpong/03oos_macpong.ewp b/projects/openmote-b/03oos_macpong/03oos_macpong.ewp index cceb7c0230..8b26e2b474 100644 --- a/projects/openmote-b/03oos_macpong/03oos_macpong.ewp +++ b/projects/openmote-b/03oos_macpong/03oos_macpong.ewp @@ -11,7 +11,7 @@ General 3 - 28 + 29 1 1 + @@ -1055,7 +1059,7 @@ General 3 - 28 + 29 1 0 + @@ -2310,9 +2318,6 @@ $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\leds.c - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\radio.c - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\radio_subghz.c @@ -2359,9 +2364,6 @@ $PROJ_DIR$\..\..\..\bsp\boards\leds.h - - $PROJ_DIR$\..\..\..\bsp\boards\radio.h - $PROJ_DIR$\..\..\..\bsp\boards\radiotimer.h @@ -2512,6 +2514,12 @@ 02b-MAChigh + + $PROJ_DIR$\..\..\..\openstack\02b-MAChigh\msf.c + + + $PROJ_DIR$\..\..\..\openstack\02b-MAChigh\msf.h + $PROJ_DIR$\..\..\..\openstack\02b-MAChigh\neighbors.c @@ -2527,12 +2535,6 @@ $PROJ_DIR$\..\..\..\openstack\02b-MAChigh\schedule.h - - $PROJ_DIR$\..\..\..\openstack\02b-MAChigh\msf.c - - - $PROJ_DIR$\..\..\..\openstack\02b-MAChigh\msf.h - $PROJ_DIR$\..\..\..\openstack\02b-MAChigh\sixtop.c From 108e7f6db163a11c2e5a781bbc46ac60168aa453 Mon Sep 17 00:00:00 2001 From: jmmunoz86 Date: Fri, 14 Sep 2018 16:59:42 +0200 Subject: [PATCH 11/37] 2fsk-50 CH with 2 ch --- bsp/boards/openmote-b/radio_subghz.h | 4 ++-- openstack/02a-MAClow/IEEE802154E.c | 4 ++-- openstack/02a-MAClow/IEEE802154E.h | 8 ++++++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/bsp/boards/openmote-b/radio_subghz.h b/bsp/boards/openmote-b/radio_subghz.h index 620a612cfd..a53f4e000a 100644 --- a/bsp/boards/openmote-b/radio_subghz.h +++ b/bsp/boards/openmote-b/radio_subghz.h @@ -18,8 +18,8 @@ //=========================== define ========================================== #define LENGTH_CRC_SUBGHZ 4 -#define NUM_CHANNELS_SUBGHZ 4 // number of channels to channel hop on -#define delayTx_SUBGHZ 66 +#define NUM_CHANNELS_SUBGHZ 2 // number of channels to channel hop on +#define delayTx_SUBGHZ 70 #define delayRx_SUBGHZ 0 //=========================== typedef ========================================= diff --git a/openstack/02a-MAClow/IEEE802154E.c b/openstack/02a-MAClow/IEEE802154E.c index cb6d3b4f4e..897a38f325 100644 --- a/openstack/02a-MAClow/IEEE802154E.c +++ b/openstack/02a-MAClow/IEEE802154E.c @@ -116,7 +116,7 @@ void ieee154e_init(void) { memset(&ieee154e_dbg,0,sizeof(ieee154e_dbg_t)); // set singleChannel to 0 to enable channel hopping. - ieee154e_vars.singleChannel = 26; + ieee154e_vars.singleChannel = 0; ieee154e_vars.isAckEnabled = TRUE; ieee154e_vars.isSecurityEnabled = FALSE; ieee154e_vars.slotDuration = TsSlotDuration; @@ -2835,7 +2835,7 @@ port_INLINE uint8_t ieee154e_calculateFrequency(uint8_t channelOffset) { } } else { if (ieee154e_vars.radioType == RADIOTPYE_SUBGHZ){ - return ieee154e_vars.radio_functions[ieee154e_vars.radioType].radio_calculateFrequency_cb(channelOffset,ieee154e_vars.asnOffset, NUM_CHANNELS, ieee154e_vars.chTemplate, TRUE); + return ieee154e_vars.radio_functions[ieee154e_vars.radioType].radio_calculateFrequency_cb(channelOffset,ieee154e_vars.asnOffset, NUM_CHANNELS, ieee154e_vars.chTemplate, FALSE); } } } diff --git a/openstack/02a-MAClow/IEEE802154E.h b/openstack/02a-MAClow/IEEE802154E.h index 8a6155de6f..11af7f57cd 100644 --- a/openstack/02a-MAClow/IEEE802154E.h +++ b/openstack/02a-MAClow/IEEE802154E.h @@ -17,8 +17,12 @@ //=========================== debug define ==================================== //=========================== static ========================================== +//static const uint8_t chTemplate_default[] = { +// 5,6,12,7,15,4,14,11,8,0,1,2,13,3,9,10 +//}; + static const uint8_t chTemplate_default[] = { - 5,6,12,7,15,4,14,11,8,0,1,2,13,3,9,10 + 0,1 }; // refer to RFC8180: https://tools.ietf.org/html/rfc8180#appendix-A.1 @@ -38,7 +42,7 @@ static const uint8_t ebIEsBytestream[] = { #define EB_IE_LEN 28 -#define NUM_CHANNELS 16 // number of channels to channel hop on +#define NUM_CHANNELS 2 // number of channels to channel hop on #define DEFAULT_CH_SPACING 200 // default channel spacing for subghz #define DEFAULT_FREQUENCY_CENTER 863125 // defualt freque #define TXRETRIES 3 // number of MAC retries before declaring failed From 2568331c36a7369f6c1520829d7cd922863e24ce Mon Sep 17 00:00:00 2001 From: jmmunoz86 Date: Mon, 17 Sep 2018 15:58:15 +0200 Subject: [PATCH 12/37] optimize timeslot 2fsk-50 kbps --- bsp/boards/common/openradios.h | 2 ++ bsp/boards/openmote-b/board_info.h | 10 +++++----- bsp/boards/openmote-b/radio_subghz.c | 8 ++++++++ bsp/boards/openmote-b/radio_subghz.h | 6 ++++-- openstack/02a-MAClow/IEEE802154E.c | 24 ++++++++++++++++++------ openstack/02a-MAClow/IEEE802154E.h | 13 +++++++------ openstack/02b-MAChigh/schedule.h | 2 +- 7 files changed, 45 insertions(+), 20 deletions(-) diff --git a/bsp/boards/common/openradios.h b/bsp/boards/common/openradios.h index 9e75f4a0d4..7833adefde 100644 --- a/bsp/boards/common/openradios.h +++ b/bsp/boards/common/openradios.h @@ -94,6 +94,7 @@ typedef uint8_t (*radio_calculateFrequency_cbt)( ); typedef uint8_t (*radio_getDelayTx_cbt)(void); typedef uint8_t (*radio_getDelayRx_cbt)(void); +typedef uint8_t (*radio_getChInitOffset_cbt)(void); typedef struct { radio_powerOn_cbt radio_powerOn_cb; @@ -124,6 +125,7 @@ typedef struct { radio_calculateFrequency_cbt radio_calculateFrequency_cb; radio_getDelayTx_cbt radio_getDelayTx_cb; radio_getDelayRx_cbt radio_getDelayRx_cb; + radio_getChInitOffset_cbt radio_getChInitOffset_cb; } radio_functions_t; typedef struct { diff --git a/bsp/boards/openmote-b/board_info.h b/bsp/boards/openmote-b/board_info.h index c01cca7f23..605e7c7590 100644 --- a/bsp/boards/openmote-b/board_info.h +++ b/bsp/boards/openmote-b/board_info.h @@ -77,14 +77,14 @@ #endif #define PORT_delayRx 0 // 0us (can not measure) // radio watchdog -#else // 40 ms +#else // 35 ms // time-slot related - #define PORT_TsSlotDuration 1300 // counter counts one extra count, see datasheet + #define PORT_TsSlotDuration 1147 // counter counts one extra count, see datasheet // execution speed related - #define PORT_maxTxDataPrepare 66 // 2014us (measured 746us) + #define PORT_maxTxDataPrepare 40 // 2014us (measured 746us) #define PORT_maxRxAckPrepare 30 // 305us (measured 83us) - #define PORT_maxRxDataPrepare 33 // 1007us (measured 84us) - #define PORT_maxTxAckPrepare 32 // 305us (measured 219us) + #define PORT_maxRxDataPrepare 30 // 1007us (measured 84us) + #define PORT_maxTxAckPrepare 40 // 305us (measured 219us) // radio speed related #define PORT_delayTx 27 // 214us (measured 219us) #define PORT_delayRx 0 // 0us (can not measure) diff --git a/bsp/boards/openmote-b/radio_subghz.c b/bsp/boards/openmote-b/radio_subghz.c index c8055196aa..5184ece2b9 100644 --- a/bsp/boards/openmote-b/radio_subghz.c +++ b/bsp/boards/openmote-b/radio_subghz.c @@ -85,6 +85,7 @@ void radio_subghz_setFunctions(radio_functions_t * funcs) { funcs->radio_calculateFrequency_cb = radio_subghz_calculateFrequency; funcs->radio_getDelayTx_cb = radio_subghz_getDelayTx; funcs->radio_getDelayRx_cb = radio_subghz_getDelayRx; + funcs->radio_getChInitOffset_cb = radio_getChInitOffset; } void radio_subghz_powerOn(void) { @@ -192,6 +193,7 @@ void radio_subghz_setEndFrameCb(radio_capture_cbt cb) { //frequency_0 in kHz //frequency_nb integer void radio_subghz_setFrequency(uint16_t channel_spacing, uint32_t frequency_0, uint16_t channel) { + frequency_0 = (frequency_0/25); at86rf215_spiWriteReg(RG_RF09_CS, (uint8_t)(channel_spacing/25)); at86rf215_spiWriteReg(RG_RF09_CCF0L, (uint8_t)(frequency_0%256)); @@ -200,6 +202,7 @@ void radio_subghz_setFrequency(uint16_t channel_spacing, uint32_t frequency_0, u at86rf215_spiWriteReg(RG_RF09_CNM, (uint8_t)(channel/256)); // change state radio_subghz_vars.state = RADIOSTATE_FREQUENCY_SET; + } void radio_subghz_rfOn(void) { @@ -231,6 +234,7 @@ void radio_subghz_loadPacket(uint8_t* packet, uint16_t len) { // change state radio_subghz_vars.state = RADIOSTATE_PACKET_LOADED; //at86rf215_readBurst(0x0306, packet, len); + } radio_state_t radio_subghz_getState(void){ @@ -323,6 +327,10 @@ uint8_t radio_subghz_getDelayRx(void){ return delayRx_SUBGHZ; } +uint8_t radio_getChInitOffset(void){ + return ChInitOffset; +} + //=========================== private ========================================= void radio_subghz_read_isr(){ diff --git a/bsp/boards/openmote-b/radio_subghz.h b/bsp/boards/openmote-b/radio_subghz.h index a53f4e000a..fcfc2a8e0c 100644 --- a/bsp/boards/openmote-b/radio_subghz.h +++ b/bsp/boards/openmote-b/radio_subghz.h @@ -18,9 +18,10 @@ //=========================== define ========================================== #define LENGTH_CRC_SUBGHZ 4 -#define NUM_CHANNELS_SUBGHZ 2 // number of channels to channel hop on -#define delayTx_SUBGHZ 70 +#define NUM_CHANNELS_SUBGHZ 3 // number of channels to channel hop on +#define delayTx_SUBGHZ 67 #define delayRx_SUBGHZ 0 +#define ChInitOffset 0 //=========================== typedef ========================================= //=========================== variables ======================================= @@ -71,6 +72,7 @@ uint8_t radio_subghz_getCRCLen(void); uint8_t radio_subghz_calculateFrequency(uint8_t channelOffset, uint8_t asnOffset, uint8_t numChannels, uint8_t* hopSeq, bool singleChannel); uint8_t radio_subghz_getDelayTx(void); uint8_t radio_subghz_getDelayRx(void); +uint8_t radio_getChInitOffset(void); /** \} \} diff --git a/openstack/02a-MAClow/IEEE802154E.c b/openstack/02a-MAClow/IEEE802154E.c index 897a38f325..f391e4a137 100644 --- a/openstack/02a-MAClow/IEEE802154E.c +++ b/openstack/02a-MAClow/IEEE802154E.c @@ -116,7 +116,7 @@ void ieee154e_init(void) { memset(&ieee154e_dbg,0,sizeof(ieee154e_dbg_t)); // set singleChannel to 0 to enable channel hopping. - ieee154e_vars.singleChannel = 0; + ieee154e_vars.singleChannel = TRUE; ieee154e_vars.isAckEnabled = TRUE; ieee154e_vars.isSecurityEnabled = FALSE; ieee154e_vars.slotDuration = TsSlotDuration; @@ -552,8 +552,11 @@ port_INLINE void activity_synchronize_newSlot(void) { ieee154e_vars.radio_functions[RADIOTPYE_SUBGHZ].radio_setStartFrameCb_cb(ieee154e_startOfFrame); ieee154e_vars.radio_functions[RADIOTPYE_SUBGHZ].radio_setEndFrameCb_cb(ieee154e_endOfFrame); + //get first channel number offset + ieee154e_vars.ChInitOffset = ieee154e_vars.radio_functions[RADIOTPYE_SUBGHZ].radio_getChInitOffset_cb(); + // update record of current channel - ieee154e_vars.channel = (openrandom_get16b()&0x0F) + 11; + ieee154e_vars.channel = (openrandom_get16b()&0x0F) + ieee154e_vars.ChInitOffset; ieee154e_vars.channel = 0; @@ -802,8 +805,12 @@ port_INLINE bool ieee154e_processIEs(OpenQueueEntry_t* pkt, uint16_t* lenIE) { infer the asnOffset based on the fact that ieee154e_vars.channel = 11 + (asnOffset + channelOffset)%16 */ + + //get first channel number offset + ieee154e_vars.ChInitOffset = ieee154e_vars.radio_functions[RADIOTPYE_SUBGHZ].radio_getChInitOffset_cb(); + for (i=0;i= 11 && ieee154e_vars.singleChannel <= 26 ) { return ieee154e_vars.radio_functions[ieee154e_vars.radioType].radio_calculateFrequency_cb(ieee154e_vars.singleChannel,ieee154e_vars.asnOffset, NUM_CHANNELS, ieee154e_vars.chTemplate, TRUE); // single channel @@ -2835,7 +2847,7 @@ port_INLINE uint8_t ieee154e_calculateFrequency(uint8_t channelOffset) { } } else { if (ieee154e_vars.radioType == RADIOTPYE_SUBGHZ){ - return ieee154e_vars.radio_functions[ieee154e_vars.radioType].radio_calculateFrequency_cb(channelOffset,ieee154e_vars.asnOffset, NUM_CHANNELS, ieee154e_vars.chTemplate, FALSE); + return ieee154e_vars.radio_functions[ieee154e_vars.radioType].radio_calculateFrequency_cb(channelOffset,ieee154e_vars.asnOffset, NUM_CHANNELS, ieee154e_vars.chTemplate, TRUE); } } } diff --git a/openstack/02a-MAClow/IEEE802154E.h b/openstack/02a-MAClow/IEEE802154E.h index 11af7f57cd..abd237161d 100644 --- a/openstack/02a-MAClow/IEEE802154E.h +++ b/openstack/02a-MAClow/IEEE802154E.h @@ -22,7 +22,7 @@ //}; static const uint8_t chTemplate_default[] = { - 0,1 + 4,8,15 }; // refer to RFC8180: https://tools.ietf.org/html/rfc8180#appendix-A.1 @@ -42,7 +42,7 @@ static const uint8_t ebIEsBytestream[] = { #define EB_IE_LEN 28 -#define NUM_CHANNELS 2 // number of channels to channel hop on +#define NUM_CHANNELS 3 // number of channels to channel hop on #define DEFAULT_CH_SPACING 200 // default channel spacing for subghz #define DEFAULT_FREQUENCY_CENTER 863125 // defualt freque #define TXRETRIES 3 // number of MAC retries before declaring failed @@ -171,9 +171,9 @@ enum ieee154e_atomicdurations_enum { TsTxAckDelay = 33, // 1000us TsShortGT = 9, // 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. #else - TsTxOffset = 180, // 4000us + TsTxOffset = 120, // 4000us TsLongGT = 86, // 1300us - TsTxAckDelay = 180, // 4606us + TsTxAckDelay = 120, // 4606us TsShortGT = 80, // 500us #endif TsSlotDuration = PORT_TsSlotDuration, // 10000us @@ -190,14 +190,14 @@ enum ieee154e_atomicdurations_enum { wdRadioTx = 33, // 1000us (needs to be >delayTx) (SCuM need a larger value, 43 is tested and works) wdDataDuration = 164, // 5000us (measured 4280us with max payload) #else - wdRadioTx = 120, // 1000us (needs to be >delayTx) (SCuM need a larger value, 43 is tested and works) + wdRadioTx = 140, // 1000us (needs to be >delayTx) (SCuM need a larger value, 43 is tested and works) wdDataDuration = 754, // 23000us (measured 4280us with max payload) #endif #ifdef SLOTDURATION_10MS wdAckDuration = 80, // 2400us (measured 1000us) #else - wdAckDuration = 240, // 5400us using 50 kbps + wdAckDuration = 260, // 5400us using 50 kbps #endif }; @@ -283,6 +283,7 @@ typedef struct { uint32_t startOfSlotReference; // the time refer to the beginning of slot uint8_t delayTx; // radio specific tx delay uint8_t delayRx; // radio specific rx delay + uint8_t ChInitOffset; // first channel, e.g., for O-QPSK 2006 is 11 radio_functions_t* radio_functions; } ieee154e_vars_t; diff --git a/openstack/02b-MAChigh/schedule.h b/openstack/02b-MAChigh/schedule.h index 1816be3190..645eb86078 100644 --- a/openstack/02b-MAChigh/schedule.h +++ b/openstack/02b-MAChigh/schedule.h @@ -17,7 +17,7 @@ The superframe reappears over time and can be arbitrarily long. */ -#define SLOTFRAME_LENGTH 11 //should be 101 +#define SLOTFRAME_LENGTH 31 //should be 101 //draft-ietf-6tisch-minimal-06 #define SCHEDULE_MINIMAL_6TISCH_ACTIVE_CELLS MAX_NUM_RADIOS From 48a0581bd5fedd7f16e262a472d4ae4274129d51 Mon Sep 17 00:00:00 2001 From: jmmunoz86 Date: Tue, 16 Oct 2018 17:17:45 +0200 Subject: [PATCH 13/37] timeslot of 40 ms. One PHY, subGHz. --- bsp/boards/openmote-b/board.c | 2 +- bsp/boards/openmote-b/board_info.h | 10 ++++---- openstack/02a-MAClow/IEEE802154E.c | 38 +++++++++++++++--------------- openstack/02b-MAChigh/schedule.c | 2 +- openstack/cross-layers/openqueue.c | 10 ++++---- 5 files changed, 31 insertions(+), 31 deletions(-) diff --git a/bsp/boards/openmote-b/board.c b/bsp/boards/openmote-b/board.c index 7d22d89bbf..a35e3fefe1 100644 --- a/bsp/boards/openmote-b/board.c +++ b/bsp/boards/openmote-b/board.c @@ -97,7 +97,7 @@ void board_init(void) { radio_2d4ghz_setFunctions(&radio_functions[RADIOTPYE_2D4GHZ]); spi_init(); radio_subghz_init(); - radio_subghz_setFunctions(&radio_functions[RADIOTPYE_SUBGHZ]); + radio_subghz_setFunctions(&radio_functions[RADIOTYPE_SUBGHZ]); // sensors_init(); cryptoengine_init(); diff --git a/bsp/boards/openmote-b/board_info.h b/bsp/boards/openmote-b/board_info.h index 605e7c7590..a2133f5c21 100644 --- a/bsp/boards/openmote-b/board_info.h +++ b/bsp/boards/openmote-b/board_info.h @@ -77,9 +77,9 @@ #endif #define PORT_delayRx 0 // 0us (can not measure) // radio watchdog -#else // 35 ms +#else // 40 ms // time-slot related - #define PORT_TsSlotDuration 1147 // counter counts one extra count, see datasheet + #define PORT_TsSlotDuration 1310 // counter counts one extra count, see datasheet // execution speed related #define PORT_maxTxDataPrepare 40 // 2014us (measured 746us) #define PORT_maxRxAckPrepare 30 // 305us (measured 83us) @@ -113,9 +113,9 @@ //=========================== typedef ======================================== typedef enum { - RADIOTPYE_2D4GHZ = 0, - RADIOTPYE_SUBGHZ = 1, - RADIOTPYE_ANY = 2 + RADIOTYPE_2D4GHZ = 0, + RADIOTYPE_SUBGHZ = 1, + RADIOTYPE_ANY = 2 } radioType_t; //=========================== variables ======================================= diff --git a/openstack/02a-MAClow/IEEE802154E.c b/openstack/02a-MAClow/IEEE802154E.c index f391e4a137..7a910cbef3 100644 --- a/openstack/02a-MAClow/IEEE802154E.c +++ b/openstack/02a-MAClow/IEEE802154E.c @@ -548,12 +548,12 @@ port_INLINE void activity_synchronize_newSlot(void) { changeState(S_SYNCLISTEN); // turn off the radio (in case it wasn't yet) - ieee154e_vars.radio_functions[RADIOTPYE_SUBGHZ].radio_rfOff_cb(); - ieee154e_vars.radio_functions[RADIOTPYE_SUBGHZ].radio_setStartFrameCb_cb(ieee154e_startOfFrame); - ieee154e_vars.radio_functions[RADIOTPYE_SUBGHZ].radio_setEndFrameCb_cb(ieee154e_endOfFrame); + ieee154e_vars.radio_functions[RADIOTYPE_SUBGHZ].radio_rfOff_cb(); + ieee154e_vars.radio_functions[RADIOTYPE_SUBGHZ].radio_setStartFrameCb_cb(ieee154e_startOfFrame); + ieee154e_vars.radio_functions[RADIOTYPE_SUBGHZ].radio_setEndFrameCb_cb(ieee154e_endOfFrame); //get first channel number offset - ieee154e_vars.ChInitOffset = ieee154e_vars.radio_functions[RADIOTPYE_SUBGHZ].radio_getChInitOffset_cb(); + ieee154e_vars.ChInitOffset = ieee154e_vars.radio_functions[RADIOTYPE_SUBGHZ].radio_getChInitOffset_cb(); // update record of current channel ieee154e_vars.channel = (openrandom_get16b()&0x0F) + ieee154e_vars.ChInitOffset; @@ -562,12 +562,12 @@ port_INLINE void activity_synchronize_newSlot(void) { // configure the radio to listen to the default synchronizing channel //(uint16_t channel_spacing, uint32_t frequency_0, uint16_t channel); - ieee154e_vars.radio_functions[RADIOTPYE_SUBGHZ].radio_setFrequency_cb(DEFAULT_CH_SPACING,DEFAULT_FREQUENCY_CENTER,ieee154e_vars.channel); + ieee154e_vars.radio_functions[RADIOTYPE_SUBGHZ].radio_setFrequency_cb(DEFAULT_CH_SPACING,DEFAULT_FREQUENCY_CENTER,ieee154e_vars.channel); // switch on the radio in Rx mode. - ieee154e_vars.radio_functions[RADIOTPYE_SUBGHZ].radio_rxEnable_cb(); - ieee154e_vars.radio_functions[RADIOTPYE_SUBGHZ].radio_rxNow_cb(); + ieee154e_vars.radio_functions[RADIOTYPE_SUBGHZ].radio_rxEnable_cb(); + ieee154e_vars.radio_functions[RADIOTYPE_SUBGHZ].radio_rxNow_cb(); } else { // I'm listening last slot ieee154e_stats.numTicsOn += ieee154e_vars.slotDuration; @@ -579,17 +579,17 @@ port_INLINE void activity_synchronize_newSlot(void) { // change the synchronizing channel if ((ieee154e_vars.state==S_SYNCLISTEN) && (ieee154e_vars.singleChannelChanged == TRUE)) { // turn off the radio (in case it wasn't yet) - ieee154e_vars.radio_functions[RADIOTPYE_SUBGHZ].radio_rfOff_cb(); + ieee154e_vars.radio_functions[RADIOTYPE_SUBGHZ].radio_rfOff_cb(); // update record of current channel ieee154e_vars.channel = ieee154e_calculateFrequency(ieee154e_vars.singleChannel); // configure the radio to listen to the default synchronizing channel - ieee154e_vars.radio_functions[RADIOTPYE_SUBGHZ].radio_setFrequency_cb(ieee154e_vars.ch_spacing,ieee154e_vars.frequency,ieee154e_vars.channel); + ieee154e_vars.radio_functions[RADIOTYPE_SUBGHZ].radio_setFrequency_cb(ieee154e_vars.ch_spacing,ieee154e_vars.frequency,ieee154e_vars.channel); // switch on the radio in Rx mode. - ieee154e_vars.radio_functions[RADIOTPYE_SUBGHZ].radio_rxEnable_cb(); - ieee154e_vars.radio_functions[RADIOTPYE_SUBGHZ].radio_rxNow_cb(); + ieee154e_vars.radio_functions[RADIOTYPE_SUBGHZ].radio_rxEnable_cb(); + ieee154e_vars.radio_functions[RADIOTYPE_SUBGHZ].radio_rxNow_cb(); ieee154e_vars.singleChannelChanged = FALSE; } @@ -674,7 +674,7 @@ port_INLINE void activity_synchronize_endOfFrame(PORT_TIMER_WIDTH capturedTime) // retrieve the received data frame from the radio's Rx buffer ieee154e_vars.dataReceived->payload = &(ieee154e_vars.dataReceived->packet[FIRST_FRAME_BYTE]); - ieee154e_vars.radio_functions[RADIOTPYE_SUBGHZ].radio_getReceivedFrame_cb(ieee154e_vars.dataReceived->payload, + ieee154e_vars.radio_functions[RADIOTYPE_SUBGHZ].radio_getReceivedFrame_cb(ieee154e_vars.dataReceived->payload, &ieee154e_vars.dataReceived->length, sizeof(ieee154e_vars.dataReceived->packet), &ieee154e_vars.dataReceived->l1_rssi, @@ -683,7 +683,7 @@ port_INLINE void activity_synchronize_endOfFrame(PORT_TIMER_WIDTH capturedTime) &ieee154e_vars.dataReceived->l1_mcs); // break if packet too short - if (ieee154e_vars.dataReceived->lengthlength>LENGTH_IEEE154_MAX) { + if (ieee154e_vars.dataReceived->lengthlength>LENGTH_IEEE154_MAX) { // break from the do-while loop and execute abort code below openserial_printError(COMPONENT_IEEE802154E,ERR_INVALIDPACKETFROMRADIO, (errorparameter_t)0, @@ -692,7 +692,7 @@ port_INLINE void activity_synchronize_endOfFrame(PORT_TIMER_WIDTH capturedTime) } // toss CRC (2 last bytes) - packetfunctions_tossFooter(ieee154e_vars.dataReceived, ieee154e_vars.radio_functions[RADIOTPYE_SUBGHZ].radio_getCRCLen_cb()); + packetfunctions_tossFooter(ieee154e_vars.dataReceived, ieee154e_vars.radio_functions[RADIOTYPE_SUBGHZ].radio_getCRCLen_cb()); // break if invalid CRC if (ieee154e_vars.dataReceived->l1_crc==FALSE) { @@ -751,7 +751,7 @@ port_INLINE void activity_synchronize_endOfFrame(PORT_TIMER_WIDTH capturedTime) } // turn off the radio - ieee154e_vars.radio_functions[RADIOTPYE_SUBGHZ].radio_rfOff_cb(); + ieee154e_vars.radio_functions[RADIOTYPE_SUBGHZ].radio_rfOff_cb(); // compute radio duty cycle ieee154e_vars.radioOnTics += (sctimer_readCounter()-ieee154e_vars.radioOnInit); @@ -807,7 +807,7 @@ port_INLINE bool ieee154e_processIEs(OpenQueueEntry_t* pkt, uint16_t* lenIE) { */ //get first channel number offset - ieee154e_vars.ChInitOffset = ieee154e_vars.radio_functions[RADIOTPYE_SUBGHZ].radio_getChInitOffset_cb(); + ieee154e_vars.ChInitOffset = ieee154e_vars.radio_functions[RADIOTYPE_SUBGHZ].radio_getChInitOffset_cb(); for (i=0;i= 11 && ieee154e_vars.singleChannel <= 26 ) { return ieee154e_vars.radio_functions[ieee154e_vars.radioType].radio_calculateFrequency_cb(ieee154e_vars.singleChannel,ieee154e_vars.asnOffset, NUM_CHANNELS, ieee154e_vars.chTemplate, TRUE); // single channel } else { @@ -2846,7 +2846,7 @@ port_INLINE uint8_t ieee154e_calculateFrequency(uint8_t channelOffset) { return ieee154e_vars.radio_functions[ieee154e_vars.radioType].radio_calculateFrequency_cb(channelOffset,ieee154e_vars.asnOffset, NUM_CHANNELS, ieee154e_vars.chTemplate, FALSE); } } else { - if (ieee154e_vars.radioType == RADIOTPYE_SUBGHZ){ + if (ieee154e_vars.radioType == RADIOTYPE_SUBGHZ){ return ieee154e_vars.radio_functions[ieee154e_vars.radioType].radio_calculateFrequency_cb(channelOffset,ieee154e_vars.asnOffset, NUM_CHANNELS, ieee154e_vars.chTemplate, TRUE); } } diff --git a/openstack/02b-MAChigh/schedule.c b/openstack/02b-MAChigh/schedule.c index 1806679413..a529b77cf8 100644 --- a/openstack/02b-MAChigh/schedule.c +++ b/openstack/02b-MAChigh/schedule.c @@ -57,7 +57,7 @@ void schedule_init(void) { FALSE, // shared? 0, // channel offset &temp_neighbor, // neighbor - RADIOTPYE_ANY // not used for serialrx + RADIOTYPE_ANY // not used for serialrx ); } } diff --git a/openstack/cross-layers/openqueue.c b/openstack/cross-layers/openqueue.c index eb329d42c0..a87ff77a4d 100644 --- a/openstack/cross-layers/openqueue.c +++ b/openstack/cross-layers/openqueue.c @@ -190,7 +190,7 @@ OpenQueueEntry_t* openqueue_macGetDataPacket(open_addr_t* toNeighbor, radioType_ for (i=0;il2_payloadIEpresent = 0; //l2-security entry->l2_securityLevel = 0; - entry->l2_radioType = RADIOTPYE_2D4GHZ; + entry->l2_radioType = RADIOTYPE_2D4GHZ; } From 9313be006b6fd1f2bf805f063da4da5acf83a92c Mon Sep 17 00:00:00 2001 From: jmmunoz86 Date: Wed, 17 Oct 2018 12:09:01 +0200 Subject: [PATCH 14/37] 2fsk timing OK. --- bsp/boards/openmote-b/board.c | 2 +- openstack/02a-MAClow/IEEE802154E.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bsp/boards/openmote-b/board.c b/bsp/boards/openmote-b/board.c index a35e3fefe1..dab8e9e506 100644 --- a/bsp/boards/openmote-b/board.c +++ b/bsp/boards/openmote-b/board.c @@ -94,7 +94,7 @@ void board_init(void) { // initialize radios openradios_getFunctions(&radio_functions); radio_2d4ghz_init(); - radio_2d4ghz_setFunctions(&radio_functions[RADIOTPYE_2D4GHZ]); + radio_2d4ghz_setFunctions(&radio_functions[RADIOTYPE_2D4GHZ]); spi_init(); radio_subghz_init(); radio_subghz_setFunctions(&radio_functions[RADIOTYPE_SUBGHZ]); diff --git a/openstack/02a-MAClow/IEEE802154E.h b/openstack/02a-MAClow/IEEE802154E.h index abd237161d..b7877277b8 100644 --- a/openstack/02a-MAClow/IEEE802154E.h +++ b/openstack/02a-MAClow/IEEE802154E.h @@ -173,7 +173,7 @@ enum ieee154e_atomicdurations_enum { #else TsTxOffset = 120, // 4000us TsLongGT = 86, // 1300us - TsTxAckDelay = 120, // 4606us + TsTxAckDelay = 140, // 4606us TsShortGT = 80, // 500us #endif TsSlotDuration = PORT_TsSlotDuration, // 10000us From d4973c122c6e2f06e67a71b28aabbfe1961effed Mon Sep 17 00:00:00 2001 From: jmmunoz86 Date: Thu, 18 Oct 2018 11:49:20 +0200 Subject: [PATCH 15/37] refactoring: changing radiotype for modem. radiotype defines PHYs whereas modem either sub-ghz or 2.4 ghz. --- bsp/boards/common/openradios.h | 2 +- bsp/boards/openmote-b/board.c | 4 +- bsp/boards/openmote-b/board_info.h | 17 +++-- openstack/02a-MAClow/IEEE802154E.c | 111 +++++++++++++++-------------- openstack/02a-MAClow/IEEE802154E.h | 6 +- 5 files changed, 74 insertions(+), 66 deletions(-) diff --git a/bsp/boards/common/openradios.h b/bsp/boards/common/openradios.h index 7833adefde..9f669bff9e 100644 --- a/bsp/boards/common/openradios.h +++ b/bsp/boards/common/openradios.h @@ -129,7 +129,7 @@ typedef struct { } radio_functions_t; typedef struct { - radio_functions_t radio_funct[MAX_NUM_RADIOS]; + radio_functions_t radio_funct[MAX_NUM_MODEM]; } openradios_vars_t; //=========================== variables ======================================= diff --git a/bsp/boards/openmote-b/board.c b/bsp/boards/openmote-b/board.c index dab8e9e506..35c3ca99c7 100644 --- a/bsp/boards/openmote-b/board.c +++ b/bsp/boards/openmote-b/board.c @@ -94,10 +94,10 @@ void board_init(void) { // initialize radios openradios_getFunctions(&radio_functions); radio_2d4ghz_init(); - radio_2d4ghz_setFunctions(&radio_functions[RADIOTYPE_2D4GHZ]); + radio_2d4ghz_setFunctions(&radio_functions[MODEM_2D4GHZ]); spi_init(); radio_subghz_init(); - radio_subghz_setFunctions(&radio_functions[RADIOTYPE_SUBGHZ]); + radio_subghz_setFunctions(&radio_functions[MODEM_SUBGHZ]); // sensors_init(); cryptoengine_init(); diff --git a/bsp/boards/openmote-b/board_info.h b/bsp/boards/openmote-b/board_info.h index a2133f5c21..84e2609ee3 100644 --- a/bsp/boards/openmote-b/board_info.h +++ b/bsp/boards/openmote-b/board_info.h @@ -106,16 +106,23 @@ // number of radios in this board. -#define MAX_NUM_RADIOS 2 - +#define MAX_NUM_MODEM 2 // sub-GHz and 2.4 GHz interfaces or modem +#define MAX_NUM_RADIOS 2 // amount of active PHYs. //#define DAGROOT //=========================== typedef ======================================== typedef enum { - RADIOTYPE_2D4GHZ = 0, - RADIOTYPE_SUBGHZ = 1, - RADIOTYPE_ANY = 2 + MODEM_2D4GHZ = 0, + MODEM_SUBGHZ = 1, + FREQBAND_ANY = 2 +} modem_t; + +typedef enum { + RADIOTYPE_2D4GHZ = 0, + RADIOTYPE_SUBGHZ_OFDM_1_800 = 1, + RADIOTYPE_SUBGHZ_2FSK_50 = 2, + RADIOTYPE_ANY = 3 } radioType_t; //=========================== variables ======================================= diff --git a/openstack/02a-MAClow/IEEE802154E.c b/openstack/02a-MAClow/IEEE802154E.c index 7a910cbef3..6cb4545c6a 100644 --- a/openstack/02a-MAClow/IEEE802154E.c +++ b/openstack/02a-MAClow/IEEE802154E.c @@ -124,8 +124,9 @@ void ieee154e_init(void) { ieee154e_vars.ch_spacing = DEFAULT_CH_SPACING; ieee154e_vars.frequency = DEFAULT_FREQUENCY_CENTER; - ieee154e_vars.radioType = 1; - + ieee154e_vars.modem = MODEM_SUBGHZ; + ieee154e_vars.radioType = RADIOTYPE_SUBGHZ_2FSK_50; + // default hopping template memcpy( &(ieee154e_vars.chTemplate[0]), @@ -145,7 +146,7 @@ void ieee154e_init(void) { openradios_getFunctions(&ieee154e_vars.radio_functions); // switch all radios radio on - for (i=0;ipayload = &(ieee154e_vars.dataReceived->packet[FIRST_FRAME_BYTE]); - ieee154e_vars.radio_functions[RADIOTYPE_SUBGHZ].radio_getReceivedFrame_cb(ieee154e_vars.dataReceived->payload, + ieee154e_vars.radio_functions[MODEM_SUBGHZ].radio_getReceivedFrame_cb(ieee154e_vars.dataReceived->payload, &ieee154e_vars.dataReceived->length, sizeof(ieee154e_vars.dataReceived->packet), &ieee154e_vars.dataReceived->l1_rssi, @@ -683,7 +684,7 @@ port_INLINE void activity_synchronize_endOfFrame(PORT_TIMER_WIDTH capturedTime) &ieee154e_vars.dataReceived->l1_mcs); // break if packet too short - if (ieee154e_vars.dataReceived->lengthlength>LENGTH_IEEE154_MAX) { + if (ieee154e_vars.dataReceived->lengthlength>LENGTH_IEEE154_MAX) { // break from the do-while loop and execute abort code below openserial_printError(COMPONENT_IEEE802154E,ERR_INVALIDPACKETFROMRADIO, (errorparameter_t)0, @@ -692,7 +693,7 @@ port_INLINE void activity_synchronize_endOfFrame(PORT_TIMER_WIDTH capturedTime) } // toss CRC (2 last bytes) - packetfunctions_tossFooter(ieee154e_vars.dataReceived, ieee154e_vars.radio_functions[RADIOTYPE_SUBGHZ].radio_getCRCLen_cb()); + packetfunctions_tossFooter(ieee154e_vars.dataReceived, ieee154e_vars.radio_functions[MODEM_SUBGHZ].radio_getCRCLen_cb()); // break if invalid CRC if (ieee154e_vars.dataReceived->l1_crc==FALSE) { @@ -751,7 +752,7 @@ port_INLINE void activity_synchronize_endOfFrame(PORT_TIMER_WIDTH capturedTime) } // turn off the radio - ieee154e_vars.radio_functions[RADIOTYPE_SUBGHZ].radio_rfOff_cb(); + ieee154e_vars.radio_functions[MODEM_SUBGHZ].radio_rfOff_cb(); // compute radio duty cycle ieee154e_vars.radioOnTics += (sctimer_readCounter()-ieee154e_vars.radioOnInit); @@ -807,7 +808,7 @@ port_INLINE bool ieee154e_processIEs(OpenQueueEntry_t* pkt, uint16_t* lenIE) { */ //get first channel number offset - ieee154e_vars.ChInitOffset = ieee154e_vars.radio_functions[RADIOTYPE_SUBGHZ].radio_getChInitOffset_cb(); + ieee154e_vars.ChInitOffset = ieee154e_vars.radio_functions[MODEM_SUBGHZ].radio_getChInitOffset_cb(); for (i=0;ipayload = &(ieee154e_vars.ackReceived->packet[FIRST_FRAME_BYTE]); - ieee154e_vars.radio_functions[ieee154e_vars.radioType].radio_getReceivedFrame_cb(ieee154e_vars.ackReceived->payload, + ieee154e_vars.radio_functions[ieee154e_vars.modem].radio_getReceivedFrame_cb(ieee154e_vars.ackReceived->payload, &ieee154e_vars.ackReceived->length, sizeof(ieee154e_vars.ackReceived->packet), &ieee154e_vars.ackReceived->l1_rssi, @@ -1567,7 +1568,7 @@ port_INLINE void activity_ti9(PORT_TIMER_WIDTH capturedTime) { &ieee154e_vars.dataReceived->l1_mcs); // break if wrong length - if (ieee154e_vars.ackReceived->lengthlength>LENGTH_IEEE154_MAX) { + if (ieee154e_vars.ackReceived->lengthlength>LENGTH_IEEE154_MAX) { // break from the do-while loop and execute the clean-up code below openserial_printError(COMPONENT_IEEE802154E,ERR_INVALIDPACKETFROMRADIO, (errorparameter_t)1, @@ -1577,7 +1578,7 @@ port_INLINE void activity_ti9(PORT_TIMER_WIDTH capturedTime) { } // toss CRC (2 last bytes) - packetfunctions_tossFooter(ieee154e_vars.ackReceived, ieee154e_vars.radio_functions[ieee154e_vars.radioType].radio_getCRCLen_cb()); + packetfunctions_tossFooter(ieee154e_vars.ackReceived, ieee154e_vars.radio_functions[ieee154e_vars.modem].radio_getCRCLen_cb()); // break if invalid CRC if (ieee154e_vars.ackReceived->l1_crc==FALSE) { @@ -1666,9 +1667,9 @@ port_INLINE void activity_ri2(void) { ); // configure the radio for that frequency - ieee154e_vars.radio_functions[ieee154e_vars.radioType].radio_setFrequency_cb(ieee154e_vars.ch_spacing,ieee154e_vars.frequency,ieee154e_vars.channel); + ieee154e_vars.radio_functions[ieee154e_vars.modem].radio_setFrequency_cb(ieee154e_vars.ch_spacing,ieee154e_vars.frequency,ieee154e_vars.channel); - ieee154e_vars.radio_functions[ieee154e_vars.radioType].radio_rxEnable_cb(); + ieee154e_vars.radio_functions[ieee154e_vars.modem].radio_rxEnable_cb(); #endif ieee154e_vars.radioOnInit=sctimer_readCounter(); ieee154e_vars.radioOnThisSlot=TRUE; @@ -1692,7 +1693,7 @@ port_INLINE void activity_ri3(void) { changeState(S_RXDATALISTEN); // give the 'go' to receive - ieee154e_vars.radio_functions[ieee154e_vars.radioType].radio_rxNow_cb(); + ieee154e_vars.radio_functions[ieee154e_vars.modem].radio_rxNow_cb(); #ifdef SLOT_FSM_IMPLEMENTATION_MULTIPLE_TIMER_INTERRUPT // arm rt3 sctimer_scheduleActionIn(ACTION_SET_TIMEOUT,ieee154e_vars.startOfSlotReference+DURATION_rt3); @@ -1783,7 +1784,7 @@ port_INLINE void activity_ri5(PORT_TIMER_WIDTH capturedTime) { // radiotimer_cancel(); #endif // turn off the radio - ieee154e_vars.radio_functions[ieee154e_vars.radioType].radio_rfOff_cb(); + ieee154e_vars.radio_functions[ieee154e_vars.modem].radio_rfOff_cb(); ieee154e_vars.radioOnTics+=sctimer_readCounter()-ieee154e_vars.radioOnInit; // get a buffer to put the (received) data in ieee154e_vars.dataReceived = openqueue_getFreePacketBuffer(COMPONENT_IEEE802154E); @@ -1815,7 +1816,7 @@ port_INLINE void activity_ri5(PORT_TIMER_WIDTH capturedTime) { // retrieve the received data frame from the radio's Rx buffer ieee154e_vars.dataReceived->payload = &(ieee154e_vars.dataReceived->packet[FIRST_FRAME_BYTE]); - ieee154e_vars.radio_functions[ieee154e_vars.radioType].radio_getReceivedFrame_cb(ieee154e_vars.dataReceived->payload, + ieee154e_vars.radio_functions[ieee154e_vars.modem].radio_getReceivedFrame_cb(ieee154e_vars.dataReceived->payload, &ieee154e_vars.dataReceived->length, sizeof(ieee154e_vars.dataReceived->packet), &ieee154e_vars.dataReceived->l1_rssi, @@ -1825,7 +1826,7 @@ port_INLINE void activity_ri5(PORT_TIMER_WIDTH capturedTime) { ); // break if wrong length - if (ieee154e_vars.dataReceived->lengthlength>LENGTH_IEEE154_MAX ) { + if (ieee154e_vars.dataReceived->lengthlength>LENGTH_IEEE154_MAX ) { // jump to the error code below this do-while loop openserial_printError(COMPONENT_IEEE802154E,ERR_INVALIDPACKETFROMRADIO, (errorparameter_t)2, @@ -1834,7 +1835,7 @@ port_INLINE void activity_ri5(PORT_TIMER_WIDTH capturedTime) { } // toss CRC (2 last bytes) - packetfunctions_tossFooter(ieee154e_vars.dataReceived, ieee154e_vars.radio_functions[ieee154e_vars.radioType].radio_getCRCLen_cb()); + packetfunctions_tossFooter(ieee154e_vars.dataReceived, ieee154e_vars.radio_functions[ieee154e_vars.modem].radio_getCRCLen_cb()); // if CRC doesn't check, stop if (ieee154e_vars.dataReceived->l1_crc==FALSE) { @@ -2092,17 +2093,17 @@ port_INLINE void activity_ri6(void) { } } // space for byte CRC - packetfunctions_reserveFooterSize(ieee154e_vars.ackToSend,ieee154e_vars.radio_functions[ieee154e_vars.radioType].radio_getCRCLen_cb()); + packetfunctions_reserveFooterSize(ieee154e_vars.ackToSend,ieee154e_vars.radio_functions[ieee154e_vars.modem].radio_getCRCLen_cb()); // configure the radio for that frequency - ieee154e_vars.radio_functions[ieee154e_vars.radioType].radio_setFrequency_cb(ieee154e_vars.ch_spacing,ieee154e_vars.frequency,ieee154e_vars.channel); + ieee154e_vars.radio_functions[ieee154e_vars.modem].radio_setFrequency_cb(ieee154e_vars.ch_spacing,ieee154e_vars.frequency,ieee154e_vars.channel); // load the packet in the radio's Tx buffer - ieee154e_vars.radio_functions[ieee154e_vars.radioType].radio_loadPacket_cb(ieee154e_vars.ackToSend->payload, + ieee154e_vars.radio_functions[ieee154e_vars.modem].radio_loadPacket_cb(ieee154e_vars.ackToSend->payload, ieee154e_vars.ackToSend->length); #endif // enable the radio in Tx mode. This does not send that packet. - ieee154e_vars.radio_functions[ieee154e_vars.radioType].radio_txEnable_cb(); + ieee154e_vars.radio_functions[ieee154e_vars.modem].radio_txEnable_cb(); ieee154e_vars.radioOnInit=sctimer_readCounter(); ieee154e_vars.radioOnThisSlot=TRUE; // change state @@ -2137,7 +2138,7 @@ port_INLINE void activity_ri7(void) { ); // give the 'go' to transmit - ieee154e_vars.radio_functions[ieee154e_vars.radioType].radio_txNow_cb(); + ieee154e_vars.radio_functions[ieee154e_vars.modem].radio_txNow_cb(); #endif } @@ -2587,7 +2588,7 @@ port_INLINE void ieee154e_syncSlotOffset(void) { ieee154e_vars.channel = 11 + (asnOffset + channelOffset)%16 */ //get first channel number offset - ieee154e_vars.ChInitOffset = ieee154e_vars.radio_functions[RADIOTYPE_SUBGHZ].radio_getChInitOffset_cb(); + ieee154e_vars.ChInitOffset = ieee154e_vars.radio_functions[MODEM_SUBGHZ].radio_getChInitOffset_cb(); for (i=0;i= 11 && ieee154e_vars.singleChannel <= 26 ) { - return ieee154e_vars.radio_functions[ieee154e_vars.radioType].radio_calculateFrequency_cb(ieee154e_vars.singleChannel,ieee154e_vars.asnOffset, NUM_CHANNELS, ieee154e_vars.chTemplate, TRUE); // single channel + return ieee154e_vars.radio_functions[ieee154e_vars.modem].radio_calculateFrequency_cb(ieee154e_vars.singleChannel,ieee154e_vars.asnOffset, NUM_CHANNELS, ieee154e_vars.chTemplate, TRUE); // single channel } else { // channel hopping enabled, use the channel depending on hopping template - return ieee154e_vars.radio_functions[ieee154e_vars.radioType].radio_calculateFrequency_cb(channelOffset,ieee154e_vars.asnOffset, NUM_CHANNELS, ieee154e_vars.chTemplate, FALSE); + return ieee154e_vars.radio_functions[ieee154e_vars.modem].radio_calculateFrequency_cb(channelOffset,ieee154e_vars.asnOffset, NUM_CHANNELS, ieee154e_vars.chTemplate, FALSE); } } else { - if (ieee154e_vars.radioType == RADIOTYPE_SUBGHZ){ - return ieee154e_vars.radio_functions[ieee154e_vars.radioType].radio_calculateFrequency_cb(channelOffset,ieee154e_vars.asnOffset, NUM_CHANNELS, ieee154e_vars.chTemplate, TRUE); + if (ieee154e_vars.modem == MODEM_SUBGHZ){ + return ieee154e_vars.radio_functions[ieee154e_vars.modem].radio_calculateFrequency_cb(channelOffset,ieee154e_vars.asnOffset, NUM_CHANNELS, ieee154e_vars.chTemplate, TRUE); } } } @@ -2915,7 +2916,7 @@ will do that for you, but assume that something went wrong. void endSlot(void) { // turn off the radio - ieee154e_vars.radio_functions[ieee154e_vars.radioType].radio_rfOff_cb(); + ieee154e_vars.radio_functions[ieee154e_vars.modem].radio_rfOff_cb(); // compute the duty cycle if radio has been turned on if (ieee154e_vars.radioOnThisSlot==TRUE){ diff --git a/openstack/02a-MAClow/IEEE802154E.h b/openstack/02a-MAClow/IEEE802154E.h index b7877277b8..4209c6f1e1 100644 --- a/openstack/02a-MAClow/IEEE802154E.h +++ b/openstack/02a-MAClow/IEEE802154E.h @@ -283,9 +283,9 @@ typedef struct { uint32_t startOfSlotReference; // the time refer to the beginning of slot uint8_t delayTx; // radio specific tx delay uint8_t delayRx; // radio specific rx delay - uint8_t ChInitOffset; // first channel, e.g., for O-QPSK 2006 is 11 - - radio_functions_t* radio_functions; + uint8_t ChInitOffset; // first channel, e.g., for O-QPSK 2006 is 11, for 2fsk is 0 + modem_t modem; // either sub-GHz or 2.4 GHz + radio_functions_t* radio_functions; } ieee154e_vars_t; BEGIN_PACK From d28132a38ebfc4cb36c8b49e8044356b4468cf12 Mon Sep 17 00:00:00 2001 From: jmmunoz86 Date: Thu, 18 Oct 2018 18:30:32 +0200 Subject: [PATCH 16/37] refactoring and cleaning --- bsp/boards/common/openradios.h | 1 - bsp/boards/openmote-b/board_info.h | 15 +- bsp/boards/openmote-b/radio_2d4ghz.c | 1 - bsp/boards/openmote-b/radio_subghz.c | 43 +- bsp/boards/openmote-b/radio_subghz.h | 7 +- bsp/chips/at86rf215/at86rf215.h | 30 +- openstack/02a-MAClow/IEEE802154E.c | 4 +- openstack/02a-MAClow/IEEE802154E.h | 17 +- openstack/02b-MAChigh/schedule.h | 2 +- .../03oos_openwsn/03oos_openwsn.ewt | 3114 ----------------- 10 files changed, 82 insertions(+), 3152 deletions(-) delete mode 100644 projects/openmote-b/03oos_openwsn/03oos_openwsn.ewt diff --git a/bsp/boards/common/openradios.h b/bsp/boards/common/openradios.h index 9f669bff9e..154c78fe16 100644 --- a/bsp/boards/common/openradios.h +++ b/bsp/boards/common/openradios.h @@ -107,7 +107,6 @@ typedef struct { radio_rfOff_cbt radio_rfOff_cb; radio_setFrequency_cbt radio_setFrequency_cb; radio_change_modulation_cbt radio_change_modulation_cb; - radio_change_size_cbt radio_change_size_cb; // reset radio_reset_cbt radio_reset_cb; // TX diff --git a/bsp/boards/openmote-b/board_info.h b/bsp/boards/openmote-b/board_info.h index 84e2609ee3..9d24ae814d 100644 --- a/bsp/boards/openmote-b/board_info.h +++ b/bsp/boards/openmote-b/board_info.h @@ -86,8 +86,10 @@ #define PORT_maxRxDataPrepare 30 // 1007us (measured 84us) #define PORT_maxTxAckPrepare 40 // 305us (measured 219us) // radio speed related - #define PORT_delayTx 27 // 214us (measured 219us) - #define PORT_delayRx 0 // 0us (can not measure) + #define delayTx_2FSK_50 67 + #define delayTx_OFDM1 40 + + #define PORT_wdAckDuration 260 // radio watchdog #endif @@ -109,6 +111,15 @@ #define MAX_NUM_MODEM 2 // sub-GHz and 2.4 GHz interfaces or modem #define MAX_NUM_RADIOS 2 // amount of active PHYs. //#define DAGROOT + + +//#define wdAckDuration 260 // 5400us using 50 kbps +#define NUM_CHANNELS 3 // number of channels to channel hop on +#define DEFAULT_CH_SPACING 200 // default channel spacing for subghz +#define DEFAULT_FREQUENCY_CENTER 863125 // defualt freque +#define delayTx_SUBGHZ 67 +#define delayRx_SUBGHZ 0 +#define NUM_CHANNELS_SUBGHZ 3 //=========================== typedef ======================================== diff --git a/bsp/boards/openmote-b/radio_2d4ghz.c b/bsp/boards/openmote-b/radio_2d4ghz.c index 34cb712f1d..97d906f93a 100644 --- a/bsp/boards/openmote-b/radio_2d4ghz.c +++ b/bsp/boards/openmote-b/radio_2d4ghz.c @@ -71,7 +71,6 @@ void radio_2d4ghz_setFunctions(radio_functions_t* funcs){ funcs->radio_rfOff_cb = radio_2d4ghz_rfOff; funcs->radio_setFrequency_cb = radio_2d4ghz_setFrequency; funcs->radio_change_modulation_cb = radio_2d4ghz_change_modulation; - funcs->radio_change_size_cb = radio_2d4ghz_change_size; // reset funcs->radio_reset_cb = radio_2d4ghz_reset; // TX diff --git a/bsp/boards/openmote-b/radio_subghz.c b/bsp/boards/openmote-b/radio_subghz.c index 5184ece2b9..be1d8ac753 100644 --- a/bsp/boards/openmote-b/radio_subghz.c +++ b/bsp/boards/openmote-b/radio_subghz.c @@ -46,9 +46,15 @@ typedef struct { radio_subghz_vars_t radio_subghz_vars; +phy_tsch_config_t phy_tsch_config_2fsk_50_subGHz; +phy_tsch_config_t phy_tsch_config_ofdm_1_800_subGHz; +phy_tsch_config_t phy_list[3]; + //=========================== public ========================================== static void radio_subghz_read_isr(void); static void radio_subghz_clear_isr(void); +void config_ofdm_1_800_subGHz(void); +void config_2fsk_50_subGHz(void); //isr handler for the radio //static void radio_subghz_isr(void); @@ -67,7 +73,6 @@ void radio_subghz_setFunctions(radio_functions_t * funcs) { funcs->radio_rfOff_cb = radio_subghz_rfOff; funcs->radio_setFrequency_cb = radio_subghz_setFrequency; funcs->radio_change_modulation_cb = radio_subghz_change_modulation; - funcs->radio_change_size_cb = radio_subghz_change_size; // reset funcs->radio_reset_cb = radio_subghz_reset; // TX @@ -153,17 +158,13 @@ void radio_subghz_init(void) { while(1); //UNKNOWN DEVICE, FINISH } // Write registers to radio -- default configuration 2fsk-50 - for( i = 0; i < (sizeof(basic_settings_fsk_option1)/sizeof(registerSetting_t)); i++) { - at86rf215_spiWriteReg( basic_settings_fsk_option1[i].addr, basic_settings_fsk_option1[i].data); + for( i = 0; i < (sizeof(basic_settings_fsk_option1_subghz)/sizeof(registerSetting_t)); i++) { + at86rf215_spiWriteReg( basic_settings_fsk_option1_subghz[i].addr, basic_settings_fsk_option1_subghz[i].data); }; - radio_subghz_read_isr(); -} - -void radio_subghz_change_size(uint16_t* size){ - static int i = 0; - *size = sizes[i%4]; - i++; + config_ofdm_1_800_subGHz(); + config_2fsk_50_subGHz(); + } void radio_subghz_change_modulation(registerSetting_t * mod){ @@ -420,6 +421,28 @@ uint8_t radio_subghz_calculateFrequency(uint8_t channelOffset, uint8_t asnOffset } } +void config_2fsk_50_subGHz(){ + phy_tsch_config_2fsk_50_subGHz.phy_conf = basic_settings_fsk_option1_subghz; + phy_tsch_config_2fsk_50_subGHz.channel_spacing = 200; + phy_tsch_config_2fsk_50_subGHz.center_freq_0 = 863125; + phy_tsch_config_2fsk_50_subGHz.size_config = (sizeof(basic_settings_fsk_option1_subghz)/sizeof(registerSetting_t)); + phy_tsch_config_2fsk_50_subGHz.delayTX = delayTx_2FSK_50; + phy_tsch_config_2fsk_50_subGHz.chTemplate = chTemplate_default_2fsk50[0]; // + phy_tsch_config_2fsk_50_subGHz.num_channels = 34; +} + +void config_ofdm_1_800_subGHz(){ + + phy_tsch_config_ofdm_1_800_subGHz.phy_conf = basic_settings_ofdm_1_mcs3_subghz; + phy_tsch_config_ofdm_1_800_subGHz.channel_spacing = 1200; + phy_tsch_config_ofdm_1_800_subGHz.center_freq_0 = 863625; + phy_tsch_config_ofdm_1_800_subGHz.size_config = (sizeof(basic_settings_ofdm_1_mcs3_subghz)/sizeof(registerSetting_t)); + phy_tsch_config_ofdm_1_800_subGHz.delayTX = delayTx_OFDM1; + phy_tsch_config_ofdm_1_800_subGHz.chTemplate = chTemplate_default_OFDM1[0]; + phy_tsch_config_ofdm_1_800_subGHz.num_channels = 5; + +} + // ==== not used for subghz radio void radio_subghz_loadPacket_prepare(uint8_t* packet, uint8_t len){} void radio_subghz_rxPacket_prepare(void){} diff --git a/bsp/boards/openmote-b/radio_subghz.h b/bsp/boards/openmote-b/radio_subghz.h index fcfc2a8e0c..d78bfda25f 100644 --- a/bsp/boards/openmote-b/radio_subghz.h +++ b/bsp/boards/openmote-b/radio_subghz.h @@ -18,9 +18,9 @@ //=========================== define ========================================== #define LENGTH_CRC_SUBGHZ 4 -#define NUM_CHANNELS_SUBGHZ 3 // number of channels to channel hop on -#define delayTx_SUBGHZ 67 -#define delayRx_SUBGHZ 0 +//#define NUM_CHANNELS_SUBGHZ 3 // number of channels to channel hop on +//#define delayTx_SUBGHZ 67 +//#define delayRx_SUBGHZ 0 #define ChInitOffset 0 //=========================== typedef ========================================= @@ -42,7 +42,6 @@ void radio_subghz_setFrequency(uint16_t channel_spacing, uint32_t frequency_ void radio_subghz_rfOn(void); void radio_subghz_rfOff(void); void radio_subghz_change_modulation(registerSetting_t * mod); -void radio_subghz_change_size(uint16_t* size); // TX void radio_subghz_loadPacket(uint8_t* packet, uint16_t len); void radio_subghz_txEnable(void); diff --git a/bsp/chips/at86rf215/at86rf215.h b/bsp/chips/at86rf215/at86rf215.h index 38be0d14d5..b3e755ffb0 100644 --- a/bsp/chips/at86rf215/at86rf215.h +++ b/bsp/chips/at86rf215/at86rf215.h @@ -35,6 +35,30 @@ typedef struct uint16_t channel; }frequencySetting_t; + +typedef struct { + registerSetting_t const * phy_conf; // modulation configuration + uint16_t channel_spacing; + uint32_t center_freq_0; + uint8_t size_config; // amount of registers to write to set the modulation + uint8_t delayTX; // + uint16_t num_channels; // + uint16_t chTemplate; // +} phy_tsch_config_t; + +static const uint8_t chTemplate_default_2fsk50[] = { // 34 channels available in 2-FSK 50 kbps + 4,8,15 +}; + +static const uint8_t chTemplate_default_OFDM1[] = { // 34 channels available in 2-FSK 50 kbps + 0,2,4 +}; +/* +#define wdAckDuration 260 // 5400us using 50 kbps +#define NUM_CHANNELS 3 // number of channels to channel hop on +#define DEFAULT_CH_SPACING 200 // default channel spacing for subghz +#define DEFAULT_FREQUENCY_CENTER 863125 // defualt freque +*/ /* === MACROS ============================================================== */ #define FLAG_WRITE 0x80 #define FLAG_READ 0x00 @@ -3978,7 +4002,9 @@ void at86rf215_readBurst(uint16_t reg, uint8_t* regValueRead, uint16_t size); //------------------------------------ FSK --------------------------------// -static const registerSetting_t basic_settings_fsk_option1 []={ + + +static const registerSetting_t basic_settings_fsk_option1_subghz []={ {RG_RF09_CMD, 0x02}, //we make sure we are in the trxoff state {RG_RF09_IRQM, 0x1F}, // TRXERR, BATLOW, EDC, TRXRDY, WAKEUP interrupts enabled {RG_RF24_IRQM, 0x00}, @@ -4197,7 +4223,7 @@ static const registerSetting_t basic_settings_ofdm_1_mcs2[] = { {RG_BBC0_OFDMPHRTX, 0x02}, }; -static const registerSetting_t basic_settings_ofdm_1_mcs3[] = { //TODO +static const registerSetting_t basic_settings_ofdm_1_mcs3_subghz[] = { //TODO {RG_RF09_CMD, 0x02}, {RG_RF09_IRQM, 0x1F}, {RG_RF24_IRQM, 0x00}, diff --git a/openstack/02a-MAClow/IEEE802154E.c b/openstack/02a-MAClow/IEEE802154E.c index 6cb4545c6a..1c33fb6aee 100644 --- a/openstack/02a-MAClow/IEEE802154E.c +++ b/openstack/02a-MAClow/IEEE802154E.c @@ -1173,7 +1173,7 @@ port_INLINE void activity_ti1ORri1(void) { } port_INLINE void activity_ti2(void) { - debugpins_frame_toggle(); + // change state changeState(S_TXDATAPREPARE); @@ -1218,7 +1218,7 @@ port_INLINE void activity_ti2(void) { ieee154e_vars.radioOnThisSlot=TRUE; // change state changeState(S_TXDATAREADY); - debugpins_frame_toggle(); + } port_INLINE void activity_tie1(void) { diff --git a/openstack/02a-MAClow/IEEE802154E.h b/openstack/02a-MAClow/IEEE802154E.h index 4209c6f1e1..415d575319 100644 --- a/openstack/02a-MAClow/IEEE802154E.h +++ b/openstack/02a-MAClow/IEEE802154E.h @@ -17,12 +17,8 @@ //=========================== debug define ==================================== //=========================== static ========================================== -//static const uint8_t chTemplate_default[] = { -// 5,6,12,7,15,4,14,11,8,0,1,2,13,3,9,10 -//}; - static const uint8_t chTemplate_default[] = { - 4,8,15 + 5,6,12,7,15,4,14,11,8,0,1,2,13,3,9,10 }; // refer to RFC8180: https://tools.ietf.org/html/rfc8180#appendix-A.1 @@ -41,10 +37,6 @@ static const uint8_t ebIEsBytestream[] = { #define EB_SLOTFRAME_NUMLINK_OFFSET 22 #define EB_IE_LEN 28 - -#define NUM_CHANNELS 3 // number of channels to channel hop on -#define DEFAULT_CH_SPACING 200 // default channel spacing for subghz -#define DEFAULT_FREQUENCY_CENTER 863125 // defualt freque #define TXRETRIES 3 // number of MAC retries before declaring failed #define TX_POWER 31 // 1=-25dBm, 31=0dBm (max value) #define RESYNCHRONIZATIONGUARD 5 // in 32kHz ticks. min distance to the end of the slot to successfully synchronize @@ -193,12 +185,7 @@ enum ieee154e_atomicdurations_enum { wdRadioTx = 140, // 1000us (needs to be >delayTx) (SCuM need a larger value, 43 is tested and works) wdDataDuration = 754, // 23000us (measured 4280us with max payload) #endif - -#ifdef SLOTDURATION_10MS - wdAckDuration = 80, // 2400us (measured 1000us) -#else - wdAckDuration = 260, // 5400us using 50 kbps -#endif + wdAckDuration = PORT_wdAckDuration, // 2400us (measured 1000us) }; //shift of bytes in the linkOption bitmap: draft-ietf-6tisch-minimal-10.txt: page 6 diff --git a/openstack/02b-MAChigh/schedule.h b/openstack/02b-MAChigh/schedule.h index 645eb86078..0423021f75 100644 --- a/openstack/02b-MAChigh/schedule.h +++ b/openstack/02b-MAChigh/schedule.h @@ -17,7 +17,7 @@ The superframe reappears over time and can be arbitrarily long. */ -#define SLOTFRAME_LENGTH 31 //should be 101 +#define SLOTFRAME_LENGTH 31 //should be 101, using 31 so the network synchs faster //draft-ietf-6tisch-minimal-06 #define SCHEDULE_MINIMAL_6TISCH_ACTIVE_CELLS MAX_NUM_RADIOS diff --git a/projects/openmote-b/03oos_openwsn/03oos_openwsn.ewt b/projects/openmote-b/03oos_openwsn/03oos_openwsn.ewt deleted file mode 100644 index a127861c63..0000000000 --- a/projects/openmote-b/03oos_openwsn/03oos_openwsn.ewt +++ /dev/null @@ -1,3114 +0,0 @@ - - - 3 - - Debug - - ARM - - 1 - - C-STAT - 261 - - 261 - - 0 - - 1 - 600 - 0 - 2 - 0 - 1 - 100 - - - 1.5.0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - RuntimeChecking - 0 - - 2 - 1 - 1 - - - - - - - - - - - - - - - - - - - - - - Release - - ARM - - 0 - - C-STAT - 261 - - 261 - - 0 - - 1 - 600 - 0 - 2 - 0 - 1 - 100 - - - 1.5.0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - RuntimeChecking - 0 - - 2 - 1 - 0 - - - - - - - - - - - - - - - - - - - - - - application - - $PROJ_DIR$\..\..\common\03oos_openwsn\03oos_openwsn.c - - - $PROJ_DIR$\..\..\common\03oos_openwsn\03oos_openwsn.h - - - - bsp - - boards - - common - - $PROJ_DIR$\..\..\..\bsp\boards\common\openaes.c - - - $PROJ_DIR$\..\..\..\bsp\boards\common\openaes.h - - - $PROJ_DIR$\..\..\..\bsp\boards\common\openccms.c - - - $PROJ_DIR$\..\..\..\bsp\boards\common\openccms.h - - - $PROJ_DIR$\..\..\..\bsp\boards\common\openradios.c - - - $PROJ_DIR$\..\..\..\bsp\boards\common\openradios.h - - - - openmote-b - - headers - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\headers\hw_aes.h - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\headers\hw_ana_regs.h - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\headers\hw_cctest.h - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\headers\hw_flash_ctrl.h - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\headers\hw_gpio.h - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\headers\hw_gptimer.h - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\headers\hw_i2cm.h - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\headers\hw_i2cs.h - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\headers\hw_ints.h - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\headers\hw_ioc.h - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\headers\hw_memmap.h - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\headers\hw_nvic.h - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\headers\hw_pka.h - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\headers\hw_rfcore_ffsm.h - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\headers\hw_rfcore_sfr.h - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\headers\hw_rfcore_xreg.h - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\headers\hw_smwdthrosc.h - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\headers\hw_soc_adc.h - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\headers\hw_ssi.h - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\headers\hw_sys_ctrl.h - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\headers\hw_types.h - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\headers\hw_uart.h - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\headers\hw_udma.h - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\headers\hw_udmachctl.h - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\headers\hw_usb.h - - - - source - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\source\adc.c - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\source\adc.h - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\source\aes.c - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\source\aes.h - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\source\bl_commands.h - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\source\ccm.c - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\source\ccm.h - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\source\cpu.c - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\source\cpu.h - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\source\debug.c - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\source\debug.h - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\source\ecc_curveinfo.h - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\source\flash.c - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\source\flash.h - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\source\gpio.c - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\source\gpio.h - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\source\gptimer.c - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\source\gptimer.h - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\source\i2c_lib.c - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\source\i2c_lib.h - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\source\interrupt.c - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\source\interrupt.h - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\source\ioc.c - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\source\ioc.h - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\source\pka.c - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\source\pka.h - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\source\rom.h - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\source\sha256.c - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\source\sha256.h - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\source\sleepmode.c - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\source\sleepmode.h - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\source\ssi.c - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\source\ssi.h - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\source\sys_ctrl.c - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\source\sys_ctrl.h - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\source\systick.c - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\source\systick.h - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\source\uarthal.c - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\source\uarthal.h - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\source\udma.c - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\source\udma.h - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\source\watchdog.c - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\source\watchdog.h - - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\adc_sensor.c - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\adc_sensor.h - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\board.c - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\board_info.h - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\cc2538rf.h - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\cryptoengine.c - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\debugpins.c - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\eui64.c - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\i2c.c - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\leds.c - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\radio_2d4ghz.c - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\radio_2d4ghz.h - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\radio_subghz.c - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\radio_subghz.h - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\sctimer.c - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\sensors.c - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\spi.c - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\startup_iar.c - - - $PROJ_DIR$\..\..\..\bsp\boards\openmote-b\uart.c - - - - $PROJ_DIR$\..\..\..\bsp\boards\board.h - - - $PROJ_DIR$\..\..\..\bsp\boards\bsp_timer.h - - - $PROJ_DIR$\..\..\..\bsp\boards\cryptoengine.h - - - $PROJ_DIR$\..\..\..\bsp\boards\debugpins.h - - - $PROJ_DIR$\..\..\..\bsp\boards\eui64.h - - - $PROJ_DIR$\..\..\..\bsp\boards\i2c.h - - - $PROJ_DIR$\..\..\..\bsp\boards\leds.h - - - $PROJ_DIR$\..\..\..\bsp\boards\radio.h - - - $PROJ_DIR$\..\..\..\bsp\boards\radiotimer.h - - - $PROJ_DIR$\..\..\..\bsp\boards\sctimer.h - - - $PROJ_DIR$\..\..\..\bsp\boards\spi.h - - - $PROJ_DIR$\..\..\..\bsp\boards\toolchain_defs.h - - - $PROJ_DIR$\..\..\..\bsp\boards\uart.h - - - - chips - - at86rf215 - - $PROJ_DIR$\..\..\..\bsp\chips\at86rf215\at86rf215.c - - - $PROJ_DIR$\..\..\..\bsp\chips\at86rf215\at86rf215.h - - - - si70x - - $PROJ_DIR$\..\..\..\bsp\chips\si70x\si70x.c - - - $PROJ_DIR$\..\..\..\bsp\chips\si70x\si70x.h - - - - - - drivers - - common - - $PROJ_DIR$\..\..\..\drivers\common\openhdlc.c - - - $PROJ_DIR$\..\..\..\drivers\common\openhdlc.h - - - $PROJ_DIR$\..\..\..\drivers\common\opensensors.c - - - $PROJ_DIR$\..\..\..\drivers\common\opensensors.h - - - $PROJ_DIR$\..\..\..\drivers\common\openserial.c - - - $PROJ_DIR$\..\..\..\drivers\common\openserial.h - - - $PROJ_DIR$\..\..\..\drivers\common\opentimers.c - - - $PROJ_DIR$\..\..\..\drivers\common\opentimers.h - - - - - inc - - $PROJ_DIR$\..\..\..\inc\opendefs.h - - - - kernel - - $PROJ_DIR$\..\..\..\kernel\openos\scheduler.c - - - $PROJ_DIR$\..\..\..\kernel\scheduler.h - - - - openapps - - c6t - - $PROJ_DIR$\..\..\..\openapps\c6t\c6t.c - - - $PROJ_DIR$\..\..\..\openapps\c6t\c6t.h - - - - cexample - - $PROJ_DIR$\..\..\..\openapps\cexample\cexample.c - - - $PROJ_DIR$\..\..\..\openapps\cexample\cexample.h - - - - cinfo - - $PROJ_DIR$\..\..\..\openapps\cinfo\cinfo.c - - - $PROJ_DIR$\..\..\..\openapps\cinfo\cinfo.h - - - - cjoin - - $PROJ_DIR$\..\..\..\openapps\cjoin\cbor.c - - - $PROJ_DIR$\..\..\..\openapps\cjoin\cbor.h - - - $PROJ_DIR$\..\..\..\openapps\cjoin\cjoin.c - - - $PROJ_DIR$\..\..\..\openapps\cjoin\cjoin.h - - - - cleds - - $PROJ_DIR$\..\..\..\openapps\cleds\cleds.c - - - $PROJ_DIR$\..\..\..\openapps\cleds\cleds.h - - - - csensors - - $PROJ_DIR$\..\..\..\openapps\csensors\csensors.c - - - $PROJ_DIR$\..\..\..\openapps\csensors\csensors.h - - - - cstorm - - $PROJ_DIR$\..\..\..\openapps\cstorm\cstorm.c - - - $PROJ_DIR$\..\..\..\openapps\cstorm\cstorm.h - - - - cwellknow - - $PROJ_DIR$\..\..\..\openapps\cwellknown\cwellknown.c - - - $PROJ_DIR$\..\..\..\openapps\cwellknown\cwellknown.h - - - - opencoap - - $PROJ_DIR$\..\..\..\openapps\opencoap\cborencoder.c - - - $PROJ_DIR$\..\..\..\openapps\opencoap\cborencoder.h - - - $PROJ_DIR$\..\..\..\openapps\opencoap\hkdf.c - - - $PROJ_DIR$\..\..\..\openapps\opencoap\hmac.c - - - $PROJ_DIR$\..\..\..\openapps\opencoap\opencoap.c - - - $PROJ_DIR$\..\..\..\openapps\opencoap\opencoap.h - - - $PROJ_DIR$\..\..\..\openapps\opencoap\openoscoap.c - - - $PROJ_DIR$\..\..\..\openapps\opencoap\openoscoap.h - - - $PROJ_DIR$\..\..\..\openapps\opencoap\sha-private.h - - - $PROJ_DIR$\..\..\..\openapps\opencoap\sha.h - - - $PROJ_DIR$\..\..\..\openapps\opencoap\sha224-256.c - - - $PROJ_DIR$\..\..\..\openapps\opencoap\usha.c - - - - rrt - - $PROJ_DIR$\..\..\..\openapps\rrt\rrt.c - - - $PROJ_DIR$\..\..\..\openapps\rrt\rrt.h - - - - uecho - - $PROJ_DIR$\..\..\..\openapps\uecho\uecho.c - - - $PROJ_DIR$\..\..\..\openapps\uecho\uecho.h - - - - uexpiration - - $PROJ_DIR$\..\..\..\openapps\uexpiration\uexpiration.c - - - $PROJ_DIR$\..\..\..\openapps\uexpiration\uexpiration.h - - - - uexpiration_monitor - - $PROJ_DIR$\..\..\..\openapps\uexpiration_monitor\uexpiration_monitor.c - - - $PROJ_DIR$\..\..\..\openapps\uexpiration_monitor\uexpiration_monitor.h - - - - uinject - - $PROJ_DIR$\..\..\..\openapps\uinject\uinject.c - - - $PROJ_DIR$\..\..\..\openapps\uinject\uinject.h - - - - userialbridge - - $PROJ_DIR$\..\..\..\openapps\userialbridge\userialbridge.c - - - $PROJ_DIR$\..\..\..\openapps\userialbridge\userialbridge.h - - - - $PROJ_DIR$\..\..\..\openapps\openapps.c - - - $PROJ_DIR$\..\..\..\openapps\openapps.h - - - - openstack - - 02a-MAClow - - $PROJ_DIR$\..\..\..\openstack\02a-MAClow\adaptive_sync.c - - - $PROJ_DIR$\..\..\..\openstack\02a-MAClow\adaptive_sync.h - - - $PROJ_DIR$\..\..\..\openstack\02a-MAClow\IEEE802154.c - - - $PROJ_DIR$\..\..\..\openstack\02a-MAClow\IEEE802154.h - - - $PROJ_DIR$\..\..\..\openstack\02a-MAClow\IEEE802154_security.c - - - $PROJ_DIR$\..\..\..\openstack\02a-MAClow\IEEE802154_security.h - - - $PROJ_DIR$\..\..\..\openstack\02a-MAClow\IEEE802154E.c - - - $PROJ_DIR$\..\..\..\openstack\02a-MAClow\IEEE802154E.h - - - $PROJ_DIR$\..\..\..\openstack\02a-MAClow\topology.c - - - $PROJ_DIR$\..\..\..\openstack\02a-MAClow\topology.h - - - - 02b-MAChigh - - $PROJ_DIR$\..\..\..\openstack\02b-MAChigh\msf.c - - - $PROJ_DIR$\..\..\..\openstack\02b-MAChigh\msf.h - - - $PROJ_DIR$\..\..\..\openstack\02b-MAChigh\neighbors.c - - - $PROJ_DIR$\..\..\..\openstack\02b-MAChigh\neighbors.h - - - $PROJ_DIR$\..\..\..\openstack\02b-MAChigh\schedule.c - - - $PROJ_DIR$\..\..\..\openstack\02b-MAChigh\schedule.h - - - $PROJ_DIR$\..\..\..\openstack\02b-MAChigh\sixtop.c - - - $PROJ_DIR$\..\..\..\openstack\02b-MAChigh\sixtop.h - - - - 03a-IPHC - - $PROJ_DIR$\..\..\..\openstack\03a-IPHC\iphc.c - - - $PROJ_DIR$\..\..\..\openstack\03a-IPHC\iphc.h - - - $PROJ_DIR$\..\..\..\openstack\03a-IPHC\openbridge.c - - - $PROJ_DIR$\..\..\..\openstack\03a-IPHC\openbridge.h - - - - 03b-IPv6 - - $PROJ_DIR$\..\..\..\openstack\03b-IPv6\forwarding.c - - - $PROJ_DIR$\..\..\..\openstack\03b-IPv6\forwarding.h - - - $PROJ_DIR$\..\..\..\openstack\03b-IPv6\icmpv6.c - - - $PROJ_DIR$\..\..\..\openstack\03b-IPv6\icmpv6.h - - - $PROJ_DIR$\..\..\..\openstack\03b-IPv6\icmpv6echo.c - - - $PROJ_DIR$\..\..\..\openstack\03b-IPv6\icmpv6echo.h - - - $PROJ_DIR$\..\..\..\openstack\03b-IPv6\icmpv6rpl.c - - - $PROJ_DIR$\..\..\..\openstack\03b-IPv6\icmpv6rpl.h - - - - 04-TRAN - - $PROJ_DIR$\..\..\..\openstack\04-TRAN\openudp.c - - - $PROJ_DIR$\..\..\..\openstack\04-TRAN\openudp.h - - - - cross-layers - - $PROJ_DIR$\..\..\..\openstack\cross-layers\idmanager.c - - - $PROJ_DIR$\..\..\..\openstack\cross-layers\idmanager.h - - - $PROJ_DIR$\..\..\..\openstack\cross-layers\openqueue.c - - - $PROJ_DIR$\..\..\..\openstack\cross-layers\openqueue.h - - - $PROJ_DIR$\..\..\..\openstack\cross-layers\openrandom.c - - - $PROJ_DIR$\..\..\..\openstack\cross-layers\openrandom.h - - - $PROJ_DIR$\..\..\..\openstack\cross-layers\packetfunctions.c - - - $PROJ_DIR$\..\..\..\openstack\cross-layers\packetfunctions.h - - - - $PROJ_DIR$\..\..\..\openstack\openstack.c - - - $PROJ_DIR$\..\..\..\openstack\openstack.h - - - From 074bf1391d2881081e72d904559f674a8497b680 Mon Sep 17 00:00:00 2001 From: jmmunoz86 Date: Sun, 21 Oct 2018 23:47:00 +0200 Subject: [PATCH 17/37] adding timing for 3 PHYs --- bsp/boards/common/openradios.h | 11 ++++- bsp/boards/openmote-b/board_info.h | 8 ++-- bsp/boards/openmote-b/radio_2d4ghz.c | 13 +++++- bsp/boards/openmote-b/radio_2d4ghz.h | 8 +++- bsp/boards/openmote-b/radio_subghz.c | 69 ++++++++++++++++++++-------- bsp/boards/openmote-b/radio_subghz.h | 8 +++- bsp/boards/openmote-b/startup_iar.c | 2 +- bsp/chips/at86rf215/at86rf215.h | 2 + openstack/02a-MAClow/IEEE802154E.c | 27 ++++++++++- openstack/02a-MAClow/IEEE802154E.h | 9 ++-- openstack/02b-MAChigh/schedule.c | 1 + openstack/02b-MAChigh/schedule.h | 5 +- openstack/02b-MAChigh/sixtop.c | 4 +- 13 files changed, 129 insertions(+), 38 deletions(-) diff --git a/bsp/boards/common/openradios.h b/bsp/boards/common/openradios.h index 154c78fe16..6b601be305 100644 --- a/bsp/boards/common/openradios.h +++ b/bsp/boards/common/openradios.h @@ -61,7 +61,8 @@ typedef void (*radio_setEndFrameCb_cbt)(radio_capture_cbt cb); typedef void (*radio_rfOn_cbt)(void); typedef void (*radio_rfOff_cbt)(void); typedef void (*radio_setFrequency_cbt)(uint16_t channel_spacing, uint32_t frequency_0, uint16_t channel); -typedef void (*radio_change_modulation_cbt)(registerSetting_t * mod); +//typedef void (*radio_load_phy_cbt)(registerSetting_t * mod, uint8_t size); +typedef void (*radio_load_phy_cbt)(uint8_t phy_index); typedef void (*radio_change_size_cbt)(uint16_t* size); // reset typedef void (*radio_reset_cbt)(void); @@ -95,6 +96,9 @@ typedef uint8_t (*radio_calculateFrequency_cbt)( typedef uint8_t (*radio_getDelayTx_cbt)(void); typedef uint8_t (*radio_getDelayRx_cbt)(void); typedef uint8_t (*radio_getChInitOffset_cbt)(void); +typedef uint16_t (*radio_getNumOfChannels_cbt)(void); +typedef uint16_t (*radio_getCh_spacing_cbt)(void); +typedef uint32_t (*radio_getCenterFreq_cbt)(void); typedef struct { radio_powerOn_cbt radio_powerOn_cb; @@ -106,7 +110,7 @@ typedef struct { radio_rfOn_cbt radio_rfOn_cb; radio_rfOff_cbt radio_rfOff_cb; radio_setFrequency_cbt radio_setFrequency_cb; - radio_change_modulation_cbt radio_change_modulation_cb; + radio_load_phy_cbt radio_load_phy_cb; // reset radio_reset_cbt radio_reset_cb; // TX @@ -125,6 +129,9 @@ typedef struct { radio_getDelayTx_cbt radio_getDelayTx_cb; radio_getDelayRx_cbt radio_getDelayRx_cb; radio_getChInitOffset_cbt radio_getChInitOffset_cb; + radio_getNumOfChannels_cbt radio_getNumOfChannels_cb; + radio_getCh_spacing_cbt radio_getCh_spacing_cb; + radio_getCenterFreq_cbt radio_getCenterFreq_cb; } radio_functions_t; typedef struct { diff --git a/bsp/boards/openmote-b/board_info.h b/bsp/boards/openmote-b/board_info.h index 9d24ae814d..9bd4ab95e9 100644 --- a/bsp/boards/openmote-b/board_info.h +++ b/bsp/boards/openmote-b/board_info.h @@ -90,6 +90,8 @@ #define delayTx_OFDM1 40 #define PORT_wdAckDuration 260 + #define PORT_wdRadioTx 140 // for 2FSK 50 kbps + #define PORT_wdDataDuration 754 // for 2FSK 50 kbps // radio watchdog #endif @@ -109,7 +111,7 @@ // number of radios in this board. #define MAX_NUM_MODEM 2 // sub-GHz and 2.4 GHz interfaces or modem -#define MAX_NUM_RADIOS 2 // amount of active PHYs. +#define MAX_NUM_RADIOS 3 // amount of active PHYs. //#define DAGROOT @@ -117,6 +119,7 @@ #define NUM_CHANNELS 3 // number of channels to channel hop on #define DEFAULT_CH_SPACING 200 // default channel spacing for subghz #define DEFAULT_FREQUENCY_CENTER 863125 // defualt freque +//#define delayTx_SUBGHZ 67 #define delayTx_SUBGHZ 67 #define delayRx_SUBGHZ 0 #define NUM_CHANNELS_SUBGHZ 3 @@ -125,8 +128,7 @@ typedef enum { MODEM_2D4GHZ = 0, - MODEM_SUBGHZ = 1, - FREQBAND_ANY = 2 + MODEM_SUBGHZ = 1 } modem_t; typedef enum { diff --git a/bsp/boards/openmote-b/radio_2d4ghz.c b/bsp/boards/openmote-b/radio_2d4ghz.c index 97d906f93a..5396e6758f 100644 --- a/bsp/boards/openmote-b/radio_2d4ghz.c +++ b/bsp/boards/openmote-b/radio_2d4ghz.c @@ -70,7 +70,7 @@ void radio_2d4ghz_setFunctions(radio_functions_t* funcs){ funcs->radio_rfOn_cb = radio_2d4ghz_rfOn; funcs->radio_rfOff_cb = radio_2d4ghz_rfOff; funcs->radio_setFrequency_cb = radio_2d4ghz_setFrequency; - funcs->radio_change_modulation_cb = radio_2d4ghz_change_modulation; + funcs->radio_load_phy_cb = radio_2d4ghz_load_phy; // reset funcs->radio_reset_cb = radio_2d4ghz_reset; // TX @@ -88,6 +88,10 @@ void radio_2d4ghz_setFunctions(radio_functions_t* funcs){ funcs->radio_calculateFrequency_cb = radio_2d4ghz_calculateFrequency; funcs->radio_getDelayTx_cb = radio_2d4ghz_getDelayTx; funcs->radio_getDelayRx_cb = radio_2d4ghz_getDelayRx; + funcs->radio_getChInitOffset_cb = radio_2d4ghz_getChInitOffset; + funcs->radio_getCh_spacing_cb = radio_2d4ghz_getCh_spacing_cb; + funcs->radio_getNumOfChannels_cb = radio_2d4ghz_getNumOfChannels_cb; + funcs->radio_getCenterFreq_cb = radio_2d4ghz_getCenterFreq_cb; } void radio_2d4ghz_init() { @@ -590,8 +594,13 @@ uint8_t radio_2d4ghz_calculateFrequency(uint8_t channelOffset, uint8_t asnOffset // not used by 2.4ghz radio void radio_2d4ghz_powerOn(void){} -void radio_2d4ghz_change_modulation(registerSetting_t * mod){} +//void radio_2d4ghz_load_phy(registerSetting_t * mod, uint8_t size){} +void radio_2d4ghz_load_phy(uint8_t phy_index){} void radio_2d4ghz_change_size(uint16_t* size){} void radio_2d4ghz_loadPacket_prepare(uint8_t* packet, uint8_t len){} void radio_2d4ghz_rxPacket_prepare(void){} void radio_2d4ghz_rxEnable_scum(void){} +uint8_t radio_2d4ghz_getChInitOffset(void){} +uint16_t radio_2d4ghz_getNumOfChannels_cb(void){} +uint16_t radio_2d4ghz_getCh_spacing_cb(void){} +uint32_t radio_2d4ghz_getCenterFreq_cb(void){} diff --git a/bsp/boards/openmote-b/radio_2d4ghz.h b/bsp/boards/openmote-b/radio_2d4ghz.h index 4ee923ecb1..33b4f54c3d 100644 --- a/bsp/boards/openmote-b/radio_2d4ghz.h +++ b/bsp/boards/openmote-b/radio_2d4ghz.h @@ -45,8 +45,8 @@ void radio_2d4ghz_setEndFrameCb(radio_capture_cbt cb); void radio_2d4ghz_rfOn(void); void radio_2d4ghz_rfOff(void); void radio_2d4ghz_setFrequency(uint16_t channel_spacing, uint32_t frequency_0, uint16_t channel); -void radio_2d4ghz_change_modulation(registerSetting_t * mod); -void radio_2d4ghz_change_size(uint16_t* size); +//void radio_2d4ghz_load_phy(registerSetting_t * mod, uint8_t size); +void radio_2d4ghz_load_phy(uint8_t phy_index); // reset void radio_2d4ghz_reset(void); // TX @@ -70,6 +70,10 @@ uint8_t radio_2d4ghz_getCRCLen(void); uint8_t radio_2d4ghz_calculateFrequency(uint8_t channelOffset, uint8_t asnOffset, uint8_t numChannels, uint8_t* hopSeq, bool singleChannel); uint8_t radio_2d4ghz_getDelayTx(void); uint8_t radio_2d4ghz_getDelayRx(void); +uint8_t radio_2d4ghz_getChInitOffset(void); +uint16_t radio_2d4ghz_getNumOfChannels_cb(void); +uint16_t radio_2d4ghz_getCh_spacing_cb(void); +uint32_t radio_2d4ghz_getCenterFreq_cb(void); // interrupt handlers kick_scheduler_t radio_2d4ghz_isr(void); diff --git a/bsp/boards/openmote-b/radio_subghz.c b/bsp/boards/openmote-b/radio_subghz.c index be1d8ac753..1170cf4bc6 100644 --- a/bsp/boards/openmote-b/radio_subghz.c +++ b/bsp/boards/openmote-b/radio_subghz.c @@ -42,13 +42,19 @@ typedef struct { uint8_t rf24_isr; uint8_t bb0_isr; uint8_t bb1_isr; + phy_tsch_config_t phy_tsch_config_current; + phy_tsch_config_t phy_list[MAX_NUM_RADIOS]; + //uint8_t delayTx; + //uint16_t channel_spacing; + //uint32_t center_freq_0; + //uint16_t num_channels; + //uint16_t chTemplate; } radio_subghz_vars_t; radio_subghz_vars_t radio_subghz_vars; phy_tsch_config_t phy_tsch_config_2fsk_50_subGHz; phy_tsch_config_t phy_tsch_config_ofdm_1_800_subGHz; -phy_tsch_config_t phy_list[3]; //=========================== public ========================================== static void radio_subghz_read_isr(void); @@ -62,7 +68,6 @@ void config_2fsk_50_subGHz(void); //===== admin void radio_subghz_setFunctions(radio_functions_t * funcs) { - funcs->radio_change_modulation_cb = radio_subghz_change_modulation; funcs->radio_powerOn_cb = radio_subghz_powerOn; // RF admin funcs->radio_init_cb = radio_subghz_init; @@ -72,7 +77,7 @@ void radio_subghz_setFunctions(radio_functions_t * funcs) { funcs->radio_rfOn_cb = radio_subghz_rfOn; funcs->radio_rfOff_cb = radio_subghz_rfOff; funcs->radio_setFrequency_cb = radio_subghz_setFrequency; - funcs->radio_change_modulation_cb = radio_subghz_change_modulation; + funcs->radio_load_phy_cb = radio_subghz_load_phy; // reset funcs->radio_reset_cb = radio_subghz_reset; // TX @@ -90,7 +95,10 @@ void radio_subghz_setFunctions(radio_functions_t * funcs) { funcs->radio_calculateFrequency_cb = radio_subghz_calculateFrequency; funcs->radio_getDelayTx_cb = radio_subghz_getDelayTx; funcs->radio_getDelayRx_cb = radio_subghz_getDelayRx; - funcs->radio_getChInitOffset_cb = radio_getChInitOffset; + funcs->radio_getChInitOffset_cb = radio_subghz_getChInitOffset; + funcs->radio_getCh_spacing_cb = radio_subghz_getCh_spacing_cb; + funcs->radio_getNumOfChannels_cb = radio_subghz_getNumOfChannels_cb; + funcs->radio_getCenterFreq_cb = radio_subghz_getCenterFreq_cb; } void radio_subghz_powerOn(void) { @@ -164,21 +172,29 @@ void radio_subghz_init(void) { radio_subghz_read_isr(); config_ofdm_1_800_subGHz(); config_2fsk_50_subGHz(); - + radio_subghz_vars.phy_list[0] = phy_tsch_config_2fsk_50_subGHz; + radio_subghz_vars.phy_list[1] = phy_tsch_config_2fsk_50_subGHz; + radio_subghz_vars.phy_list[2] = phy_tsch_config_ofdm_1_800_subGHz; } -void radio_subghz_change_modulation(registerSetting_t * mod){ - static int mod_list = 1; - uint16_t i; - -at86rf215_spiStrobe(CMD_RF_TRXOFF); +//void radio_subghz_load_phy(registerSetting_t * mod, uint8_t size, uint8_t phy_index){ +void radio_subghz_load_phy(uint8_t phy_index){ + uint8_t i; + at86rf215_spiStrobe(CMD_RF_TRXOFF); while(at86rf215_status() != RF_STATE_TRXOFF); - for( i = 0; i < (sizeof(*mod)/sizeof(registerSetting_t)); i++) { - at86rf215_spiWriteReg( mod[i].addr, mod[i].data); +// for( i = 0; i < size; i++) { +// at86rf215_spiWriteReg( mod[i].addr, mod[i].data); +// }; + for (i=0; i < radio_subghz_vars.phy_list[phy_index].size_config; i++){ + at86rf215_spiWriteReg(radio_subghz_vars.phy_list[phy_index].phy_conf[i].addr, radio_subghz_vars.phy_list[phy_index].phy_conf[i].data); }; + radio_subghz_read_isr(); - mod_list++; + //radio_subghz_vars.delayTx = radio_subghz_vars.phy_list[phy_index].delayTX; + radio_subghz_vars.phy_tsch_config_current = radio_subghz_vars.phy_list[phy_index]; + // radio_subghz_setFrequency(radio_subghz_vars.phy_list[phy_index].channel_spacing, radio_subghz_vars.phy_list[phy_index].center_freq_0, radio_subghz_vars.phy_list[phy_index]) + } void radio_subghz_setStartFrameCb(radio_capture_cbt cb) { @@ -321,17 +337,31 @@ uint8_t radio_subghz_getCRCLen(void){ } uint8_t radio_subghz_getDelayTx(void){ - return delayTx_SUBGHZ; + //return delayTx_SUBGHZ; + return radio_subghz_vars.phy_tsch_config_current.delayTX; } uint8_t radio_subghz_getDelayRx(void){ - return delayRx_SUBGHZ; + //return delayRx_SUBGHZ; + return radio_subghz_vars.phy_tsch_config_current.delayRX; } -uint8_t radio_getChInitOffset(void){ - return ChInitOffset; +uint8_t radio_subghz_getChInitOffset(void){ + //return ChInitOffset; + return radio_subghz_vars.phy_tsch_config_current.chInitOffset; } +uint16_t radio_subghz_getNumOfChannels_cb(void){ + return radio_subghz_vars.phy_tsch_config_current.num_channels; +} + +uint16_t radio_subghz_getCh_spacing_cb(void){ + return radio_subghz_vars.phy_tsch_config_current.channel_spacing; +} + +uint32_t radio_subghz_getCenterFreq_cb(void){ + return radio_subghz_vars.phy_tsch_config_current.center_freq_0; +} //=========================== private ========================================= void radio_subghz_read_isr(){ @@ -427,8 +457,10 @@ void config_2fsk_50_subGHz(){ phy_tsch_config_2fsk_50_subGHz.center_freq_0 = 863125; phy_tsch_config_2fsk_50_subGHz.size_config = (sizeof(basic_settings_fsk_option1_subghz)/sizeof(registerSetting_t)); phy_tsch_config_2fsk_50_subGHz.delayTX = delayTx_2FSK_50; + phy_tsch_config_2fsk_50_subGHz.delayRX = delayRx_SUBGHZ; phy_tsch_config_2fsk_50_subGHz.chTemplate = chTemplate_default_2fsk50[0]; // phy_tsch_config_2fsk_50_subGHz.num_channels = 34; + phy_tsch_config_2fsk_50_subGHz.chInitOffset = 0; } void config_ofdm_1_800_subGHz(){ @@ -438,9 +470,10 @@ void config_ofdm_1_800_subGHz(){ phy_tsch_config_ofdm_1_800_subGHz.center_freq_0 = 863625; phy_tsch_config_ofdm_1_800_subGHz.size_config = (sizeof(basic_settings_ofdm_1_mcs3_subghz)/sizeof(registerSetting_t)); phy_tsch_config_ofdm_1_800_subGHz.delayTX = delayTx_OFDM1; + phy_tsch_config_ofdm_1_800_subGHz.delayRX = delayRx_SUBGHZ; phy_tsch_config_ofdm_1_800_subGHz.chTemplate = chTemplate_default_OFDM1[0]; phy_tsch_config_ofdm_1_800_subGHz.num_channels = 5; - + phy_tsch_config_ofdm_1_800_subGHz.chInitOffset = 0; } // ==== not used for subghz radio diff --git a/bsp/boards/openmote-b/radio_subghz.h b/bsp/boards/openmote-b/radio_subghz.h index d78bfda25f..4fdb984eb8 100644 --- a/bsp/boards/openmote-b/radio_subghz.h +++ b/bsp/boards/openmote-b/radio_subghz.h @@ -41,7 +41,8 @@ void radio_subghz_reset(void); void radio_subghz_setFrequency(uint16_t channel_spacing, uint32_t frequency_0, uint16_t channel); void radio_subghz_rfOn(void); void radio_subghz_rfOff(void); -void radio_subghz_change_modulation(registerSetting_t * mod); +//void radio_subghz_change_modulation(registerSetting_t * mod, uint8_t size); +void radio_subghz_load_phy(uint8_t phy_index); // TX void radio_subghz_loadPacket(uint8_t* packet, uint16_t len); void radio_subghz_txEnable(void); @@ -71,7 +72,10 @@ uint8_t radio_subghz_getCRCLen(void); uint8_t radio_subghz_calculateFrequency(uint8_t channelOffset, uint8_t asnOffset, uint8_t numChannels, uint8_t* hopSeq, bool singleChannel); uint8_t radio_subghz_getDelayTx(void); uint8_t radio_subghz_getDelayRx(void); -uint8_t radio_getChInitOffset(void); +uint8_t radio_subghz_getChInitOffset(void); +uint16_t radio_subghz_getCh_spacing_cb(void); +uint16_t radio_subghz_getNumOfChannels_cb(void); +uint32_t radio_subghz_getCenterFreq_cb(void); /** \} \} diff --git a/bsp/boards/openmote-b/startup_iar.c b/bsp/boards/openmote-b/startup_iar.c index 2a81de7c79..4b7c2ad585 100644 --- a/bsp/boards/openmote-b/startup_iar.c +++ b/bsp/boards/openmote-b/startup_iar.c @@ -191,7 +191,7 @@ lockPageCCA_t; __root const lockPageCCA_t __cca @ ".flashcca" = { - BOOTLOADER_BACKDOOR_DISABLE, // Bootloader backdoor enabled + BOOTLOADER_BACKDOOR_ENABLE, // Bootloader backdoor enabled 0, // Image valid bytes FLASH_START_ADDR // Vector table located at flash start address }; diff --git a/bsp/chips/at86rf215/at86rf215.h b/bsp/chips/at86rf215/at86rf215.h index b3e755ffb0..fad6b883f2 100644 --- a/bsp/chips/at86rf215/at86rf215.h +++ b/bsp/chips/at86rf215/at86rf215.h @@ -42,8 +42,10 @@ typedef struct { uint32_t center_freq_0; uint8_t size_config; // amount of registers to write to set the modulation uint8_t delayTX; // + uint8_t delayRX; uint16_t num_channels; // uint16_t chTemplate; // + uint8_t chInitOffset; } phy_tsch_config_t; static const uint8_t chTemplate_default_2fsk50[] = { // 34 channels available in 2-FSK 50 kbps diff --git a/openstack/02a-MAClow/IEEE802154E.c b/openstack/02a-MAClow/IEEE802154E.c index 1c33fb6aee..e9e2885db4 100644 --- a/openstack/02a-MAClow/IEEE802154E.c +++ b/openstack/02a-MAClow/IEEE802154E.c @@ -941,14 +941,29 @@ port_INLINE void activity_ti1ORri1(void) { if (schedule_getOkToSend()) { // this is minimal cell ieee154e_vars.radioType = schedule_getRadioType(); + + // get the modem to be used + if (ieee154e_vars.radioType > 0) ieee154e_vars.modem = MODEM_SUBGHZ; + else { + ieee154e_vars.modem = MODEM_2D4GHZ; + }; + + // configure the radio front-end with the corresponding PHY + ieee154e_vars.radio_functions[ieee154e_vars.modem].radio_load_phy_cb((uint8_t)ieee154e_vars.radioType); // get the delayTx and delayRx for used radio ieee154e_vars.delayTx = ieee154e_vars.radio_functions[ieee154e_vars.modem].radio_getDelayTx_cb(); ieee154e_vars.delayRx = ieee154e_vars.radio_functions[ieee154e_vars.modem].radio_getDelayRx_cb(); + + // get the channelisation values corresponding to the current PHY + ieee154e_vars.numOfChannels = ieee154e_vars.radio_functions[ieee154e_vars.modem].radio_getNumOfChannels_cb(); + ieee154e_vars.ch_spacing = ieee154e_vars.radio_functions[ieee154e_vars.modem].radio_getCh_spacing_cb(); + ieee154e_vars.frequency = ieee154e_vars.radio_functions[ieee154e_vars.modem].radio_getCenterFreq_cb(); + // freq according to the used radio . calculate the frequency to transmit on ieee154e_vars.channel = ieee154e_calculateFrequency(schedule_getChannelOffset()); - + if (packetfunctions_isBroadcastMulticast(&neighbor)==FALSE){ // this is a dedicated cell ieee154e_vars.dataToSend = openqueue_macGetDedicatedPacket(&neighbor); @@ -1076,6 +1091,14 @@ port_INLINE void activity_ti1ORri1(void) { // assign radio type for RX ieee154e_vars.radioType = schedule_getRadioType(); + + // configure the radio front-end with the corresponding PHY + ieee154e_vars.radio_functions[ieee154e_vars.modem].radio_load_phy_cb((uint8_t)ieee154e_vars.radioType); + + // get the channelisation values corresponding to the current PHY + ieee154e_vars.numOfChannels = ieee154e_vars.radio_functions[ieee154e_vars.modem].radio_getNumOfChannels_cb(); + ieee154e_vars.ch_spacing = ieee154e_vars.radio_functions[ieee154e_vars.modem].radio_getCh_spacing_cb(); + ieee154e_vars.frequency = ieee154e_vars.radio_functions[ieee154e_vars.modem].radio_getCenterFreq_cb(); // get the delayTx and delayRx for used radio ieee154e_vars.delayTx = ieee154e_vars.radio_functions[ieee154e_vars.modem].radio_getDelayTx_cb(); @@ -1170,6 +1193,8 @@ port_INLINE void activity_ti1ORri1(void) { endSlot(); break; } + + //debugpins_frame_toggle(); } port_INLINE void activity_ti2(void) { diff --git a/openstack/02a-MAClow/IEEE802154E.h b/openstack/02a-MAClow/IEEE802154E.h index 415d575319..8391cd7495 100644 --- a/openstack/02a-MAClow/IEEE802154E.h +++ b/openstack/02a-MAClow/IEEE802154E.h @@ -182,8 +182,10 @@ enum ieee154e_atomicdurations_enum { wdRadioTx = 33, // 1000us (needs to be >delayTx) (SCuM need a larger value, 43 is tested and works) wdDataDuration = 164, // 5000us (measured 4280us with max payload) #else - wdRadioTx = 140, // 1000us (needs to be >delayTx) (SCuM need a larger value, 43 is tested and works) - wdDataDuration = 754, // 23000us (measured 4280us with max payload) + wdRadioTx = PORT_wdRadioTx, + wdDataDuration = PORT_wdDataDuration, + //wdRadioTx = 140, // 1000us (needs to be >delayTx) (SCuM need a larger value, 43 is tested and works) + //wdDataDuration = 754, // 23000us (measured 4280us with max payload) #endif wdAckDuration = PORT_wdAckDuration, // 2400us (measured 1000us) }; @@ -250,7 +252,8 @@ typedef struct { uint8_t asnOffset; // offset inside the frame uint8_t singleChannel; // the single channel used for transmission bool singleChannelChanged; // detect id singleChannelChanged - uint8_t chTemplate[NUM_CHANNELS];// storing the template of hopping sequence + uint8_t chTemplate[NUM_CHANNELS];// storing the template of hopping sequence -> needs to be changed to a pointer to the channel hopping sequence + uint16_t numOfChannels; // the amount of channels to channel hop onto // template ID uint8_t tsTemplateId; // timeslot template id uint8_t chTemplateId; // channel hopping tempalte id diff --git a/openstack/02b-MAChigh/schedule.c b/openstack/02b-MAChigh/schedule.c index a529b77cf8..c06a147247 100644 --- a/openstack/02b-MAChigh/schedule.c +++ b/openstack/02b-MAChigh/schedule.c @@ -87,6 +87,7 @@ void schedule_startDAGroot(void) { temp_neighbor.type = ADDR_ANYCAST; for (running_slotOffset=start_slotOffset;running_slotOffset 0) {rt=(radioType_t)1;} schedule_addActiveSlot( running_slotOffset, // slot offset CELLTYPE_TXRX, // type of slot diff --git a/openstack/02b-MAChigh/schedule.h b/openstack/02b-MAChigh/schedule.h index 0423021f75..0a4fda4774 100644 --- a/openstack/02b-MAChigh/schedule.h +++ b/openstack/02b-MAChigh/schedule.h @@ -17,7 +17,7 @@ The superframe reappears over time and can be arbitrarily long. */ -#define SLOTFRAME_LENGTH 31 //should be 101, using 31 so the network synchs faster +#define SLOTFRAME_LENGTH 11 //should be 101, using 31 so the network synchs faster //draft-ietf-6tisch-minimal-06 #define SCHEDULE_MINIMAL_6TISCH_ACTIVE_CELLS MAX_NUM_RADIOS @@ -39,7 +39,8 @@ The superframe reappears over time and can be arbitrarily long. for serial port to transmit data to dagroot. */ -#define NUMSLOTSOFF 30 +//#define NUMSLOTSOFF 30 +#define NUMSLOTSOFF (SLOTFRAME_LENGTH-NUMSERIALRX-SCHEDULE_MINIMAL_6TISCH_ACTIVE_CELLS) // /** \brief Maximum number of active slots in a superframe. diff --git a/openstack/02b-MAChigh/sixtop.c b/openstack/02b-MAChigh/sixtop.c index b22ad669f5..9527b31fc3 100644 --- a/openstack/02b-MAChigh/sixtop.c +++ b/openstack/02b-MAChigh/sixtop.c @@ -628,10 +628,10 @@ owerror_t sixtop_send_internal( // if (MAX_NUM_RADIOS==2){ // //one EB with every radio -// msg->l2_radioType = (radioType_t)(msg->l2_dsn&0x01); + msg->l2_radioType = (radioType_t)(((msg->l2_dsn)&0x01)+0x01); // } - msg->l2_radioType = 1; + //msg->l2_radioType = 1; // change owner to IEEE802154E fetches it from queue msg->owner = COMPONENT_SIXTOP_TO_IEEE802154E; From 55795d430c4cd62294184900babfe836e1f75e4d Mon Sep 17 00:00:00 2001 From: jmmunoz86 Date: Mon, 22 Oct 2018 19:32:52 +0200 Subject: [PATCH 18/37] corrected TsTxOffset. SPI config happens at the beginning of each TS. --- bsp/boards/openmote-b/board_info.h | 6 +++--- bsp/boards/openmote-b/radio_subghz.c | 4 ++-- openstack/02a-MAClow/IEEE802154E.h | 2 +- openstack/02b-MAChigh/schedule.h | 2 +- openstack/02b-MAChigh/sixtop.c | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/bsp/boards/openmote-b/board_info.h b/bsp/boards/openmote-b/board_info.h index 9bd4ab95e9..5d007622dd 100644 --- a/bsp/boards/openmote-b/board_info.h +++ b/bsp/boards/openmote-b/board_info.h @@ -81,7 +81,7 @@ // time-slot related #define PORT_TsSlotDuration 1310 // counter counts one extra count, see datasheet // execution speed related - #define PORT_maxTxDataPrepare 40 // 2014us (measured 746us) + #define PORT_maxTxDataPrepare 40 // 2014us (measured 746us) 40 #define PORT_maxRxAckPrepare 30 // 305us (measured 83us) #define PORT_maxRxDataPrepare 30 // 1007us (measured 84us) #define PORT_maxTxAckPrepare 40 // 305us (measured 219us) @@ -90,7 +90,7 @@ #define delayTx_OFDM1 40 #define PORT_wdAckDuration 260 - #define PORT_wdRadioTx 140 // for 2FSK 50 kbps + #define PORT_wdRadioTx 140 // for 2FSK 50 kbps 140 #define PORT_wdDataDuration 754 // for 2FSK 50 kbps // radio watchdog #endif @@ -111,7 +111,7 @@ // number of radios in this board. #define MAX_NUM_MODEM 2 // sub-GHz and 2.4 GHz interfaces or modem -#define MAX_NUM_RADIOS 3 // amount of active PHYs. +#define MAX_NUM_RADIOS 3 // amount of active PHYs. 3 //#define DAGROOT diff --git a/bsp/boards/openmote-b/radio_subghz.c b/bsp/boards/openmote-b/radio_subghz.c index 1170cf4bc6..1436344b0b 100644 --- a/bsp/boards/openmote-b/radio_subghz.c +++ b/bsp/boards/openmote-b/radio_subghz.c @@ -173,8 +173,8 @@ void radio_subghz_init(void) { config_ofdm_1_800_subGHz(); config_2fsk_50_subGHz(); radio_subghz_vars.phy_list[0] = phy_tsch_config_2fsk_50_subGHz; - radio_subghz_vars.phy_list[1] = phy_tsch_config_2fsk_50_subGHz; - radio_subghz_vars.phy_list[2] = phy_tsch_config_ofdm_1_800_subGHz; + radio_subghz_vars.phy_list[1] = phy_tsch_config_ofdm_1_800_subGHz; + radio_subghz_vars.phy_list[2] = phy_tsch_config_2fsk_50_subGHz; } //void radio_subghz_load_phy(registerSetting_t * mod, uint8_t size, uint8_t phy_index){ diff --git a/openstack/02a-MAClow/IEEE802154E.h b/openstack/02a-MAClow/IEEE802154E.h index 8391cd7495..be22ad59b2 100644 --- a/openstack/02a-MAClow/IEEE802154E.h +++ b/openstack/02a-MAClow/IEEE802154E.h @@ -163,7 +163,7 @@ enum ieee154e_atomicdurations_enum { TsTxAckDelay = 33, // 1000us TsShortGT = 9, // 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. #else - TsTxOffset = 120, // 4000us + TsTxOffset = 200, // 4000us TsLongGT = 86, // 1300us TsTxAckDelay = 140, // 4606us TsShortGT = 80, // 500us diff --git a/openstack/02b-MAChigh/schedule.h b/openstack/02b-MAChigh/schedule.h index 0a4fda4774..624f750d23 100644 --- a/openstack/02b-MAChigh/schedule.h +++ b/openstack/02b-MAChigh/schedule.h @@ -17,7 +17,7 @@ The superframe reappears over time and can be arbitrarily long. */ -#define SLOTFRAME_LENGTH 11 //should be 101, using 31 so the network synchs faster +#define SLOTFRAME_LENGTH 101 //should be 101, using 31 so the network synchs faster //draft-ietf-6tisch-minimal-06 #define SCHEDULE_MINIMAL_6TISCH_ACTIVE_CELLS MAX_NUM_RADIOS diff --git a/openstack/02b-MAChigh/sixtop.c b/openstack/02b-MAChigh/sixtop.c index 9527b31fc3..97add2ce70 100644 --- a/openstack/02b-MAChigh/sixtop.c +++ b/openstack/02b-MAChigh/sixtop.c @@ -628,7 +628,7 @@ owerror_t sixtop_send_internal( // if (MAX_NUM_RADIOS==2){ // //one EB with every radio - msg->l2_radioType = (radioType_t)(((msg->l2_dsn)&0x01)+0x01); + msg->l2_radioType = (radioType_t)(((msg->l2_dsn)&0x01)+0x01); // } //msg->l2_radioType = 1; From d2f68d3d978df5a97683d3a729e85332d01db14c Mon Sep 17 00:00:00 2001 From: jmmunoz86 Date: Tue, 23 Oct 2018 10:03:02 +0200 Subject: [PATCH 19/37] changed startup_iar.c, flashing with IAR and scons both working --- bsp/boards/openmote-b/startup_iar.c | 2 +- openstack/02a-MAClow/IEEE802154E.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bsp/boards/openmote-b/startup_iar.c b/bsp/boards/openmote-b/startup_iar.c index 2a81de7c79..4b7c2ad585 100644 --- a/bsp/boards/openmote-b/startup_iar.c +++ b/bsp/boards/openmote-b/startup_iar.c @@ -191,7 +191,7 @@ lockPageCCA_t; __root const lockPageCCA_t __cca @ ".flashcca" = { - BOOTLOADER_BACKDOOR_DISABLE, // Bootloader backdoor enabled + BOOTLOADER_BACKDOOR_ENABLE, // Bootloader backdoor enabled 0, // Image valid bytes FLASH_START_ADDR // Vector table located at flash start address }; diff --git a/openstack/02a-MAClow/IEEE802154E.h b/openstack/02a-MAClow/IEEE802154E.h index 415d575319..103119b789 100644 --- a/openstack/02a-MAClow/IEEE802154E.h +++ b/openstack/02a-MAClow/IEEE802154E.h @@ -163,7 +163,7 @@ enum ieee154e_atomicdurations_enum { TsTxAckDelay = 33, // 1000us TsShortGT = 9, // 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. #else - TsTxOffset = 120, // 4000us + TsTxOffset = 200, // 4000us TsLongGT = 86, // 1300us TsTxAckDelay = 140, // 4606us TsShortGT = 80, // 500us From 98ed0f0a677c1b4b56fed9181431f75b780c4fae Mon Sep 17 00:00:00 2001 From: jmmunoz86 Date: Tue, 23 Oct 2018 10:45:45 +0200 Subject: [PATCH 20/37] OpenWSN working with only OFDM1, TS 40 ms --- bsp/boards/openmote-b/board_info.h | 6 +++--- bsp/boards/openmote-b/radio_subghz.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bsp/boards/openmote-b/board_info.h b/bsp/boards/openmote-b/board_info.h index 9d24ae814d..073acf0207 100644 --- a/bsp/boards/openmote-b/board_info.h +++ b/bsp/boards/openmote-b/board_info.h @@ -115,9 +115,9 @@ //#define wdAckDuration 260 // 5400us using 50 kbps #define NUM_CHANNELS 3 // number of channels to channel hop on -#define DEFAULT_CH_SPACING 200 // default channel spacing for subghz -#define DEFAULT_FREQUENCY_CENTER 863125 // defualt freque -#define delayTx_SUBGHZ 67 +#define DEFAULT_CH_SPACING 1200 // default channel spacing for subghz +#define DEFAULT_FREQUENCY_CENTER 863625 // defualt freque +#define delayTx_SUBGHZ delayTx_OFDM1 #define delayRx_SUBGHZ 0 #define NUM_CHANNELS_SUBGHZ 3 diff --git a/bsp/boards/openmote-b/radio_subghz.c b/bsp/boards/openmote-b/radio_subghz.c index be1d8ac753..a4767836fc 100644 --- a/bsp/boards/openmote-b/radio_subghz.c +++ b/bsp/boards/openmote-b/radio_subghz.c @@ -158,8 +158,8 @@ void radio_subghz_init(void) { while(1); //UNKNOWN DEVICE, FINISH } // Write registers to radio -- default configuration 2fsk-50 - for( i = 0; i < (sizeof(basic_settings_fsk_option1_subghz)/sizeof(registerSetting_t)); i++) { - at86rf215_spiWriteReg( basic_settings_fsk_option1_subghz[i].addr, basic_settings_fsk_option1_subghz[i].data); + for( i = 0; i < (sizeof(basic_settings_ofdm_1_mcs3_subghz)/sizeof(registerSetting_t)); i++) { + at86rf215_spiWriteReg( basic_settings_ofdm_1_mcs3_subghz[i].addr, basic_settings_ofdm_1_mcs3_subghz[i].data); }; radio_subghz_read_isr(); config_ofdm_1_800_subGHz(); From f6466bd2cf3ccf42850683c683a29aabd0c2ad07 Mon Sep 17 00:00:00 2001 From: jmmunoz86 Date: Wed, 24 Oct 2018 11:23:02 +0200 Subject: [PATCH 21/37] modifies the open_addr_t struct. Creates the addr_16b_t and addr_64b_t, containing the addresses and the radioType item. --- bsp/boards/openmote-b/board_info.h | 7 ------ drivers/common/openserial.c | 20 ++++++++-------- inc/opendefs.h | 24 +++++++++++++++---- openapps/cjoin/cjoin.c | 2 +- openapps/opencoap/opencoap.c | 2 +- openstack/02b-MAChigh/schedule.c | 3 ++- openstack/02b-MAChigh/sixtop.c | 4 ++-- openstack/03a-IPHC/openbridge.c | 6 ++--- openstack/03b-IPv6/forwarding.c | 7 +++--- openstack/03b-IPv6/icmpv6rpl.c | 4 ++-- openstack/cross-layers/idmanager.c | 9 +++---- openstack/cross-layers/openrandom.c | 4 ++-- openstack/cross-layers/packetfunctions.c | 30 ++++++++++++------------ 13 files changed, 67 insertions(+), 55 deletions(-) diff --git a/bsp/boards/openmote-b/board_info.h b/bsp/boards/openmote-b/board_info.h index 073acf0207..ffa09f18a4 100644 --- a/bsp/boards/openmote-b/board_info.h +++ b/bsp/boards/openmote-b/board_info.h @@ -129,13 +129,6 @@ typedef enum { FREQBAND_ANY = 2 } modem_t; -typedef enum { - RADIOTYPE_2D4GHZ = 0, - RADIOTYPE_SUBGHZ_OFDM_1_800 = 1, - RADIOTYPE_SUBGHZ_2FSK_50 = 2, - RADIOTYPE_ANY = 3 -} radioType_t; - //=========================== variables ======================================= static const uint8_t rreg_uriquery[] = "h=ucb"; diff --git a/drivers/common/openserial.c b/drivers/common/openserial.c index 0632ad20c6..f5593eab91 100644 --- a/drivers/common/openserial.c +++ b/drivers/common/openserial.c @@ -129,8 +129,8 @@ owerror_t openserial_printStatus( openserial_vars.outputBufFilled = TRUE; outputHdlcOpen(); outputHdlcWrite(SERFRAME_MOTE2PC_STATUS); - outputHdlcWrite(idmanager_getMyID(ADDR_16B)->addr_16b[0]); - outputHdlcWrite(idmanager_getMyID(ADDR_16B)->addr_16b[1]); + outputHdlcWrite(idmanager_getMyID(ADDR_16B)->addr_16b.addr_16b[0]); + outputHdlcWrite(idmanager_getMyID(ADDR_16B)->addr_16b.addr_16b[1]); outputHdlcWrite(statusElement); for (i=0;iaddr_16b[0]); - outputHdlcWrite(idmanager_getMyID(ADDR_16B)->addr_16b[1]); + outputHdlcWrite(idmanager_getMyID(ADDR_16B)->addr_16b.addr_16b[0]); + outputHdlcWrite(idmanager_getMyID(ADDR_16B)->addr_16b.addr_16b[1]); outputHdlcWrite(asn[0]); outputHdlcWrite(asn[1]); outputHdlcWrite(asn[2]); @@ -242,8 +242,8 @@ owerror_t openserial_printSniffedPacket(uint8_t* buffer, uint8_t length, uint8_t openserial_vars.outputBufFilled = TRUE; outputHdlcOpen(); outputHdlcWrite(SERFRAME_MOTE2PC_SNIFFED_PACKET); - outputHdlcWrite(idmanager_getMyID(ADDR_16B)->addr_16b[0]); - outputHdlcWrite(idmanager_getMyID(ADDR_16B)->addr_16b[1]); + outputHdlcWrite(idmanager_getMyID(ADDR_16B)->addr_16b.addr_16b[0]); + outputHdlcWrite(idmanager_getMyID(ADDR_16B)->addr_16b.addr_16b[1]); for (i=0;iaddr_16b[0]); - outputHdlcWrite(idmanager_getMyID(ADDR_16B)->addr_16b[1]); + outputHdlcWrite(idmanager_getMyID(ADDR_16B)->addr_16b.addr_16b[0]); + outputHdlcWrite(idmanager_getMyID(ADDR_16B)->addr_16b.addr_16b[1]); for(i=0; i<5;i++) outputHdlcWrite(asn[i]); for (i=0;iaddr_16b[0]); - outputHdlcWrite(idmanager_getMyID(ADDR_16B)->addr_16b[1]); + outputHdlcWrite(idmanager_getMyID(ADDR_16B)->addr_16b.addr_16b[0]); + outputHdlcWrite(idmanager_getMyID(ADDR_16B)->addr_16b.addr_16b[1]); outputHdlcWrite(calling_component); outputHdlcWrite(error_code); outputHdlcWrite((uint8_t)((arg1 & 0xff00)>>8)); diff --git a/inc/opendefs.h b/inc/opendefs.h index 866bb6060b..1312330edc 100644 --- a/inc/opendefs.h +++ b/inc/opendefs.h @@ -282,6 +282,13 @@ typedef struct { } asn_t; END_PACK +typedef enum { + RADIOTYPE_2D4GHZ = 0, + RADIOTYPE_SUBGHZ_OFDM_1_800 = 1, + RADIOTYPE_SUBGHZ_2FSK_50 = 2, + RADIOTYPE_ANY = 3 +} radioType_t; + typedef asn_t macFrameCounter_t; BEGIN_PACK @@ -292,11 +299,21 @@ typedef struct { uint16_t channeloffset; } cellInfo_ht; +typedef struct { + uint8_t addr_64b[8]; + radioType_t rtype; +} addr_64b_t; + +typedef struct { + uint8_t addr_16b[2]; + radioType_t rtype; +} addr_16b_t; + typedef struct { // always written big endian, i.e. MSB in addr[0] - uint8_t type; + uint8_t type; union { - uint8_t addr_16b[2]; - uint8_t addr_64b[8]; + addr_16b_t addr_16b; + addr_64b_t addr_64b; uint8_t addr_128b[16]; uint8_t panid[2]; uint8_t prefix[8]; @@ -391,7 +408,6 @@ typedef struct { } neighborRow_t; END_PACK - //=========================== variables ======================================= //=========================== prototypes ====================================== diff --git a/openapps/cjoin/cjoin.c b/openapps/cjoin/cjoin.c index 3c03be5d79..484a8b6e48 100644 --- a/openapps/cjoin/cjoin.c +++ b/openapps/cjoin/cjoin.c @@ -260,7 +260,7 @@ owerror_t cjoin_sendJoinRequest(open_addr_t* joinProxy) { pkt->l3_destinationAdd.type = ADDR_128B; prefix = idmanager_getMyID(ADDR_PREFIX); // at this point, this is link-local prefix memcpy(&pkt->l3_destinationAdd.addr_128b[0],prefix->prefix,8); - memcpy(&pkt->l3_destinationAdd.addr_128b[8],joinProxy->addr_64b,8); // set host to eui-64 of the join proxy + memcpy(&pkt->l3_destinationAdd.addr_128b[8],joinProxy->addr_64b.addr_64b,8); // set host to eui-64 of the join proxy // send outcome = opencoap_send( diff --git a/openapps/opencoap/opencoap.c b/openapps/opencoap/opencoap.c index 8bff9a6eff..2972354e86 100644 --- a/openapps/opencoap/opencoap.c +++ b/openapps/opencoap/opencoap.c @@ -1099,7 +1099,7 @@ void opencoap_handle_stateless_proxy(OpenQueueEntry_t *msg, return; } eui64.type = ADDR_64B; - memcpy(eui64.addr_64b, statelessProxy->pValue, 8); + memcpy(eui64.addr_64b.addr_64b, statelessProxy->pValue, 8); // use link-local prefix to forward the response memset(&link_local_prefix, 0x00, sizeof(open_addr_t)); diff --git a/openstack/02b-MAChigh/schedule.c b/openstack/02b-MAChigh/schedule.c index a529b77cf8..51472e8d85 100644 --- a/openstack/02b-MAChigh/schedule.c +++ b/openstack/02b-MAChigh/schedule.c @@ -962,7 +962,8 @@ void schedule_resetEntry(scheduleEntry_t* e) { e->channelOffset = 0; e->neighbor.type = ADDR_NONE; - memset(&e->neighbor.addr_64b[0], 0x00, sizeof(e->neighbor.addr_64b)); + //memset(&e->neighbor.addr_64b[0], 0x00, sizeof(e->neighbor.addr_64b)); + memset(&e->neighbor.addr_64b, 0x00, sizeof(e->neighbor.addr_64b)); e->numRx = 0; e->numTx = 0; diff --git a/openstack/02b-MAChigh/sixtop.c b/openstack/02b-MAChigh/sixtop.c index b22ad669f5..a355376613 100644 --- a/openstack/02b-MAChigh/sixtop.c +++ b/openstack/02b-MAChigh/sixtop.c @@ -824,8 +824,8 @@ port_INLINE void sixtop_sendEB(void) { // some l2 information about this packet eb->l2_frameType = IEEE154_TYPE_BEACON; eb->l2_nextORpreviousHop.type = ADDR_16B; - eb->l2_nextORpreviousHop.addr_16b[0] = 0xff; - eb->l2_nextORpreviousHop.addr_16b[1] = 0xff; + eb->l2_nextORpreviousHop.addr_16b.addr_16b[0] = 0xff; + eb->l2_nextORpreviousHop.addr_16b.addr_16b[1] = 0xff; //I has an IE in my payload eb->l2_payloadIEpresent = TRUE; diff --git a/openstack/03a-IPHC/openbridge.c b/openstack/03a-IPHC/openbridge.c index c6421c6209..a0a0033707 100644 --- a/openstack/03a-IPHC/openbridge.c +++ b/openstack/03a-IPHC/openbridge.c @@ -49,7 +49,7 @@ void openbridge_triggerData(void) { pkt->owner = COMPONENT_OPENBRIDGE; //l2 pkt->l2_nextORpreviousHop.type = ADDR_64B; - memcpy(&(pkt->l2_nextORpreviousHop.addr_64b[0]),&(input_buffer[0]),8); + memcpy(&(pkt->l2_nextORpreviousHop.addr_64b.addr_64b[0]),&(input_buffer[0]),8); //payload packetfunctions_reserveHeaderSize(pkt,numDataBytes-8); memcpy(pkt->payload,&(input_buffer[8]),numDataBytes-8); @@ -84,11 +84,11 @@ void openbridge_receive(OpenQueueEntry_t* msg) { // prepend previous hop packetfunctions_reserveHeaderSize(msg,LENGTH_ADDR64b); - memcpy(msg->payload,msg->l2_nextORpreviousHop.addr_64b,LENGTH_ADDR64b); + memcpy(msg->payload,msg->l2_nextORpreviousHop.addr_64b.addr_64b,LENGTH_ADDR64b); // prepend next hop (me) packetfunctions_reserveHeaderSize(msg,LENGTH_ADDR64b); - memcpy(msg->payload,idmanager_getMyID(ADDR_64B)->addr_64b,LENGTH_ADDR64b); + memcpy(msg->payload,idmanager_getMyID(ADDR_64B)->addr_64b.addr_64b,LENGTH_ADDR64b); // send packet over serial (will be memcopied into serial buffer) openserial_printData((uint8_t*)(msg->payload),msg->length); diff --git a/openstack/03b-IPv6/forwarding.c b/openstack/03b-IPv6/forwarding.c index ce21f9333a..4a03a14f63 100644 --- a/openstack/03b-IPv6/forwarding.c +++ b/openstack/03b-IPv6/forwarding.c @@ -120,7 +120,7 @@ owerror_t forwarding_send(OpenQueueEntry_t* msg) { dac = IPHC_DAC_STATEFUL; } memcpy(&(msg->l3_sourceAdd.addr_128b[0]),myprefix->prefix,8); - memcpy(&(msg->l3_sourceAdd.addr_128b[8]),myadd64->addr_64b,8); + memcpy(&(msg->l3_sourceAdd.addr_128b[8]),myadd64->addr_64b.addr_64b,8); // initialize IPv6 header memset(&ipv6_outer_header,0,sizeof(ipv6_header_iht)); @@ -447,7 +447,8 @@ void forwarding_getNextHop(open_addr_t* destination128b, open_addr_t* addressToW // IP destination is broadcast, send to 0xffffffffffffffff addressToWrite64b->type = ADDR_64B; for (i=0;i<8;i++) { - addressToWrite64b->addr_64b[i] = 0xff; + //addressToWrite64b->addr_64b[i] = 0xff; + addressToWrite64b->addr_64b.addr_64b[i] = 0xff; } } else if (neighbors_isStableNeighbor(destination128b)) { // IP destination is 1-hop neighbor, send directly @@ -762,7 +763,7 @@ owerror_t forwarding_send_internal_SourceRouting( COMPONENT_IPHC, ERR_6LOWPAN_UNSUPPORTED, (errorparameter_t)16, - (errorparameter_t)(temp_addr64.addr_64b[7]) + (errorparameter_t)(temp_addr64.addr_64b.addr_64b[7]) ); } // copy RH3s before toss them diff --git a/openstack/03b-IPv6/icmpv6rpl.c b/openstack/03b-IPv6/icmpv6rpl.c index e325d02965..c311f7e4f2 100644 --- a/openstack/03b-IPv6/icmpv6rpl.c +++ b/openstack/03b-IPv6/icmpv6rpl.c @@ -37,7 +37,7 @@ void icmpv6rpl_init(void) { // retrieve my prefix and EUI64 memcpy(&dodagid[0],idmanager_getMyID(ADDR_PREFIX)->prefix,8); // prefix - memcpy(&dodagid[8],idmanager_getMyID(ADDR_64B)->addr_64b,8); // eui64 + memcpy(&dodagid[8],idmanager_getMyID(ADDR_64B)->addr_64b.addr_64b,8); // eui64 //===== reset local variables memset(&icmpv6rpl_vars,0,sizeof(icmpv6rpl_vars_t)); @@ -101,7 +101,7 @@ void icmpv6rpl_init(void) { ); memcpy( &(icmpv6rpl_vars.pio.prefix[8]), - idmanager_getMyID(ADDR_64B)->addr_64b, + idmanager_getMyID(ADDR_64B)->addr_64b.addr_64b, sizeof(idmanager_getMyID(ADDR_64B)->addr_64b) ); } diff --git a/openstack/cross-layers/idmanager.c b/openstack/cross-layers/idmanager.c index 2e123c3972..4be25504f8 100644 --- a/openstack/cross-layers/idmanager.c +++ b/openstack/cross-layers/idmanager.c @@ -63,7 +63,8 @@ void idmanager_init(void) { // my64bID idmanager_vars.my64bID.type = ADDR_64B; - eui64_get(idmanager_vars.my64bID.addr_64b); + //eui64_get(idmanager_vars.my64bID.addr_64b); + eui64_get(idmanager_vars.my64bID.addr_64b.addr_64b); // my16bID packetfunctions_mac64bToMac16b(&idmanager_vars.my64bID,&idmanager_vars.my16bID); @@ -249,7 +250,7 @@ void idmanager_triggerAboutRoot(void) { // indicate DODAGid to RPL memcpy(&dodagid[0],idmanager_vars.myPrefix.prefix,8); // prefix - memcpy(&dodagid[8],idmanager_vars.my64bID.addr_64b,8); // eui64 + memcpy(&dodagid[8],idmanager_vars.my64bID.addr_64b.addr_64b,8); // eui64 icmpv6rpl_writeDODAGid(dodagid); // store L2 security key index and key value @@ -288,8 +289,8 @@ bool debugPrint_id(void) { output.isDAGroot = idmanager_vars.isDAGroot; memcpy(output.myPANID,idmanager_vars.myPANID.panid,2); - memcpy(output.my16bID,idmanager_vars.my16bID.addr_16b,2); - memcpy(output.my64bID,idmanager_vars.my64bID.addr_64b,8); + memcpy(output.my16bID,idmanager_vars.my16bID.addr_16b.addr_16b,2); + memcpy(output.my64bID,idmanager_vars.my64bID.addr_64b.addr_64b,8); memcpy(output.myPrefix,idmanager_vars.myPrefix.prefix,8); openserial_printStatus(STATUS_ID,(uint8_t*)&output,sizeof(debugIDManagerEntry_t)); diff --git a/openstack/cross-layers/openrandom.c b/openstack/cross-layers/openrandom.c index 455d3bc810..e21ba5a77b 100644 --- a/openstack/cross-layers/openrandom.c +++ b/openstack/cross-layers/openrandom.c @@ -13,8 +13,8 @@ random_vars_t random_vars; void openrandom_init(void) { // seed the random number generator with the last 2 bytes of the MAC address random_vars.shift_reg = 0; - random_vars.shift_reg += idmanager_getMyID(ADDR_16B)->addr_16b[0]*256; - random_vars.shift_reg += idmanager_getMyID(ADDR_16B)->addr_16b[1]; + random_vars.shift_reg += idmanager_getMyID(ADDR_16B)->addr_16b.addr_16b[0]*256; + random_vars.shift_reg += idmanager_getMyID(ADDR_16B)->addr_16b.addr_16b[1]; } uint16_t openrandom_get16b(void) { diff --git a/openstack/cross-layers/packetfunctions.c b/openstack/cross-layers/packetfunctions.c index 05a7b7de94..fcfe1642e3 100644 --- a/openstack/cross-layers/packetfunctions.c +++ b/openstack/cross-layers/packetfunctions.c @@ -27,7 +27,7 @@ void packetfunctions_ip128bToMac64b( prefix64btoWrite->type=ADDR_PREFIX; memcpy(prefix64btoWrite->prefix, &(ip128b->addr_128b[0]), 8); mac64btoWrite->type=ADDR_64B; - memcpy(mac64btoWrite->addr_64b , &(ip128b->addr_128b[8]), 8); + memcpy(mac64btoWrite->addr_64b.addr_64b , &(ip128b->addr_128b[8]), 8); } void packetfunctions_mac64bToIp128b( open_addr_t* prefix64b, @@ -42,7 +42,7 @@ void packetfunctions_mac64bToIp128b( } ip128bToWrite->type=ADDR_128B; memcpy(&(ip128bToWrite->addr_128b[0]), &(prefix64b->prefix[0]), 8); - memcpy(&(ip128bToWrite->addr_128b[8]), &(mac64b->addr_64b[0]), 8); + memcpy(&(ip128bToWrite->addr_128b[8]), &(mac64b->addr_64b.addr_64b[0]), 8); } //assuming an mac16b is lower 2B of mac64b @@ -55,8 +55,8 @@ void packetfunctions_mac64bToMac16b(open_addr_t* mac64b, open_addr_t* mac16btoWr return; } mac16btoWrite->type = ADDR_16B; - mac16btoWrite->addr_16b[0] = mac64b->addr_64b[6]; - mac16btoWrite->addr_16b[1] = mac64b->addr_64b[7]; + mac16btoWrite->addr_16b.addr_16b[0] = mac64b->addr_64b.addr_64b[6]; + mac16btoWrite->addr_16b.addr_16b[1] = mac64b->addr_64b.addr_64b[7]; } void packetfunctions_mac16bToMac64b(open_addr_t* mac16b, open_addr_t* mac64btoWrite) { if (mac16b->type!=ADDR_16B) { @@ -67,14 +67,14 @@ void packetfunctions_mac16bToMac64b(open_addr_t* mac16b, open_addr_t* mac64btoWr return; } mac64btoWrite->type = ADDR_64B; - mac64btoWrite->addr_64b[0] = 0; - mac64btoWrite->addr_64b[1] = 0; - mac64btoWrite->addr_64b[2] = 0; - mac64btoWrite->addr_64b[3] = 0; - mac64btoWrite->addr_64b[4] = 0; - mac64btoWrite->addr_64b[5] = 0; - mac64btoWrite->addr_64b[6] = mac16b->addr_16b[0]; - mac64btoWrite->addr_64b[7] = mac16b->addr_16b[1]; + mac64btoWrite->addr_64b.addr_64b[0] = 0; + mac64btoWrite->addr_64b.addr_64b[1] = 0; + mac64btoWrite->addr_64b.addr_64b[2] = 0; + mac64btoWrite->addr_64b.addr_64b[3] = 0; + mac64btoWrite->addr_64b.addr_64b[4] = 0; + mac64btoWrite->addr_64b.addr_64b[5] = 0; + mac64btoWrite->addr_64b.addr_64b[6] = mac16b->addr_16b.addr_16b[0]; + mac64btoWrite->addr_64b.addr_64b[7] = mac16b->addr_16b.addr_16b[1]; } //======= address recognition @@ -421,8 +421,8 @@ void packetfunctions_calculateChecksum(OpenQueueEntry_t* msg, uint8_t* checksum_ onesComplementSum(temp_checksum,(uint8_t*)linklocalprefix,8); memcpy(&localscopeAddress,idmanager_getMyID(ADDR_64B),sizeof(open_addr_t)); // invert 'u' bit (section 2.5.1 at https://www.ietf.org/rfc/rfc2373.txt) - localscopeAddress.addr_64b[0] ^= 0x02; - onesComplementSum(temp_checksum,localscopeAddress.addr_64b,8); + localscopeAddress.addr_64b.addr_64b[0] ^= 0x02; + onesComplementSum(temp_checksum,localscopeAddress.addr_64b.addr_64b,8); // boardcast destination address onesComplementSum(temp_checksum,msg->l3_destinationAdd.addr_128b,16); @@ -431,7 +431,7 @@ void packetfunctions_calculateChecksum(OpenQueueEntry_t* msg, uint8_t* checksum_ // source address onesComplementSum(temp_checksum,(idmanager_getMyID(ADDR_PREFIX))->prefix,8); - onesComplementSum(temp_checksum,(idmanager_getMyID(ADDR_64B))->addr_64b,8); + onesComplementSum(temp_checksum,(idmanager_getMyID(ADDR_64B))->addr_64b.addr_64b,8); // destination address onesComplementSum(temp_checksum,msg->l3_destinationAdd.addr_128b,16); } From abb9737652e0a9723f1027fe8bed536118c0df3a Mon Sep 17 00:00:00 2001 From: jmmunoz86 Date: Wed, 24 Oct 2018 12:31:50 +0200 Subject: [PATCH 22/37] Slotframe of 33 TS. faster synch. --- openstack/02b-MAChigh/schedule.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openstack/02b-MAChigh/schedule.h b/openstack/02b-MAChigh/schedule.h index 624f750d23..77305c8d23 100644 --- a/openstack/02b-MAChigh/schedule.h +++ b/openstack/02b-MAChigh/schedule.h @@ -17,7 +17,7 @@ The superframe reappears over time and can be arbitrarily long. */ -#define SLOTFRAME_LENGTH 101 //should be 101, using 31 so the network synchs faster +#define SLOTFRAME_LENGTH 31 //should be 101, using 31 so the network synchs faster //draft-ietf-6tisch-minimal-06 #define SCHEDULE_MINIMAL_6TISCH_ACTIVE_CELLS MAX_NUM_RADIOS From 58969b944fd1d402313bd45df7fb3170c31f3189 Mon Sep 17 00:00:00 2001 From: jmmunoz86 Date: Wed, 31 Oct 2018 09:06:43 +0100 Subject: [PATCH 23/37] added radioType to neighbors. Same device with X radios is seen as X neighbors. --- inc/opendefs.h | 1 + openstack/02b-MAChigh/neighbors.c | 11 +++++++++-- openstack/02b-MAChigh/sixtop.c | 3 +++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/inc/opendefs.h b/inc/opendefs.h index 1312330edc..45c28da42e 100644 --- a/inc/opendefs.h +++ b/inc/opendefs.h @@ -405,6 +405,7 @@ typedef struct { uint8_t sequenceNumber; uint8_t backoffExponenton; uint8_t backoff; + radioType_t radioType; } neighborRow_t; END_PACK diff --git a/openstack/02b-MAChigh/neighbors.c b/openstack/02b-MAChigh/neighbors.c index d17c8eb080..c7d8a9c5b4 100644 --- a/openstack/02b-MAChigh/neighbors.c +++ b/openstack/02b-MAChigh/neighbors.c @@ -319,6 +319,8 @@ void neighbors_indicateRx(open_addr_t* l2_src, neighbors_vars.neighbors[i].numRx++; neighbors_vars.neighbors[i].rssi=rssi; memcpy(&neighbors_vars.neighbors[i].asn,asnTs,sizeof(asn_t)); + neighbors_vars.neighbors[i].addr_64b.addr_64b.rtype = l2_src->addr_64b.rtype; + neighbors_vars.neighbors[i].radioType = l2_src->addr_64b.rtype; //update jp if (joinPrioPresent==TRUE){ neighbors_vars.neighbors[i].joinPrio=joinPrio; @@ -447,7 +449,7 @@ bool neighbors_getNeighborEui64(open_addr_t* address, uint8_t addr_type, uint8_ bool ReturnVal = FALSE; switch(addr_type) { case ADDR_64B: - memcpy(&(address->addr_64b),&(neighbors_vars.neighbors[index].addr_64b.addr_64b),LENGTH_ADDR64b); + memcpy(&(address->addr_64b.addr_64b),&(neighbors_vars.neighbors[index].addr_64b.addr_64b),LENGTH_ADDR64b); address->type=ADDR_64B; ReturnVal=neighbors_vars.neighbors[index].used; break; @@ -685,6 +687,9 @@ void registerNewNeighbor(open_addr_t* address, memcpy(&neighbors_vars.neighbors[i].asn,asnTimestamp,sizeof(asn_t)); neighbors_vars.neighbors[i].backoffExponenton = MINBE-1;; neighbors_vars.neighbors[i].backoff = 0; + //added radioType + neighbors_vars.neighbors[i].radioType = address->addr_64b.rtype; + neighbors_vars.neighbors[i].addr_64b.addr_64b.rtype = address->addr_64b.rtype; //update jp if (joinPrioPresent==TRUE){ neighbors_vars.neighbors[i].joinPrio=joinPrio; @@ -741,7 +746,9 @@ bool isThisRowMatching(open_addr_t* address, uint8_t rowNumber) { switch (address->type) { case ADDR_64B: return neighbors_vars.neighbors[rowNumber].used && - packetfunctions_sameAddress(address,&neighbors_vars.neighbors[rowNumber].addr_64b); + packetfunctions_sameAddress(address,&neighbors_vars.neighbors[rowNumber].addr_64b)&& + (neighbors_vars.neighbors[rowNumber].radioType == address->addr_64b.rtype) ; + // }; default: openserial_printCritical(COMPONENT_NEIGHBORS,ERR_WRONG_ADDR_TYPE, (errorparameter_t)address->type, diff --git a/openstack/02b-MAChigh/sixtop.c b/openstack/02b-MAChigh/sixtop.c index 183dea0513..733c8da7f6 100644 --- a/openstack/02b-MAChigh/sixtop.c +++ b/openstack/02b-MAChigh/sixtop.c @@ -475,6 +475,9 @@ void task_sixtopNotifReceive(void) { // take ownership msg->owner = COMPONENT_SIXTOP; + + // added the radio type to the nextORpreviousHop + msg->l2_nextORpreviousHop.addr_64b.rtype = msg->l2_radioType; // update neighbor statistics neighbors_indicateRx( From 15cc4cbcf4de5f128292ec971e4d84e273d7e388 Mon Sep 17 00:00:00 2001 From: jmmunoz86 Date: Fri, 2 Nov 2018 11:06:16 +0100 Subject: [PATCH 24/37] return parent address and radioType --- openstack/02b-MAChigh/neighbors.c | 1 + 1 file changed, 1 insertion(+) diff --git a/openstack/02b-MAChigh/neighbors.c b/openstack/02b-MAChigh/neighbors.c index c7d8a9c5b4..621e3a1d84 100644 --- a/openstack/02b-MAChigh/neighbors.c +++ b/openstack/02b-MAChigh/neighbors.c @@ -451,6 +451,7 @@ bool neighbors_getNeighborEui64(open_addr_t* address, uint8_t addr_type, uint8_ case ADDR_64B: memcpy(&(address->addr_64b.addr_64b),&(neighbors_vars.neighbors[index].addr_64b.addr_64b),LENGTH_ADDR64b); address->type=ADDR_64B; + address->addr_64b.rtype = neighbors_vars.neighbors[index].addr_64b.addr_64b.rtype; ReturnVal=neighbors_vars.neighbors[index].used; break; default: From bb2ef57661f092d57e6bf36b4a0a2aed46f6a760 Mon Sep 17 00:00:00 2001 From: jmmunoz86 Date: Fri, 2 Nov 2018 11:12:23 +0100 Subject: [PATCH 25/37] assign the radioType on which the 6p transaction will take place. use a different radioType for consecutive EBs. If radioType is 0 (2.4ghz), make sure it is used radioType 1 (OFDM). --- openstack/02b-MAChigh/sixtop.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/openstack/02b-MAChigh/sixtop.c b/openstack/02b-MAChigh/sixtop.c index 733c8da7f6..76e70bd387 100644 --- a/openstack/02b-MAChigh/sixtop.c +++ b/openstack/02b-MAChigh/sixtop.c @@ -203,6 +203,8 @@ owerror_t sixtop_request( pkt->owner = COMPONENT_SIXTOP_RES; memcpy(&(pkt->l2_nextORpreviousHop),neighbor,sizeof(open_addr_t)); + //select radiotype + pkt->l2_radioType = neighbor->addr_64b.rtype; if (celllist_toBeDeleted != NULL){ memcpy(sixtop_vars.celllist_toDelete,celllist_toBeDeleted,CELLLIST_MAX_LEN*sizeof(cellInfo_ht)); } @@ -631,10 +633,12 @@ owerror_t sixtop_send_internal( // if (MAX_NUM_RADIOS==2){ // //one EB with every radio - msg->l2_radioType = (radioType_t)(((msg->l2_dsn)&0x01)+0x01); +// msg->l2_radioType = (radioType_t)(((msg->l2_dsn)&0x01)+0x01); // } - //msg->l2_radioType = 1; + if (msg->l2_radioType == (radioType_t)0){ + msg->l2_radioType = 1; + }; // change owner to IEEE802154E fetches it from queue msg->owner = COMPONENT_SIXTOP_TO_IEEE802154E; @@ -837,6 +841,9 @@ port_INLINE void sixtop_sendEB(void) { eb->l2_securityLevel = IEEE802154_SECURITY_LEVEL_BEACON; eb->l2_keyIdMode = IEEE802154_SECURITY_KEYIDMODE; eb->l2_keyIndex = IEEE802154_security_getBeaconKeyIndex(); + + // Select the radioType on which the EB will be sent + eb->l2_radioType = (radioType_t)(sixtop_vars.dsn&0x01)+0x01; // put in queue for MAC to handle sixtop_send_internal(eb,eb->l2_payloadIEpresent); From bca732e1bb019db92c286f2b4ae1fe18f1dc4d0a Mon Sep 17 00:00:00 2001 From: jmmunoz86 Date: Fri, 2 Nov 2018 11:14:29 +0100 Subject: [PATCH 26/37] Not nice workaround to use a different radioType for consecutive DIOs. Consider the radioType when updating the rank in the neighbor table. --- openstack/03b-IPv6/icmpv6rpl.c | 7 ++++++- openstack/03b-IPv6/icmpv6rpl.h | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/openstack/03b-IPv6/icmpv6rpl.c b/openstack/03b-IPv6/icmpv6rpl.c index c311f7e4f2..823f3f59ee 100644 --- a/openstack/03b-IPv6/icmpv6rpl.c +++ b/openstack/03b-IPv6/icmpv6rpl.c @@ -15,6 +15,7 @@ //=========================== variables ======================================= icmpv6rpl_vars_t icmpv6rpl_vars; +uint8_t helper_counter; // helps to send DIOs on different radiotypes //=========================== prototypes ====================================== @@ -41,6 +42,7 @@ void icmpv6rpl_init(void) { //===== reset local variables memset(&icmpv6rpl_vars,0,sizeof(icmpv6rpl_vars_t)); + helper_counter = 0; //=== routing icmpv6rpl_vars.haveParent=FALSE; @@ -568,7 +570,7 @@ void icmpv6rpl_indicateRxDIO(OpenQueueEntry_t* msg) { // update rank of that neighbor in table for (i=0;il2_nextORpreviousHop),&NeighborAddress)) { // matching address + if (packetfunctions_sameAddress(&(msg->l2_nextORpreviousHop),&NeighborAddress) && (msg->l2_nextORpreviousHop.addr_64b.rtype == NeighborAddress.addr_64b.rtype)) { // matching address neighborRank=neighbors_getNeighborRank(i); if ( (icmpv6rpl_vars.incomingDio->rank > neighborRank) && @@ -705,6 +707,9 @@ void sendDIO(void) { // set DIO destination memcpy(&(msg->l3_destinationAdd),&icmpv6rpl_vars.dioDestination,sizeof(open_addr_t)); + // add radio type ((msg->l2_dsn)&0x01)+0x01); + msg->l2_radioType = (radioType_t)((++helper_counter&0x01)+0x01); + //===== Configuration option packetfunctions_reserveHeaderSize(msg,sizeof(icmpv6rpl_config_ht)); diff --git a/openstack/03b-IPv6/icmpv6rpl.h b/openstack/03b-IPv6/icmpv6rpl.h index 3c379a420e..0a59eb2031 100644 --- a/openstack/03b-IPv6/icmpv6rpl.h +++ b/openstack/03b-IPv6/icmpv6rpl.h @@ -12,7 +12,7 @@ //=========================== define ========================================== -#define DIO_PORTION 6 // The portion of minimal cells that used for sending DIO. +#define DIO_PORTION 4 // The portion of minimal cells that used for sending DIO. #define TIMER_DAO_TIMEOUT 60 // seconds // Non-Storing Mode of Operation (1) From 685a02992eb15372bf285bac07f3b736f20ebf6b Mon Sep 17 00:00:00 2001 From: jmmunoz86 Date: Sun, 4 Nov 2018 18:44:31 +0100 Subject: [PATCH 27/37] send DAO on the correct radioType --- openstack/02b-MAChigh/sixtop.c | 2 +- openstack/03b-IPv6/icmpv6rpl.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/openstack/02b-MAChigh/sixtop.c b/openstack/02b-MAChigh/sixtop.c index 76e70bd387..0d2d71248d 100644 --- a/openstack/02b-MAChigh/sixtop.c +++ b/openstack/02b-MAChigh/sixtop.c @@ -635,7 +635,7 @@ owerror_t sixtop_send_internal( // //one EB with every radio // msg->l2_radioType = (radioType_t)(((msg->l2_dsn)&0x01)+0x01); // } - +// check if there is no assoaciated radioType to tx if (msg->l2_radioType == (radioType_t)0){ msg->l2_radioType = 1; }; diff --git a/openstack/03b-IPv6/icmpv6rpl.c b/openstack/03b-IPv6/icmpv6rpl.c index 823f3f59ee..caa517ac1b 100644 --- a/openstack/03b-IPv6/icmpv6rpl.c +++ b/openstack/03b-IPv6/icmpv6rpl.c @@ -881,6 +881,8 @@ void sendDAO(void) { //getting only preferred parent as transit numTransitParents=0; icmpv6rpl_getPreferredParentEui64(&address); + //add radio type + msg->l2_radioType = address.addr_64b.rtype; packetfunctions_writeAddress(msg,&address,OW_BIG_ENDIAN); prefix=idmanager_getMyID(ADDR_PREFIX); packetfunctions_writeAddress(msg,prefix,OW_BIG_ENDIAN); From d4837afa40c10b560712c9684217362aabdd3664 Mon Sep 17 00:00:00 2001 From: jmmunoz86 Date: Mon, 5 Nov 2018 09:45:48 +0100 Subject: [PATCH 28/37] Increase maxTxDataPrepare to allow long packets to be loaded into the radio. --- bsp/boards/openmote-b/board_info.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bsp/boards/openmote-b/board_info.h b/bsp/boards/openmote-b/board_info.h index ca99d1c039..63b54ae7c3 100644 --- a/bsp/boards/openmote-b/board_info.h +++ b/bsp/boards/openmote-b/board_info.h @@ -81,7 +81,7 @@ // time-slot related #define PORT_TsSlotDuration 1310 // counter counts one extra count, see datasheet // execution speed related - #define PORT_maxTxDataPrepare 40 // 2014us (measured 746us) 40 + #define PORT_maxTxDataPrepare 60 // 2014us (measured 746us) 40 #define PORT_maxRxAckPrepare 30 // 305us (measured 83us) #define PORT_maxRxDataPrepare 30 // 1007us (measured 84us) #define PORT_maxTxAckPrepare 40 // 305us (measured 219us) From 3ea9a0c2dfce83154fed70ec8816dca5f1feec16 Mon Sep 17 00:00:00 2001 From: jmmunoz86 Date: Mon, 5 Nov 2018 09:47:10 +0100 Subject: [PATCH 29/37] casting to correct type (radioType) --- openstack/02b-MAChigh/sixtop.c | 2 +- openstack/03b-IPv6/icmpv6rpl.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/openstack/02b-MAChigh/sixtop.c b/openstack/02b-MAChigh/sixtop.c index 0d2d71248d..8ba407555b 100644 --- a/openstack/02b-MAChigh/sixtop.c +++ b/openstack/02b-MAChigh/sixtop.c @@ -637,7 +637,7 @@ owerror_t sixtop_send_internal( // } // check if there is no assoaciated radioType to tx if (msg->l2_radioType == (radioType_t)0){ - msg->l2_radioType = 1; + msg->l2_radioType = (radioType_t)1; }; // change owner to IEEE802154E fetches it from queue diff --git a/openstack/03b-IPv6/icmpv6rpl.c b/openstack/03b-IPv6/icmpv6rpl.c index caa517ac1b..ca79d4adc5 100644 --- a/openstack/03b-IPv6/icmpv6rpl.c +++ b/openstack/03b-IPv6/icmpv6rpl.c @@ -707,7 +707,7 @@ void sendDIO(void) { // set DIO destination memcpy(&(msg->l3_destinationAdd),&icmpv6rpl_vars.dioDestination,sizeof(open_addr_t)); - // add radio type ((msg->l2_dsn)&0x01)+0x01); + // add radiotype ((msg->l2_dsn)&0x01)+0x01); msg->l2_radioType = (radioType_t)((++helper_counter&0x01)+0x01); //===== Configuration option From 407c2eb0b312bf6f69514dc3ce94fb2a2254f0ca Mon Sep 17 00:00:00 2001 From: jmmunoz86 Date: Wed, 7 Nov 2018 14:25:43 +0100 Subject: [PATCH 30/37] MAX output power --- bsp/boards/openmote-b/cc2538rf.h | 2 +- bsp/chips/at86rf215/at86rf215.h | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/bsp/boards/openmote-b/cc2538rf.h b/bsp/boards/openmote-b/cc2538rf.h index 82b05c2bb1..96d8881f33 100644 --- a/bsp/boards/openmote-b/cc2538rf.h +++ b/bsp/boards/openmote-b/cc2538rf.h @@ -16,7 +16,7 @@ *---------------------------------------------------------------------------*/ /* Constants */ #define CC2538_RF_CCA_THRES_USER_GUIDE 0xF8 -#define CC2538_RF_TX_POWER_RECOMMENDED 0xD5 /* TODO: Check value */ +#define CC2538_RF_TX_POWER_RECOMMENDED 0xFF /* TODO: Check value */ #define CC2538_RF_CHANNEL_MIN 11 //poipoi -- in fact is sending on 0x17 check that. #define CC2538_RF_CHANNEL_MAX 26 #define CC2538_RF_CHANNEL_SPACING 5 diff --git a/bsp/chips/at86rf215/at86rf215.h b/bsp/chips/at86rf215/at86rf215.h index fad6b883f2..18342db70b 100644 --- a/bsp/chips/at86rf215/at86rf215.h +++ b/bsp/chips/at86rf215/at86rf215.h @@ -4069,7 +4069,7 @@ static const registerSetting_t basic_settings_fsk_option3 []={ //DO NOT USE {RG_RF09_EDD, 0x7A}, {RG_RF09_TXCUTC, 0x84}, //find the right values {RG_RF09_TXDFE, 0x12}, //find the right values - {RG_RF09_PAC, 0x64},// Tx Power 5 bits >>. 0x64 = txPwr=>0x04, max: 0x1F. + {RG_RF09_PAC, 0x7F},// Tx Power 5 bits >>. 0x64 = txPwr=>0x04, max: 0x1F. {RG_BBC0_IRQM, 0x1F},// TXFE, RXEM, RXAM, RXFE, RXFS interrupts enabled {RG_BBC1_IRQM, 0x00}, {RG_BBC0_PC, 0x15},// No FCS filter, 32 bits FCS, FSK. @@ -4103,7 +4103,7 @@ static const registerSetting_t basic_settings_oqpsk_rate1[] = { {RG_RF09_AGCS, 0x77}, {RG_RF09_TXCUTC, 0xC7}, // .PARAMP = 3, .LPFCUT = 7 {RG_RF09_TXDFE, 0x7A}, // .SR = 0xA, .RCUT = 3 - {RG_RF09_PAC, 0x64},// Tx Power 5 bits >>. 0x64 = txPwr=>0x04, max: 0x1F. + {RG_RF09_PAC, 0x7F},// Tx Power 5 bits >>. 0x64 = txPwr=>0x04, max: 0x1F. }; static const registerSetting_t basic_settings_oqpsk_rate2[] = { @@ -4124,7 +4124,7 @@ static const registerSetting_t basic_settings_oqpsk_rate2[] = { {RG_RF09_AGCS, 0x77}, {RG_RF09_TXCUTC, 0xC7}, // .PARAMP = 3, .LPFCUT = 7 {RG_RF09_TXDFE, 0x7A}, // .SR = 0xA, .RCUT = 3 - {RG_RF09_PAC, 0x64},// Tx Power 5 bits >>. 0x64 = txPwr=>0x04, max: 0x1F. + {RG_RF09_PAC, 0x7F},// Tx Power 5 bits >>. 0x64 = txPwr=>0x04, max: 0x1F. }; static const registerSetting_t basic_settings_oqpsk_rate3[] = { @@ -4145,7 +4145,7 @@ static const registerSetting_t basic_settings_oqpsk_rate3[] = { {RG_RF09_AGCS, 0x77}, {RG_RF09_TXCUTC, 0xC7}, // .PARAMP = 3, .LPFCUT = 7 {RG_RF09_TXDFE, 0x7A}, // .SR = 0xA, .RCUT = 3 - {RG_RF09_PAC, 0x64},// Tx Power 5 bits >>. 0x64 = txPwr=>0x04, max: 0x1F. + {RG_RF09_PAC, 0x7F},// Tx Power 5 bits >>. 0x64 = txPwr=>0x04, max: 0x1F. }; static const registerSetting_t basic_settings_oqpsk_rate4[] = { @@ -4166,7 +4166,7 @@ static const registerSetting_t basic_settings_oqpsk_rate4[] = { {RG_RF09_AGCS, 0x77}, {RG_RF09_TXCUTC, 0xC7}, // .PARAMP = 3, .LPFCUT = 7 {RG_RF09_TXDFE, 0x7A}, // .SR = 0xA, .RCUT = 3 - {RG_RF09_PAC, 0x64},// Tx Power 5 bits >>. 0x64 = txPwr=>0x04, max: 0x1F. + {RG_RF09_PAC, 0x7F},// Tx Power 5 bits >>. 0x64 = txPwr=>0x04, max: 0x1F. }; //------------------------------------ OFDM -----------------------------------// /** Preferred settings for OFDM */ @@ -4181,7 +4181,7 @@ static const registerSetting_t basic_settings_ofdm_1_mcs0[] = { {RG_RF09_EDD, 0x7A}, {RG_RF09_TXCUTC, 0x0A},//recommended value (0x0B) {RG_RF09_TXDFE, 0x83}, - {RG_RF09_PAC, 0x64},// Tx Power 5 bits >>. 0x64 = txPwr=>0x04, max: 0x1F. // 0x64 - 0dBm mettre 0x7F + {RG_RF09_PAC, 0x7F},// Tx Power 5 bits >>. 0x64 = txPwr=>0x04, max: 0x1F. // 0x64 - 0dBm mettre 0x7F {RG_BBC0_IRQM, 0x1F}, {RG_BBC1_IRQM, 0x00}, {RG_BBC0_PC, 0x16},//NO FCS FILTER @@ -4199,7 +4199,7 @@ static const registerSetting_t basic_settings_ofdm_1_mcs1[] = { {RG_RF09_EDD, 0x7A}, {RG_RF09_TXCUTC, 0x0A},//recommended value (0x0B) {RG_RF09_TXDFE, 0x83}, - {RG_RF09_PAC, 0x64},// Tx Power 5 bits >>. 0x64 = txPwr=>0x04, max: 0x1F. // 0x64 - 0dBm mettre 0x7F + {RG_RF09_PAC, 0x7F},// Tx Power 5 bits >>. 0x64 = txPwr=>0x04, max: 0x1F. // 0x64 - 0dBm mettre 0x7F {RG_BBC0_IRQM, 0x1F}, {RG_BBC1_IRQM, 0x00}, {RG_BBC0_PC, 0x16},//NO FCS FILTER @@ -4217,7 +4217,7 @@ static const registerSetting_t basic_settings_ofdm_1_mcs2[] = { {RG_RF09_EDD, 0x7A}, {RG_RF09_TXCUTC, 0x0A},//recommended value (0x0B) {RG_RF09_TXDFE, 0x83}, - {RG_RF09_PAC, 0x64},// Tx Power 5 bits >>. 0x64 = txPwr=>0x04, max: 0x1F. // 0x64 - 0dBm mettre 0x7F + {RG_RF09_PAC, 0x7F},// Tx Power 5 bits >>. 0x64 = txPwr=>0x04, max: 0x1F. // 0x64 - 0dBm mettre 0x7F {RG_BBC0_IRQM, 0x1F}, {RG_BBC1_IRQM, 0x00}, {RG_BBC0_PC, 0x16},//NO FCS FILTER @@ -4235,7 +4235,7 @@ static const registerSetting_t basic_settings_ofdm_1_mcs3_subghz[] = { //TODO {RG_RF09_EDD, 0x7A}, {RG_RF09_TXCUTC, 0x0A},//recommended value (0x0B) {RG_RF09_TXDFE, 0x83}, - {RG_RF09_PAC, 0x64},// Tx Power 5 bits >>. 0x64 = txPwr=>0x04, max: 0x1F. // 0x64 - 0dBm mettre 0x7F + {RG_RF09_PAC, 0x7F},// Tx Power 5 bits >>. 0x64 = txPwr=>0x04, max: 0x1F. // 0x64 - 0dBm mettre 0x7F {RG_BBC0_IRQM, 0x1F}, {RG_BBC1_IRQM, 0x00}, {RG_BBC0_PC, 0x16},//NO FCS FILTER From 504d4eb3580e7bff81efb26f3c6d1205f42cc517 Mon Sep 17 00:00:00 2001 From: jmmunoz86 Date: Wed, 7 Nov 2018 14:28:11 +0100 Subject: [PATCH 31/37] EB sent on each PHY --- openstack/02b-MAChigh/sixtop.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/openstack/02b-MAChigh/sixtop.c b/openstack/02b-MAChigh/sixtop.c index 8ba407555b..eb7731a317 100644 --- a/openstack/02b-MAChigh/sixtop.c +++ b/openstack/02b-MAChigh/sixtop.c @@ -636,9 +636,9 @@ owerror_t sixtop_send_internal( // msg->l2_radioType = (radioType_t)(((msg->l2_dsn)&0x01)+0x01); // } // check if there is no assoaciated radioType to tx - if (msg->l2_radioType == (radioType_t)0){ - msg->l2_radioType = (radioType_t)1; - }; +// if (msg->l2_radioType == (radioType_t)0){ +// msg->l2_radioType = (radioType_t)1; +// }; // change owner to IEEE802154E fetches it from queue msg->owner = COMPONENT_SIXTOP_TO_IEEE802154E; @@ -843,7 +843,8 @@ port_INLINE void sixtop_sendEB(void) { eb->l2_keyIndex = IEEE802154_security_getBeaconKeyIndex(); // Select the radioType on which the EB will be sent - eb->l2_radioType = (radioType_t)(sixtop_vars.dsn&0x01)+0x01; + //eb->l2_radioType = (radioType_t)(sixtop_vars.dsn&0x01)+0x01; + eb->l2_radioType = (radioType_t)(sixtop_vars.dsn%SCHEDULE_MINIMAL_6TISCH_ACTIVE_CELLS); // put in queue for MAC to handle sixtop_send_internal(eb,eb->l2_payloadIEpresent); From 27069190bf18deae83d2db289328b218710afedf Mon Sep 17 00:00:00 2001 From: jmmunoz86 Date: Thu, 8 Nov 2018 16:11:22 +0100 Subject: [PATCH 32/37] send DIO on each radioType available --- openstack/03b-IPv6/icmpv6rpl.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/openstack/03b-IPv6/icmpv6rpl.c b/openstack/03b-IPv6/icmpv6rpl.c index ca79d4adc5..efe516984e 100644 --- a/openstack/03b-IPv6/icmpv6rpl.c +++ b/openstack/03b-IPv6/icmpv6rpl.c @@ -708,8 +708,9 @@ void sendDIO(void) { memcpy(&(msg->l3_destinationAdd),&icmpv6rpl_vars.dioDestination,sizeof(open_addr_t)); // add radiotype ((msg->l2_dsn)&0x01)+0x01); - msg->l2_radioType = (radioType_t)((++helper_counter&0x01)+0x01); - + //msg->l2_radioType = (radioType_t)((++helper_counter&0x01)+0x01);SCHEDULE_MINIMAL_6TISCH_ACTIVE_CELLS + msg->l2_radioType = (radioType_t)(++helper_counter%SCHEDULE_MINIMAL_6TISCH_ACTIVE_CELLS); + //===== Configuration option packetfunctions_reserveHeaderSize(msg,sizeof(icmpv6rpl_config_ht)); From 5fb070566745082174e0c6259cfebd1cb7fb4645 Mon Sep 17 00:00:00 2001 From: jmmunoz86 Date: Thu, 8 Nov 2018 16:15:04 +0100 Subject: [PATCH 33/37] SLOTFRAME_LENGTH of 101 TS --- openstack/02b-MAChigh/schedule.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openstack/02b-MAChigh/schedule.h b/openstack/02b-MAChigh/schedule.h index 77305c8d23..624f750d23 100644 --- a/openstack/02b-MAChigh/schedule.h +++ b/openstack/02b-MAChigh/schedule.h @@ -17,7 +17,7 @@ The superframe reappears over time and can be arbitrarily long. */ -#define SLOTFRAME_LENGTH 31 //should be 101, using 31 so the network synchs faster +#define SLOTFRAME_LENGTH 101 //should be 101, using 31 so the network synchs faster //draft-ietf-6tisch-minimal-06 #define SCHEDULE_MINIMAL_6TISCH_ACTIVE_CELLS MAX_NUM_RADIOS From ee088390f7cd7b30eef48958a8b69ab37514c3f1 Mon Sep 17 00:00:00 2001 From: jmmunoz86 Date: Thu, 8 Nov 2018 21:38:03 +0100 Subject: [PATCH 34/37] adding radioType criterion to neighbors --- bsp/boards/common/openradios.h | 4 +++- bsp/boards/openmote-b/board_info.h | 2 +- openstack/02b-MAChigh/neighbors.c | 12 ++++++------ openstack/02b-MAChigh/schedule.c | 3 ++- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/bsp/boards/common/openradios.h b/bsp/boards/common/openradios.h index 6b601be305..964691edb3 100644 --- a/bsp/boards/common/openradios.h +++ b/bsp/boards/common/openradios.h @@ -98,7 +98,8 @@ typedef uint8_t (*radio_getDelayRx_cbt)(void); typedef uint8_t (*radio_getChInitOffset_cbt)(void); typedef uint16_t (*radio_getNumOfChannels_cbt)(void); typedef uint16_t (*radio_getCh_spacing_cbt)(void); -typedef uint32_t (*radio_getCenterFreq_cbt)(void); +typedef uint32_t (*radio_getCenterFreq_cbt)(void); +typedef uint8_t (*radio_getRadioStatus_cbt)(void); typedef struct { radio_powerOn_cbt radio_powerOn_cb; @@ -132,6 +133,7 @@ typedef struct { radio_getNumOfChannels_cbt radio_getNumOfChannels_cb; radio_getCh_spacing_cbt radio_getCh_spacing_cb; radio_getCenterFreq_cbt radio_getCenterFreq_cb; + radio_getRadioStatus_cbt radio_getRadioStatus_cb; } radio_functions_t; typedef struct { diff --git a/bsp/boards/openmote-b/board_info.h b/bsp/boards/openmote-b/board_info.h index 63b54ae7c3..78bc8f61c2 100644 --- a/bsp/boards/openmote-b/board_info.h +++ b/bsp/boards/openmote-b/board_info.h @@ -119,7 +119,7 @@ #define NUM_CHANNELS 3 // number of channels to channel hop on #define DEFAULT_CH_SPACING 1200 // default channel spacing for subghz #define DEFAULT_FREQUENCY_CENTER 863625 // defualt freque -#define delayTx_SUBGHZ delayTx_OFDM1 +#define delayTx_SUBGHZ delayTx_2FSK_50 //delayTx_OFDM1 #define delayRx_SUBGHZ 0 #define NUM_CHANNELS_SUBGHZ 3 diff --git a/openstack/02b-MAChigh/neighbors.c b/openstack/02b-MAChigh/neighbors.c index 621e3a1d84..0414f87f46 100644 --- a/openstack/02b-MAChigh/neighbors.c +++ b/openstack/02b-MAChigh/neighbors.c @@ -141,7 +141,7 @@ bool neighbors_getNeighborIsInBlacklist(uint8_t index){ uint8_t neighbors_getSequenceNumber(open_addr_t* address){ uint8_t i; for (i=0;iaddr_64b.rtype == neighbors_vars.neighbors[i].radioType){ break; } } @@ -418,7 +418,7 @@ void neighbors_indicateTx( void neighbors_updateSequenceNumber(open_addr_t* address){ uint8_t i; for (i=0;iaddr_64b.rtype == neighbors_vars.neighbors[i].radioType){ neighbors_vars.neighbors[i].sequenceNumber = (neighbors_vars.neighbors[i].sequenceNumber+1) & 0xFF; // rollover from 0xff to 0x01 if (neighbors_vars.neighbors[i].sequenceNumber == 0){ @@ -432,7 +432,7 @@ void neighbors_updateSequenceNumber(open_addr_t* address){ void neighbors_resetSequenceNumber(open_addr_t* address){ uint8_t i; for (i=0;iaddr_64b.rtype == neighbors_vars.neighbors[i].radioType){ neighbors_vars.neighbors[i].sequenceNumber = 0; break; } @@ -549,18 +549,18 @@ This really belongs to icmpv6rpl but it would require a much more complex interf uint16_t neighbors_getLinkMetric(uint8_t index) { uint16_t rankIncrease; uint32_t rankIncreaseIntermediary; // stores intermediary results of rankIncrease calculation - + // we assume that this neighbor has already been checked for being in use // calculate link cost to this neighbor if (neighbors_vars.neighbors[index].numTxACK==0) { if (neighbors_vars.neighbors[index].numTx > DEFAULTLINKCOST){ if (neighbors_vars.neighbors[index].numTx < MINIMAL_NUM_TX){ - rankIncrease = (3*neighbors_vars.neighbors[index].numTx-2)*MINHOPRANKINCREASE; + rankIncrease = (3*neighbors_vars.neighbors[index].numTx-2)*MINHOPRANKINCREASE; } else { rankIncrease = 65535; } } else { - rankIncrease = (3*DEFAULTLINKCOST-2)*MINHOPRANKINCREASE; + rankIncrease = (3*DEFAULTLINKCOST-2)*MINHOPRANKINCREASE; } } else { //6TiSCH minimal draft using OF0 for rank computation: ((3*numTx/numTxAck)-2)*minHopRankIncrease diff --git a/openstack/02b-MAChigh/schedule.c b/openstack/02b-MAChigh/schedule.c index 1e49c92134..fcd273282e 100644 --- a/openstack/02b-MAChigh/schedule.c +++ b/openstack/02b-MAChigh/schedule.c @@ -645,7 +645,8 @@ bool schedule_hasDedicatedCellToNeighbor(open_addr_t* neighbor){ for(i=0;iaddr_64b.rtype ){ return TRUE; } From 1259f7b3e04914b2ca3115f333ed9ddcb8815222 Mon Sep 17 00:00:00 2001 From: jmmunoz86 Date: Thu, 8 Nov 2018 22:49:41 +0100 Subject: [PATCH 35/37] Configuring the front end radio at synch time. --- openstack/02a-MAClow/IEEE802154E.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/openstack/02a-MAClow/IEEE802154E.c b/openstack/02a-MAClow/IEEE802154E.c index e9e2885db4..2ce2639dfd 100644 --- a/openstack/02a-MAClow/IEEE802154E.c +++ b/openstack/02a-MAClow/IEEE802154E.c @@ -116,7 +116,7 @@ void ieee154e_init(void) { memset(&ieee154e_dbg,0,sizeof(ieee154e_dbg_t)); // set singleChannel to 0 to enable channel hopping. - ieee154e_vars.singleChannel = TRUE; + ieee154e_vars.singleChannel = 11; ieee154e_vars.isAckEnabled = TRUE; ieee154e_vars.isSecurityEnabled = FALSE; ieee154e_vars.slotDuration = TsSlotDuration; @@ -125,7 +125,7 @@ void ieee154e_init(void) { ieee154e_vars.ch_spacing = DEFAULT_CH_SPACING; ieee154e_vars.frequency = DEFAULT_FREQUENCY_CENTER; ieee154e_vars.modem = MODEM_SUBGHZ; - ieee154e_vars.radioType = RADIOTYPE_SUBGHZ_2FSK_50; + ieee154e_vars.radioType = RADIOTYPE_SUBGHZ_OFDM_1_800; // default hopping template memcpy( @@ -553,6 +553,9 @@ port_INLINE void activity_synchronize_newSlot(void) { ieee154e_vars.radio_functions[MODEM_SUBGHZ].radio_setStartFrameCb_cb(ieee154e_startOfFrame); ieee154e_vars.radio_functions[MODEM_SUBGHZ].radio_setEndFrameCb_cb(ieee154e_endOfFrame); + // configure the radio front-end with the corresponding PHY + ieee154e_vars.radio_functions[ieee154e_vars.modem].radio_load_phy_cb((uint8_t)ieee154e_vars.radioType); + //get first channel number offset ieee154e_vars.ChInitOffset = ieee154e_vars.radio_functions[MODEM_SUBGHZ].radio_getChInitOffset_cb(); From 459b8114194d483e3b87e0deab014f33eb68c727 Mon Sep 17 00:00:00 2001 From: jmmunoz86 Date: Thu, 8 Nov 2018 22:51:58 +0100 Subject: [PATCH 36/37] function to read the state of the radio. AT86RF215 goes to TXPREP after receiving a frame. After receiving a frame, putting the radio back to listen. --- bsp/boards/openmote-b/radio_2d4ghz.c | 2 ++ bsp/boards/openmote-b/radio_2d4ghz.h | 1 + bsp/boards/openmote-b/radio_subghz.c | 12 ++++++++++-- bsp/boards/openmote-b/radio_subghz.h | 1 + 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/bsp/boards/openmote-b/radio_2d4ghz.c b/bsp/boards/openmote-b/radio_2d4ghz.c index 5396e6758f..f892db5e60 100644 --- a/bsp/boards/openmote-b/radio_2d4ghz.c +++ b/bsp/boards/openmote-b/radio_2d4ghz.c @@ -92,6 +92,7 @@ void radio_2d4ghz_setFunctions(radio_functions_t* funcs){ funcs->radio_getCh_spacing_cb = radio_2d4ghz_getCh_spacing_cb; funcs->radio_getNumOfChannels_cb = radio_2d4ghz_getNumOfChannels_cb; funcs->radio_getCenterFreq_cb = radio_2d4ghz_getCenterFreq_cb; + funcs->radio_getRadioStatus_cb = radio_2d4ghz_getRadioStatus_cb; } void radio_2d4ghz_init() { @@ -604,3 +605,4 @@ uint8_t radio_2d4ghz_getChInitOffset(void){} uint16_t radio_2d4ghz_getNumOfChannels_cb(void){} uint16_t radio_2d4ghz_getCh_spacing_cb(void){} uint32_t radio_2d4ghz_getCenterFreq_cb(void){} +uint8_t radio_2d4ghz_getRadioStatus_cb(void){} diff --git a/bsp/boards/openmote-b/radio_2d4ghz.h b/bsp/boards/openmote-b/radio_2d4ghz.h index 33b4f54c3d..05386cebac 100644 --- a/bsp/boards/openmote-b/radio_2d4ghz.h +++ b/bsp/boards/openmote-b/radio_2d4ghz.h @@ -74,6 +74,7 @@ uint8_t radio_2d4ghz_getChInitOffset(void); uint16_t radio_2d4ghz_getNumOfChannels_cb(void); uint16_t radio_2d4ghz_getCh_spacing_cb(void); uint32_t radio_2d4ghz_getCenterFreq_cb(void); +uint8_t radio_2d4ghz_getRadioStatus_cb(void); // interrupt handlers kick_scheduler_t radio_2d4ghz_isr(void); diff --git a/bsp/boards/openmote-b/radio_subghz.c b/bsp/boards/openmote-b/radio_subghz.c index 0dda70b903..2b2d053146 100644 --- a/bsp/boards/openmote-b/radio_subghz.c +++ b/bsp/boards/openmote-b/radio_subghz.c @@ -99,6 +99,7 @@ void radio_subghz_setFunctions(radio_functions_t * funcs) { funcs->radio_getCh_spacing_cb = radio_subghz_getCh_spacing_cb; funcs->radio_getNumOfChannels_cb = radio_subghz_getNumOfChannels_cb; funcs->radio_getCenterFreq_cb = radio_subghz_getCenterFreq_cb; + funcs->radio_getRadioStatus_cb = radio_subghz_getRadioStatus_cb; } void radio_subghz_powerOn(void) { @@ -299,20 +300,21 @@ void radio_subghz_rxEnable(void) { // wiggle debug pin debugpins_radio_set(); leds_debug_on(); + //at86rf215_spiStrobe(CMD_RF_TXPREP); at86rf215_spiStrobe(CMD_RF_RX); - // change state radio_subghz_vars.state = RADIOSTATE_LISTENING; } void radio_subghz_rxNow(void) { + + //at86rf215_spiStrobe(CMD_RF_RX); //nothing to do if(at86rf215_status() != RF_STATE_RX){ leds_error_toggle(); return; } - } void radio_subghz_getReceivedFrame( @@ -362,6 +364,10 @@ uint16_t radio_subghz_getCh_spacing_cb(void){ uint32_t radio_subghz_getCenterFreq_cb(void){ return radio_subghz_vars.phy_tsch_config_current.center_freq_0; } + +uint8_t radio_subghz_getRadioStatus_cb(void){ + return at86rf215_status(); +} //=========================== private ========================================= void radio_subghz_read_isr(){ @@ -422,6 +428,8 @@ void radio_subghz_isr() { if (radio_subghz_vars.endFrame_cb!=NULL) { // call the callback radio_subghz_vars.endFrame_cb(capturedTime); + // put the radio to listen + radio_subghz_rxEnable(); // kick the OS //result = KICK_SCHEDULER; } else { diff --git a/bsp/boards/openmote-b/radio_subghz.h b/bsp/boards/openmote-b/radio_subghz.h index 4fdb984eb8..c13d58a704 100644 --- a/bsp/boards/openmote-b/radio_subghz.h +++ b/bsp/boards/openmote-b/radio_subghz.h @@ -76,6 +76,7 @@ uint8_t radio_subghz_getChInitOffset(void); uint16_t radio_subghz_getCh_spacing_cb(void); uint16_t radio_subghz_getNumOfChannels_cb(void); uint32_t radio_subghz_getCenterFreq_cb(void); +uint8_t radio_subghz_getRadioStatus_cb(void); /** \} \} From ceb53fbbd1a8aaafbbaea24c9c7c33abb9716e0d Mon Sep 17 00:00:00 2001 From: jmmunoz86 Date: Tue, 13 Nov 2018 10:59:08 +0100 Subject: [PATCH 37/37] delayTX of OFDM (synch with this PHY). radio keeps listening despite the RXFE ISR. No need to reload the RXFS and RXFE callbacks. --- bsp/boards/openmote-b/board_info.h | 2 +- bsp/boards/openmote-b/radio_subghz.c | 4 ++-- openstack/02a-MAClow/IEEE802154E.c | 11 +++++++---- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/bsp/boards/openmote-b/board_info.h b/bsp/boards/openmote-b/board_info.h index 78bc8f61c2..b3b99ba064 100644 --- a/bsp/boards/openmote-b/board_info.h +++ b/bsp/boards/openmote-b/board_info.h @@ -119,7 +119,7 @@ #define NUM_CHANNELS 3 // number of channels to channel hop on #define DEFAULT_CH_SPACING 1200 // default channel spacing for subghz #define DEFAULT_FREQUENCY_CENTER 863625 // defualt freque -#define delayTx_SUBGHZ delayTx_2FSK_50 //delayTx_OFDM1 +#define delayTx_SUBGHZ delayTx_OFDM1 //delayTx_2FSK_50 // #define delayRx_SUBGHZ 0 #define NUM_CHANNELS_SUBGHZ 3 diff --git a/bsp/boards/openmote-b/radio_subghz.c b/bsp/boards/openmote-b/radio_subghz.c index 2b2d053146..f8e682f74e 100644 --- a/bsp/boards/openmote-b/radio_subghz.c +++ b/bsp/boards/openmote-b/radio_subghz.c @@ -426,10 +426,10 @@ void radio_subghz_isr() { if ((radio_subghz_vars.bb0_isr & IRQS_RXFE_MASK)){ radio_subghz_vars.state = RADIOSTATE_TXRX_DONE; if (radio_subghz_vars.endFrame_cb!=NULL) { + // put again the radio to listen + at86rf215_spiStrobe(CMD_RF_RX); // call the callback radio_subghz_vars.endFrame_cb(capturedTime); - // put the radio to listen - radio_subghz_rxEnable(); // kick the OS //result = KICK_SCHEDULER; } else { diff --git a/openstack/02a-MAClow/IEEE802154E.c b/openstack/02a-MAClow/IEEE802154E.c index 2ce2639dfd..6cb7dfd844 100644 --- a/openstack/02a-MAClow/IEEE802154E.c +++ b/openstack/02a-MAClow/IEEE802154E.c @@ -550,8 +550,8 @@ port_INLINE void activity_synchronize_newSlot(void) { // turn off the radio (in case it wasn't yet) ieee154e_vars.radio_functions[MODEM_SUBGHZ].radio_rfOff_cb(); - ieee154e_vars.radio_functions[MODEM_SUBGHZ].radio_setStartFrameCb_cb(ieee154e_startOfFrame); - ieee154e_vars.radio_functions[MODEM_SUBGHZ].radio_setEndFrameCb_cb(ieee154e_endOfFrame); + //ieee154e_vars.radio_functions[MODEM_SUBGHZ].radio_setStartFrameCb_cb(ieee154e_startOfFrame); + //ieee154e_vars.radio_functions[MODEM_SUBGHZ].radio_setEndFrameCb_cb(ieee154e_endOfFrame); // configure the radio front-end with the corresponding PHY ieee154e_vars.radio_functions[ieee154e_vars.modem].radio_load_phy_cb((uint8_t)ieee154e_vars.radioType); @@ -2942,7 +2942,7 @@ function should already have been done. If this is not the case, this function will do that for you, but assume that something went wrong. */ void endSlot(void) { - + //ieee154e_vars.wasIinEndofSlot = TRUE; // turn off the radio ieee154e_vars.radio_functions[ieee154e_vars.modem].radio_rfOff_cb(); @@ -3033,9 +3033,12 @@ void endSlot(void) { // reset local variable ieee154e_vars.ackReceived = NULL; } - + //ieee154e_vars.radio_state = ieee154e_vars.radio_functions[ieee154e_vars.modem].radio_getRadioStatus_cb(); + // change state changeState(S_SLEEP); + + //ieee154e_vars.wasIinEndofSlot = FALSE; } bool ieee154e_isSynch(void) {