HAL_PX4: lower SPI bus speed on invensense devices
now we are using DMA we don't need such high bus speed, and this makes SPI reliable with a wider range of devices.
This commit is contained in:
parent
7d57f00ca0
commit
0e793e1214
@ -29,15 +29,15 @@ namespace PX4 {
|
||||
#define KHZ (1000U)
|
||||
|
||||
SPIDesc SPIDeviceManager::device_table[] = {
|
||||
SPIDesc("mpu6000", PX4_SPI_BUS_SENSORS, (spi_dev_e)PX4_SPIDEV_MPU, SPIDEV_MODE3, 500*KHZ, 11*MHZ),
|
||||
SPIDesc("mpu6000", PX4_SPI_BUS_SENSORS, (spi_dev_e)PX4_SPIDEV_MPU, SPIDEV_MODE3, 500*KHZ, 8*MHZ),
|
||||
#if defined(PX4_SPIDEV_EXT_BARO)
|
||||
SPIDesc("ms5611_ext", PX4_SPI_BUS_EXT, (spi_dev_e)PX4_SPIDEV_EXT_BARO, SPIDEV_MODE3, 20*MHZ, 20*MHZ),
|
||||
#endif
|
||||
#if defined(PX4_SPIDEV_ICM)
|
||||
SPIDesc("icm20608", PX4_SPI_BUS_SENSORS, (spi_dev_e)PX4_SPIDEV_ICM, SPIDEV_MODE3, 500*KHZ, 20*MHZ),
|
||||
SPIDesc("icm20608", PX4_SPI_BUS_SENSORS, (spi_dev_e)PX4_SPIDEV_ICM, SPIDEV_MODE3, 500*KHZ, 8*MHZ),
|
||||
#endif
|
||||
// ICM20608 on the ACCEL_MAG
|
||||
SPIDesc("icm20608-am", PX4_SPI_BUS_SENSORS, (spi_dev_e)PX4_SPIDEV_ACCEL_MAG, SPIDEV_MODE3, 500*KHZ, 20*MHZ),
|
||||
// ICM20608 on the ACCEL_MAG
|
||||
SPIDesc("icm20608-am", PX4_SPI_BUS_SENSORS, (spi_dev_e)PX4_SPIDEV_ACCEL_MAG, SPIDEV_MODE3, 500*KHZ, 8*MHZ),
|
||||
#if CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_PX4_V4
|
||||
SPIDesc("ms5611_int", PX4_SPI_BUS_BARO, (spi_dev_e)PX4_SPIDEV_BARO, SPIDEV_MODE3, 20*MHZ, 20*MHZ),
|
||||
#endif
|
||||
@ -52,11 +52,11 @@ SPIDesc SPIDeviceManager::device_table[] = {
|
||||
#ifdef PX4_SPIDEV_EXT_GYRO
|
||||
SPIDesc("lsm9ds0_ext_g",PX4_SPI_BUS_EXT, (spi_dev_e)PX4_SPIDEV_EXT_GYRO, SPIDEV_MODE3, 11*MHZ, 11*MHZ),
|
||||
#endif
|
||||
SPIDesc("mpu9250", PX4_SPI_BUS_SENSORS, (spi_dev_e)PX4_SPIDEV_MPU, SPIDEV_MODE3, 1*MHZ, 20*MHZ),
|
||||
SPIDesc("mpu9250", PX4_SPI_BUS_SENSORS, (spi_dev_e)PX4_SPIDEV_MPU, SPIDEV_MODE3, 1*MHZ, 8*MHZ),
|
||||
#ifdef PX4_SPIDEV_EXT_MPU
|
||||
SPIDesc("mpu6000_ext", PX4_SPI_BUS_EXT, (spi_dev_e)PX4_SPIDEV_EXT_MPU, SPIDEV_MODE3, 500*KHZ, 11*MHZ),
|
||||
SPIDesc("mpu9250_ext", PX4_SPI_BUS_EXT, (spi_dev_e)PX4_SPIDEV_EXT_MPU, SPIDEV_MODE3, 1*MHZ, 11*MHZ),
|
||||
SPIDesc("icm20608_ext", PX4_SPI_BUS_EXT, (spi_dev_e)PX4_SPIDEV_EXT_MPU, SPIDEV_MODE3, 1*MHZ, 11*MHZ),
|
||||
SPIDesc("mpu6000_ext", PX4_SPI_BUS_EXT, (spi_dev_e)PX4_SPIDEV_EXT_MPU, SPIDEV_MODE3, 500*KHZ, 8*MHZ),
|
||||
SPIDesc("mpu9250_ext", PX4_SPI_BUS_EXT, (spi_dev_e)PX4_SPIDEV_EXT_MPU, SPIDEV_MODE3, 1*MHZ, 8*MHZ),
|
||||
SPIDesc("icm20608_ext", PX4_SPI_BUS_EXT, (spi_dev_e)PX4_SPIDEV_EXT_MPU, SPIDEV_MODE3, 1*MHZ, 8*MHZ),
|
||||
#endif
|
||||
#ifdef PX4_SPIDEV_HMC
|
||||
SPIDesc("hmc5843", PX4_SPI_BUS_SENSORS, (spi_dev_e)PX4_SPIDEV_HMC, SPIDEV_MODE3, 11*MHZ, 11*MHZ),
|
||||
@ -130,7 +130,7 @@ void SPIDevice::do_transfer(uint8_t *send, uint8_t *recv, uint32_t len)
|
||||
registered a driver on this bus. If not then we can avoid the
|
||||
irqsave/irqrestore and get bus parallelism for DMA enabled
|
||||
buses.
|
||||
|
||||
|
||||
There is a race in this if a PX4 driver starts while we are
|
||||
running this, but that would only happen at early boot and is
|
||||
very unlikely
|
||||
@ -189,7 +189,7 @@ AP_HAL::Semaphore *SPIDevice::get_semaphore()
|
||||
return &bus.semaphore;
|
||||
}
|
||||
|
||||
|
||||
|
||||
AP_HAL::Device::PeriodicHandle SPIDevice::register_periodic_callback(uint32_t period_usec, AP_HAL::Device::PeriodicCb cb)
|
||||
{
|
||||
return bus.register_periodic_callback(period_usec, cb);
|
||||
@ -203,7 +203,7 @@ bool SPIDevice::adjust_periodic_callback(AP_HAL::Device::PeriodicHandle h, uint3
|
||||
|
||||
/*
|
||||
return a SPIDevice given a string device name
|
||||
*/
|
||||
*/
|
||||
AP_HAL::OwnPtr<AP_HAL::SPIDevice>
|
||||
SPIDeviceManager::get_device(const char *name)
|
||||
{
|
||||
@ -236,7 +236,7 @@ SPIDeviceManager::get_device(const char *name)
|
||||
}
|
||||
busp->next = buses;
|
||||
busp->bus = desc.bus;
|
||||
busp->dev = up_spiinitialize(desc.bus);
|
||||
busp->dev = up_spiinitialize(desc.bus);
|
||||
buses = busp;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user