Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Firmware implementation of OpenBenchmark API v0.0.1. #470

Open
wants to merge 42 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
39f407e
FW-807. Extend the radio API with setTxPower() function.
malishav Feb 13, 2019
e5e288a
FW-807. Implement setTxPower for CC2420.
malishav Feb 13, 2019
da948b0
FW-807. Imlement setTxPower for openmote-cc2538.
malishav Feb 13, 2019
5e961c1
FW-807. Implement setTxPower for AT86RF231.
malishav Feb 13, 2019
f9cd289
FW-807. use cc2538 implementation of setTxPower for openmote-b at 2.4…
malishav Feb 13, 2019
1a8f479
FW-807. Add setTxPower mockups for all radio chips.
malishav Feb 14, 2019
b574870
FW-806. Add placeholders for new command handling needed by OpenBench…
malishav Feb 13, 2019
f2f52b0
FW-806. Handle setTxPower command over serial.
malishav Feb 14, 2019
5dda5ce
FW-806. Add hop limit to packet metadata.
malishav Mar 1, 2019
384fdcc
FW-806. Add serial handling of sendPacket command and invoke a callback.
malishav Feb 15, 2019
23f37de
FW-806. Remove sendPacket parsing logic from openserial.
malishav Feb 28, 2019
1c2b997
FW-806. Do not print join event periodically.
malishav Mar 18, 2019
cc5bff2
FW-806. Add special serial frame type for benchmark data.
malishav Mar 19, 2019
376c486
FW-806. Remove remnants and separate STATUS enums from benchmark.
malishav Mar 19, 2019
8f912d1
FW-806. Align event IDs with OV.
malishav Mar 19, 2019
811cf60
FW-806. When generating benchmark serial events, include full EUI-64.
malishav Mar 19, 2019
5fea32e
FW-806. Send sync event asynchronously as well.
malishav Mar 19, 2019
0d2ded6
FW-806. Special event for dag root sending packets.
malishav Mar 20, 2019
a9c4e21
FW-806. Generate the event immediately after sending the packet at da…
malishav Mar 30, 2019
3675d04
FW-829. Implement No Response option handling as per RFC7967.
malishav Feb 27, 2019
9dfdc8e
FW-808. Add cbenchmark app files and placeholders.
malishav Feb 15, 2019
37e0b15
FW-808. cbenchmark init and placeholders.
malishav Feb 15, 2019
c945b13
FW-808. Add missing functions to python build.
malishav Feb 15, 2019
5899a31
FW-808. Implement sendPacket callback.
malishav Feb 27, 2019
d6cbfcc
FW-808. Implement OpenBenchmark confirmable through No Response option.
malishav Feb 27, 2019
b3b6061
FW-808. Implement burst handling.
malishav Feb 27, 2019
3827b32
FW-808. Implement sendPacket parsing logic within cbenchmark callback.
malishav Feb 28, 2019
7b9e3d6
FW-808. Mote detailed error logging in cbenchmark.
malishav Feb 28, 2019
3dcbbf6
FW-808. Use port 5684 to communicate with DAG root over the air.
malishav Mar 1, 2019
826d39b
FW-808. Parse the received packet token in the payload.
malishav Mar 1, 2019
4d522dd
FW-808. Implement packet sent/received event notifications in firmware.
malishav Mar 8, 2019
239d4b1
FW-808. Revert to using default CoAP port for openbenchmark.
malishav Mar 8, 2019
16403ce
FW-808. Fix warnings in cbenchmark.c.
malishav Mar 18, 2019
e12c4c2
FW-808. Adapt cbenchmark functions to the new serial printing API.
malishav Mar 19, 2019
3408bd9
FW-808. Align cbenchmark with new events.
malishav Apr 1, 2019
cbcfdf5
FW-808. packetToken as the last bytes in the app payload.
malishav Mar 20, 2019
3e3a69f
FW-808. Send responses when needed and generate events.
malishav Mar 30, 2019
593fcfc
cjoin: Reduce join time by polling more frequently.
malishav Jun 26, 2019
931418f
iotlab: Reduce delayTx for better synchro.
malishav Jun 26, 2019
cdbb695
FW-808. Add desync event in firmware.
malishav Jul 17, 2019
2cbd1a6
FW-808. Execute sendPacket in task mode.
malishav Jul 29, 2019
be4fe66
RPL: Reduce DAO period to 30s.
malishav Jul 29, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 28 additions & 24 deletions bsp/boards/derfmega/radio.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,22 +49,22 @@ void radio_init(void) {

// clear variables
memset(&radio_vars,0,sizeof(radio_vars_t));

// change state
radio_vars.state = RADIOSTATE_STOPPED;

// configure the radio
radio_internalWriteReg(TRX_STATE, CMD_FORCE_TRX_OFF); // turn radio off


radio_internalWriteReg(IRQ_MASK, 0b01001100); // enable TX_END,RX_START, RX_END interrupts
radio_internalWriteReg(IRQ_STATUS,0xFF); // clear all interrupts
radio_internalWriteReg(ANT_DIV, RADIO_CHIP_ANTENNA); // use chip antenna

radio_internalWriteReg(TRX_CTRL_1, 0x20); // have the radio calculate CRC
//busy wait until radio status is TRX_OFF
while((radio_internalReadReg(TRX_STATUS) & 0x1F) != TRX_OFF);

// change state
radio_vars.state = RADIOSTATE_RFOFF;
}
Expand Down Expand Up @@ -115,14 +115,18 @@ PORT_TIMER_WIDTH radio_getTimerPeriod(void) {
void radio_setFrequency(uint8_t frequency) {
// change state
radio_vars.state = RADIOSTATE_SETTING_FREQUENCY;

// configure the radio to the right frequecy
radio_internalWriteReg(PHY_CC_CCA,0x20+frequency);

// change state
radio_vars.state = RADIOSTATE_FREQUENCY_SET;
}

void radio_setTxPower(int8_t power) {
// TODO
}

void radio_rfOn(void) {
PRR1 &= ~_BV(PRTRX24);
}
Expand All @@ -134,11 +138,11 @@ void radio_rfOff(void) {
radio_internalWriteReg(TRX_STATE, CMD_FORCE_TRX_OFF);
//radio_spiWriteReg(RG_TRX_STATE, CMD_TRX_OFF);
while((radio_internalReadReg(TRX_STATUS) & 0x1F) != TRX_OFF); // busy wait until done

// wiggle debug pin
//debugpins_radio_clr();
leds_radio_off();

// change state
radio_vars.state = RADIOSTATE_RFOFF;
}
Expand All @@ -148,34 +152,34 @@ void radio_rfOff(void) {
void radio_loadPacket(uint8_t* packet, uint16_t len) {
// change state
radio_vars.state = RADIOSTATE_LOADING_PACKET;

// load packet in TXFIFO
radio_internalWriteTxFifo(packet,len);

// change state
radio_vars.state = RADIOSTATE_PACKET_LOADED;
}

void radio_txEnable(void) {
// change state
radio_vars.state = RADIOSTATE_ENABLING_TX;

// wiggle debug pin
//debugpins_radio_set();
leds_radio_on();

// turn on radio's PLL
radio_internalWriteReg(TRX_STATE, CMD_PLL_ON);
while((radio_internalReadReg(TRX_STATUS) & 0x1F) != PLL_ON); // busy wait until done

// change state
radio_vars.state = RADIOSTATE_TX_ENABLED;
}

void radio_txNow(void) {
// change state
radio_vars.state = RADIOSTATE_TRANSMITTING;

// send packet by forcing state to TX_START
radio_internalWriteReg(TRX_STATE, CMD_TX_START);
// The AT86RF231 does not generate an interrupt when the radio transmits the
Expand All @@ -196,16 +200,16 @@ void radio_txNow(void) {
void radio_rxEnable(void) {
// change state
radio_vars.state = RADIOSTATE_ENABLING_RX;

// put radio in reception mode
radio_internalWriteReg(TRX_STATE, CMD_RX_ON);
// wiggle debug pin
//debugpins_radio_set();
leds_radio_on();

// busy wait until radio really listening
while((radio_internalReadReg(TRX_STATUS) & 0x1F) != RX_ON);

// change state
radio_vars.state = RADIOSTATE_LISTENING;
}
Expand All @@ -221,17 +225,17 @@ void radio_getReceivedFrame(uint8_t* pBufRead,
uint8_t* pLqi,
bool* pCrc) {
uint8_t temp_reg_value;

//===== crc
temp_reg_value = radio_internalReadReg(PHY_RSSI);
*pCrc = (temp_reg_value & 0x80)>>7; // msb is whether packet passed CRC

//===== rssi
// as per section 8.4.3 of the AT86RF231, the RSSI is calculate as:
// -91 + ED [dBm]
temp_reg_value = radio_internalReadReg(PHY_ED_LEVEL);
*pRssi = -91 + temp_reg_value;

//===== packet
radio_internalReadRxFifo(pBufRead,
pLenRead,
Expand All @@ -254,9 +258,9 @@ void radio_internalReadRxFifo(uint8_t* pBufRead,
uint8_t* pLenRead,
uint8_t maxBufLen,
uint8_t* pLqi) {

*pLenRead = TST_RX_LENGTH;
memcpy(pBufRead,&TRXFBST,*pLenRead);
memcpy(pBufRead,&TRXFBST,*pLenRead);
//poipoi, see if LQI is included in the length
*pLqi = *(TRXFBST + pLenRead);
}
Expand All @@ -273,7 +277,7 @@ uint8_t radio_isr(void) {
uint8_t radio_rx_start_isr(void) {
PORT_TIMER_WIDTH capturedTime;
// capture the time
capturedTime = radiotimer_getCapturedTime();
capturedTime = radiotimer_getCapturedTime();
radio_vars.state = RADIOSTATE_RECEIVING;
if (radio_vars.startFrame_cb!=NULL) {
// call the callback
Expand All @@ -287,7 +291,7 @@ uint8_t radio_rx_start_isr(void) {
uint8_t radio_trx_end_isr(void) {
PORT_TIMER_WIDTH capturedTime;
// capture the time
capturedTime = radiotimer_getCapturedTime();
capturedTime = radiotimer_getCapturedTime();
radio_vars.state = RADIOSTATE_TXRX_DONE;
if (radio_vars.endFrame_cb!=NULL) {
// call the callback
Expand All @@ -296,4 +300,4 @@ uint8_t radio_trx_end_isr(void) {
return 1;
}
return 0;
}
}
Loading