Hello everybody, I have seen in the auto_init_at86rf2xx.c file a loop which tries to find valid devices.
The loop-counter is used for discovering spi-busses and also for the device descriptor ("i" in the code). I think this is not a good idea because what happens if you have only ONE device sitting on the SECOND spi-bus? The device will not be found. I think you need two counters - one for numbering the spi-bus and one for the device descriptor. Do you agree?
// for (unsigned i = 0; i < AT86RF2XX_NUM; i++) { unsigned i = 1; /* Number of SPI bus */ unsigned k = 0; /* Number device descriptor */ DEBUG("Initializing AT86RF2xx radio at SPI_%i\n", i); const at86rf2xx_params_t *p = &at86rf2xx_params[k]; int res = at86rf2xx_init(&at86rf2xx_devs[k], p->spi, p->spi_speed, p->cs_pin, p->int_pin, p->sleep_pin, p->reset_pin);
if (res < 0) { printf("ERROR"); DEBUG("Error initializing AT86RF2xx radio device!\n"); } else { gnrc_nomac_init(_nomac_stacks[k], AT86RF2XX_MAC_STACKSIZE, AT86RF2XX_MAC_PRIO, "at86rfxx", (gnrc_netdev_t *)&at86rf2xx_devs[k]); } // }
Regards, Bernhard