From 6db05caed964c750a346ab14f310b5d2485e1bac Mon Sep 17 00:00:00 2001 From: Jim Paris Date: Mon, 30 Jun 2014 23:13:21 -0400 Subject: [PATCH] Fix radio hangups when trying to transmit with radio off. The border-router tries to transmit and do other stuff after turning the radio off, and the radio driver didn't handle that very well. With this fix, it's no longer necessary to reset the border router after starting tunslip6. --- cpu/arm/aducrf101/dev/radio.c | 8 +++++++- platform/ev-aducrf101mkxz/README.md | 3 +-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/cpu/arm/aducrf101/dev/radio.c b/cpu/arm/aducrf101/dev/radio.c index 71f78f41b..6e2b2ca47 100644 --- a/cpu/arm/aducrf101/dev/radio.c +++ b/cpu/arm/aducrf101/dev/radio.c @@ -193,6 +193,9 @@ prepare(const void *payload, unsigned short payload_len) static int transmit(unsigned short transmit_len) { + if(!radio_is_on) + return RADIO_TX_ERR; + /* Transmit the packet */ if(transmit_len > MAX_PACKET_LEN) { transmit_len = MAX_PACKET_LEN; @@ -224,6 +227,9 @@ read(void *buf, unsigned short buf_len) uint8_t packet_len; int8_t rssi; + if(!radio_is_on) + return 0; + if(buf_len > MAX_PACKET_LEN) { buf_len = MAX_PACKET_LEN; } @@ -296,7 +302,7 @@ get_value(radio_param_t param, radio_value_t *value) case RADIO_PARAM_RSSI: { int8_t dbm; - if(RadioRadioGetRSSI(&dbm) != RIE_Success) { + if(!radio_is_on || RadioRadioGetRSSI(&dbm) != RIE_Success) { return RADIO_RESULT_ERROR; } *value = dbm; diff --git a/platform/ev-aducrf101mkxz/README.md b/platform/ev-aducrf101mkxz/README.md index 2d8e98c42..a4cf4dcb4 100644 --- a/platform/ev-aducrf101mkxz/README.md +++ b/platform/ev-aducrf101mkxz/README.md @@ -73,8 +73,7 @@ the SLIP tunnel on the host machine: -s /dev/serial/by-id/usb-SEGGER_J-Link_000541011111-if00 \ -B 115200 -v3 aaaa::1/64 -Press the RESET button on the eval board, then open the border router -home page at: http://[aaaa::3230:3030:3132:3334]/ +Open the border router's home page at: http://[aaaa::3230:3030:3132:3334]/ #### Web Server ####