You need to specify that SPI is used as master: CONFIG_NRF52_SPI0_MASTER=y
niedz., 25 lut 2024 o 21:22 Mauro Sollar <[email protected]> napisaĆ(a):
> Hi,
>
> I'm trying to use the BMI160 sensor with the Nordic nRF52832-dk Kit, help
> me please!
>
> Kconfig Configuration:
>
> System type
> nRF52 Peripheral Selection
> (*) SPI 0
> Device Drivers
> (*) SPI Driver Support
> (*) SPI character driver
> (*) Sensor Device Support
> (*) Bosch BMI160 Inertial Measurement Sensor support
> IO Expander/GPIO Support
> (*) GPIO driver
> Application Configuration
> Examples
> (*) BMI160
>
> I added the following lines to the file:
> ./boards/arm/nrf52/nrf52832-dk/src/nrf52_bringup.c
>
>
> int nrf52_bringup(void)
> {
> int ret;
> ...
> ...
> ...
>
> struct spi_dev_s *dev = nrf52_spibus_initialize(0);
> ret = bmi160_register("/dev/accel0", dev);
> if (ret < 0)
> {
> syslog(LOG_ERR, "ERROR: bmi160_register failed: %d\n", ret);
> }
>
> ...
> ...
> ...
>
>
> }
>
> Show this error:
>
> board/nrf52_bringup.c:104:27: warning: implicit declaration of function
> 'nrf52_spibus_initialize'; did you mean 'nrf52_spidev_initialize'?
> [-Wimplicit-function-declaration]
> 104 | struct spi_dev_s *dev = nrf52_spibus_initialize(0);
> | ^~~~~~~~~~~~~~~~~~~~~~~
> | nrf52_spidev_initialize
> board/nrf52_bringup.c:104:27: warning: initialization of 'struct spi_dev_s
> *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
> LD: nuttx
> arm-none-eabi-ld:
> /home/mauro/nuttxspace/nuttx/staging/libdrivers.a(bmi160_base.o): in
> function `bmi160_getreg8':
> /home/mauro/nuttxspace/nuttx/drivers/sensors/bmi160_base.c:87: undefined
> reference to `bmi160_configspi'
> arm-none-eabi-ld:
> /home/mauro/nuttxspace/nuttx/staging/libdrivers.a(bmi160_base.o): in
> function `bmi160_putreg8':
> /home/mauro/nuttxspace/nuttx/drivers/sensors/bmi160_base.c:145: undefined
> reference to `bmi160_configspi'
> arm-none-eabi-ld:
> /home/mauro/nuttxspace/nuttx/staging/libdrivers.a(bmi160_base.o): in
> function `bmi160_getreg16':
> /home/mauro/nuttxspace/nuttx/drivers/sensors/bmi160_base.c:205: undefined
> reference to `bmi160_configspi'
> arm-none-eabi-ld:
> /home/mauro/nuttxspace/nuttx/staging/libdrivers.a(bmi160_base.o): in
> function `bmi160_getregs':
> /home/mauro/nuttxspace/nuttx/drivers/sensors/bmi160_base.c:265: undefined
> reference to `bmi160_configspi'
> make[1]: *** [Makefile:197: nuttx] Erro 1
> make: *** [tools/Unix.mk:546: nuttx] Erro 2
>
>
> thanks,
> --
> Mauro Costa Sollar
> Cel.: 31 98894-2932
>