-
Notifications
You must be signed in to change notification settings - Fork 242
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Develop fw 708 2sfk50 40msTS #444
base: develop_FW-708
Are you sure you want to change the base?
Changes from 16 commits
fab04fd
40c3b58
27c95f2
624449b
79336db
ad8f24c
904fd34
edf69f9
8cfe8eb
51571fb
108e7f6
2568331
48a0581
9313be0
d4973c1
d28132a
074bf13
55795d4
d2f68d3
98ed0f0
f6466bd
db8a1cc
abb9737
d70cef5
58969b9
15cc4cb
bb2ef57
bca732e
685a029
d4837af
3ea9a0c
407c2eb
504d4eb
2706919
5fb0705
ee08839
1259f7b
459b811
ceb53fb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,36 +59,38 @@ | |
|
||
//===== 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 | ||
#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 | ||
// time-slot related | ||
#define PORT_TsSlotDuration 492 // 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 42 // 214us (measured 219us) | ||
#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 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) | ||
#define PORT_maxRxDataPrepare 30 // 1007us (measured 84us) | ||
#define PORT_maxTxAckPrepare 40 // 305us (measured 219us) | ||
// radio speed related | ||
#define delayTx_2FSK_50 67 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The delayTx , delayRx are defined in radio_2d4ghz / radio_subghz files |
||
#define delayTx_OFDM1 40 | ||
|
||
#define PORT_wdAckDuration 260 | ||
// radio watchdog | ||
#endif | ||
|
||
//===== adaptive_sync accuracy | ||
|
@@ -106,16 +108,32 @@ | |
|
||
|
||
// 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 | ||
|
||
|
||
//#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 ======================================== | ||
|
||
typedef enum { | ||
RADIOTPYE_2D4GHZ = 0, | ||
RADIOTPYE_SUBGHZ = 1, | ||
RADIOTPYE_ANY = 2 | ||
MODEM_2D4GHZ = 0, | ||
MODEM_SUBGHZ = 1, | ||
FREQBAND_ANY = 2 | ||
} modem_t; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why create a modem type here? what the difference betwen this and the radioType |
||
|
||
typedef enum { | ||
RADIOTYPE_2D4GHZ = 0, | ||
RADIOTYPE_SUBGHZ_OFDM_1_800 = 1, | ||
RADIOTYPE_SUBGHZ_2FSK_50 = 2, | ||
RADIOTYPE_ANY = 3 | ||
} radioType_t; | ||
|
||
//=========================== variables ======================================= | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if this callback function is not used, you need remove it from the openradio.h file as well. Also the radio_2d4ghz_change_size function should be removed |
||
// reset | ||
funcs->radio_reset_cb = radio_2d4ghz_reset; | ||
// TX | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,9 +46,15 @@ typedef struct { | |
|
||
radio_subghz_vars_t radio_subghz_vars; | ||
|
||
phy_tsch_config_t phy_tsch_config_2fsk_50_subGHz; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. are those variables used in this PR? |
||
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); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. function should start with name radio_subghz_ |
||
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 | ||
|
@@ -85,6 +90,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) { | ||
|
@@ -151,18 +157,14 @@ 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 | ||
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); | ||
// 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); | ||
}; | ||
|
||
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){ | ||
|
@@ -192,6 +194,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 +203,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 +235,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 +328,10 @@ uint8_t radio_subghz_getDelayRx(void){ | |
return delayRx_SUBGHZ; | ||
} | ||
|
||
uint8_t radio_getChInitOffset(void){ | ||
return ChInitOffset; | ||
} | ||
|
||
//=========================== private ========================================= | ||
|
||
void radio_subghz_read_isr(){ | ||
|
@@ -412,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; | ||
|
||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here is initialize the variables, when are they being used? |
||
// ==== not used for subghz radio | ||
void radio_subghz_loadPacket_prepare(uint8_t* packet, uint8_t len){} | ||
void radio_subghz_rxPacket_prepare(void){} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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,30 +4002,33 @@ 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 []={ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why rename it? |
||
{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}, | ||
{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 []={ | ||
|
@@ -4196,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}, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The timing below depends on which radio is used by openmote-b, those timing should be moved to radio.h files can call dynamically.
I recommend to use a fixed timing for FSK modulation, and use the timing variable for 2.4GHz and OQPSK 800kb/s as well. Only delayTx timing need to be adjust to each three PHY layers. With this, the timing part would be much easier.