Browse Source

clean up, change SPI2 clock back to 12MHz and remove debug prints

sbg
Mark Whitehorn 9 years ago committed by Lorenz Meier
parent
commit
ecbcfe838b
  1. 8
      src/drivers/boards/px4fmu-v4/board_config.h
  2. 9
      src/drivers/boards/px4fmu-v4/px4fmu_init.c
  3. 6
      src/drivers/ms5611/ms5611_nuttx.cpp
  4. 6
      src/drivers/ms5611/ms5611_spi.cpp

8
src/drivers/boards/px4fmu-v4/board_config.h

@ -122,14 +122,18 @@ __BEGIN_DECLS @@ -122,14 +122,18 @@ __BEGIN_DECLS
#define PX4_SPI_BUS_RAMTRON 2
/* Use these in place of the spi_dev_e enumeration to select a specific SPI device on SPI1 */
//#define PX4_SPIDEV_FRAM 0
#define PX4_SPIDEV_GYRO 1
#define PX4_SPIDEV_ACCEL_MAG 2
#define PX4_SPIDEV_BARO 3
#define PX4_SPIDEV_MPU 4
#define PX4_SPIDEV_HMC 5
#define PX4_SPIDEV_ICM 6
/* onboard MS5611 and FRAM are both on bus SPI2
* spi_dev_e:SPIDEV_FLASH has the value 2 and is used in the NuttX ramtron driver
* use 3 for the barometer to differentiate
*/
#define PX4_SPIDEV_BARO 3
/* I2C busses */
#define PX4_I2C_BUS_EXPANSION 1
#define PX4_I2C_BUS_LED PX4_I2C_BUS_EXPANSION

9
src/drivers/boards/px4fmu-v4/px4fmu_init.c

@ -301,11 +301,12 @@ __EXPORT int nsh_archinitialize(void) @@ -301,11 +301,12 @@ __EXPORT int nsh_archinitialize(void)
return -ENODEV;
}
/* Default SPI2 to 37.5 MHz (40 MHz rounded to nearest valid divider, F4 max)
* and de-assert the known chip selects. */
/* Default SPI2 to 12MHz and de-assert the known chip selects.
* MS5611 has max SPI clock speed of 20MHz
*/
// XXX start with 10.4 MHz in FRAM usage and go up to 37.5 once validated
SPI_SETFREQUENCY(spi2, 1 * 1000 * 1000);
// XXX start with 10.4 MHz and go up to 20 once validated
SPI_SETFREQUENCY(spi2, 12 * 1000 * 1000);
SPI_SETBITS(spi2, 8);
SPI_SETMODE(spi2, SPIDEV_MODE3);
SPI_SELECT(spi2, SPIDEV_FLASH, false);

6
src/drivers/ms5611/ms5611_nuttx.cpp

@ -902,8 +902,6 @@ crc4(uint16_t *n_prom) @@ -902,8 +902,6 @@ crc4(uint16_t *n_prom)
bool
start_bus(struct ms5611_bus_option &bus)
{
warnx("start_bus id %u", (unsigned)bus.busid);
if (bus.dev != nullptr) {
errx(1, "bus option already started");
}
@ -911,8 +909,6 @@ start_bus(struct ms5611_bus_option &bus) @@ -911,8 +909,6 @@ start_bus(struct ms5611_bus_option &bus)
prom_u prom_buf;
device::Device *interface = bus.interface_constructor(prom_buf, bus.busnum);
warnx("init ms5611 on bus id %u", (unsigned)bus.busid);
if (interface->init() != OK) {
delete interface;
warnx("no device on bus %u", (unsigned)bus.busid);
@ -927,8 +923,6 @@ start_bus(struct ms5611_bus_option &bus) @@ -927,8 +923,6 @@ start_bus(struct ms5611_bus_option &bus)
return false;
}
warnx("open ms5611 on bus %u", (unsigned)bus.busid);
int fd = open(bus.devpath, O_RDONLY);
/* set the poll rate to default, starts automatic data collection */

6
src/drivers/ms5611/ms5611_spi.cpp

@ -149,7 +149,6 @@ MS5611_SPI::init() @@ -149,7 +149,6 @@ MS5611_SPI::init()
if (ret != OK) {
DEVICE_DEBUG("SPI init failed");
warnx("SPI::init failed");
goto out;
}
@ -158,7 +157,6 @@ MS5611_SPI::init() @@ -158,7 +157,6 @@ MS5611_SPI::init()
if (ret != OK) {
DEVICE_DEBUG("reset failed");
warnx("SPI::reset failed");
goto out;
}
@ -167,7 +165,6 @@ MS5611_SPI::init() @@ -167,7 +165,6 @@ MS5611_SPI::init()
if (ret != OK) {
DEVICE_DEBUG("prom readout failed");
warnx("SPI::prom readout failed");
goto out;
}
@ -264,7 +261,6 @@ MS5611_SPI::_read_prom() @@ -264,7 +261,6 @@ MS5611_SPI::_read_prom()
}
//DEVICE_DEBUG("prom[%u]=0x%x", (unsigned)i, (unsigned)_prom.c[i]);
warnx("prom[%u]=0x%x", (unsigned)i, (unsigned)_prom.c[i]);
}
/* calculate CRC and return success/failure accordingly */
@ -272,12 +268,10 @@ MS5611_SPI::_read_prom() @@ -272,12 +268,10 @@ MS5611_SPI::_read_prom()
if (ret != OK) {
DEVICE_DEBUG("crc failed");
warnx("crc failed");
}
if (all_zero) {
DEVICE_DEBUG("prom all zero");
warnx("prom all zero");
ret = -EIO;
}

Loading…
Cancel
Save