drivers/mrf24j40: don't loop in mrf24j40_reset_state_machine()

When hooking up the mrf24j40 to a bluepill board, the driver would
always get stuck on init.

Debugging revealed that it would get stuck in the mrf24j40_reset_state_machine()
function because it expects the RFSTATE to have a special value after reset.

However, the data sheet does not mention this in section 3.1 Reset.
Waiting 192µs should be enough - the value of the RFSTATE is not specified.

The Linux driver also does not wait for the RFSTATE register.

And even without the loop, the driver is functioning fine.
This commit is contained in:
Benjamin Valentin 2019-10-11 23:01:54 +02:00
parent cce1438e61
commit 853bbaf5a5

View File

@ -476,14 +476,9 @@ void mrf24j40_assert_awake(mrf24j40_t *dev)
void mrf24j40_reset_state_machine(mrf24j40_t *dev)
{
uint8_t rfstate;
mrf24j40_reg_write_short(dev, MRF24J40_REG_RFCTL, MRF24J40_RFCTL_RFRST);
mrf24j40_reg_write_short(dev, MRF24J40_REG_RFCTL, 0x00);
xtimer_usleep(MRF24J40_STATE_RESET_DELAY); /* Delay at least 192us */
do {
rfstate = mrf24j40_reg_read_long(dev, MRF24J40_REG_RFSTATE);
} while ((rfstate & MRF24J40_RFSTATE_MASK) != MRF24J40_RFSTATE_RX);
}
void mrf24j40_software_reset(mrf24j40_t *dev)