drivers/wireless/ieee802154/mrf24j40: Fixes issue with non-beacon enabled mode

This commit is contained in:
Anthony Merlino 2017-07-10 12:38:39 -04:00
parent 28d1db02b8
commit bbf37a0db8
2 changed files with 17 additions and 15 deletions

View File

@ -242,6 +242,8 @@ void mrf24j40_setorder(FAR struct mrf24j40_radio_s *dev, uint8_t bo, uint8_t so)
uint32_t maincnt = 0;
uint32_t slpcal = 0;
wlinfo("bo: %d, so: %d\n", bo, so);
/* Calibrate the Sleep Clock (SLPCLK) frequency. Refer to Section 3.15.1.2
* Sleep Clock Calibration.
*/
@ -277,13 +279,23 @@ void mrf24j40_setorder(FAR struct mrf24j40_radio_s *dev, uint8_t bo, uint8_t so)
slpcal |= (mrf24j40_getreg(dev->spi, MRF24J40_SLPCAL1) << 8);
slpcal |= ((mrf24j40_getreg(dev->spi, MRF24J40_SLPCAL2) << 16) & 0x0F);
/* Set WAKECNT (SLPACK 0x35<6:0>) value = 0xC8 to set the main oscillator
* (20 MHz) start-up timer value.
*/
mrf24j40_setreg(dev->spi, MRF24J40_SLPACK, 0xC8);
/* Set WAKETIME to recommended value for 100kHz SLPCLK Source */
mrf24j40_setreg(dev->spi, MRF24J40_WAKETIMEL, 0xD2);
mrf24j40_setreg(dev->spi, MRF24J40_WAKETIMEH, 0x00);
/* Program the Beacon Interval into the Main Counter, MAINCNT (0x229<1:0>,
* 0x228, 0x227, 0x226), and Remain Counter, REMCNT (0x225, 0x224),
* according to BO and SO values. Refer to Section 3.15.1.3 Sleep Mode
* Counters
*/
mrf24j40_setreg(dev->spi, MRF24J40_REMCNTL, (MRF24J40_REMCNT & 0xFF));
mrf24j40_setreg(dev->spi, MRF24J40_REMCNTH, ((MRF24J40_REMCNT >> 8) & 0xFF));

View File

@ -258,16 +258,6 @@ int mrf24j40_reset(FAR struct ieee802154_radio_s *radio)
mrf24j40_setreg(dev->spi, MRF24J40_ACKTMOUT, 0x39 | MRF24J40_ACKTMOUT_DRPACK);
/* Set WAKECNT (SLPACK 0x35<6:0>) value = 0xC8 to set the main oscillator
* (20 MHz) start-up timer value.
*/
mrf24j40_setreg(dev->spi, MRF24J40_SLPACK, 0xC8);
/* Set WAKETIME to recommended value for 100kHz SLPCLK Source */
mrf24j40_setreg(dev->spi, MRF24J40_WAKETIMEL, 0xD2);
mrf24j40_setreg(dev->spi, MRF24J40_WAKETIMEH, 0x00);
/* Enable the SLPIF and WAKEIF flags */