[riot-notifications] [RIOT-OS/RIOT] drivers/at86rf2xx: do not hang on no dev (#12142)

fabian18 notifications at github.com
Mon Sep 2 10:48:48 CEST 2019


### Contribution description

The device driver was hanging, if no device was connected.
`_init()` ->
`at86rf2xx_reset` ->
`at86rf2xx_set_state` ->
`_set_state(dev, AT86RF2XX_STATE_TRX_OFF, state)`

Since no state transition was happening, MISO never returned the expect state AT86RF2XX_STATE_TRX_OFF. (endless loop)

To prevent this, the driver checks the configured part number, before it resets the device.
If the part number matches, you can assume that the expected device is connected.
Additionally check if SPI bus can be acquired once, because `getbus()` ignores the return value. 

### Testing procedure

Start default test application tests/at86rf2xx.
With an at86rf2xx connected everything is as before.
Without an at86rf2xx connected the program prints 
`No device could be initialized`

### Issues/PRs references

None

You can view, comment on, or merge this pull request online at:

  https://github.com/RIOT-OS/RIOT/pull/12142

-- Commit Summary --

  * drivers/at86rf2xx: do not hang on no dev

-- File Changes --

    M drivers/at86rf2xx/at86rf2xx_netdev.c (17)
    M tests/driver_at86rf2xx/main.c (11)

-- Patch Links --

https://github.com/RIOT-OS/RIOT/pull/12142.patch
https://github.com/RIOT-OS/RIOT/pull/12142.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/12142
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190902/06528ecd/attachment.htm>


More information about the notifications mailing list