debugging ms5611 on spi2

This commit is contained in:
Mark Whitehorn 2015-12-31 17:47:31 +02:00 committed by Lorenz Meier
parent 32626b57a4
commit 4952d05652
6 changed files with 20 additions and 7 deletions

View File

@ -132,10 +132,10 @@ cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
set(CMAKE_BUILD_TYPE "" CACHE STRING "build type")
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY
STRINGS ";Debug;Release;RelWithDebInfo;MinSizeRel")
set(CONFIG "nuttx_px4fmu-v2_default" CACHE STRING "desired configuration")
set(CONFIG "nuttx_px4fmu-v4_default" CACHE STRING "desired configuration")
file(GLOB_RECURSE configs RELATIVE cmake/configs "cmake/configs/*.cmake")
set_property(CACHE CONFIG PROPERTY STRINGS ${configs})
set(THREADS "4" CACHE STRING
set(THREADS "8" CACHE STRING
"number of threads to use for external build processes")
set(DEBUG_PORT "/dev/ttyACM0" CACHE STRING "debugging port")

View File

@ -257,9 +257,10 @@
#define GPIO_SPI1_MOSI (GPIO_SPI1_MOSI_1|GPIO_SPEED_50MHz)
#define GPIO_SPI1_SCK (GPIO_SPI1_SCK_1|GPIO_SPEED_50MHz)
#define GPIO_SPI2_MISO (GPIO_SPI2_MISO_1|GPIO_SPEED_50MHz)
#define GPIO_SPI2_MOSI (GPIO_SPI2_MOSI_1|GPIO_SPEED_50MHz)
#define GPIO_SPI2_SCK (GPIO_SPI2_SCK_2|GPIO_SPEED_50MHz)
#define GPIO_SPI2_SCK (GPIO_SPI2_SCK_1|GPIO_SPEED_50MHz)
/************************************************************************************
* Public Data

View File

@ -73,7 +73,7 @@ __BEGIN_DECLS
/* LEDs */
#define GPIO_LED1 (GPIO_OUTPUT|GPIO_OPENDRAIN|GPIO_SPEED_50MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTB|GPIO_PIN11)
#define GPIO_LED2 (GPIO_OUTPUT|GPIO_OPENDRAIN|GPIO_SPEED_50MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTB|GPIO_PIN10)
#define GPIO_LED2 (GPIO_OUTPUT|GPIO_OPENDRAIN|GPIO_SPEED_50MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTB|GPIO_PIN1)
#define GPIO_LED3 (GPIO_OUTPUT|GPIO_OPENDRAIN|GPIO_SPEED_50MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTB|GPIO_PIN3)
#define GPIO_LED_RED GPIO_LED1

View File

@ -288,7 +288,6 @@ __EXPORT int nsh_archinitialize(void)
SPI_SETMODE(spi1, SPIDEV_MODE3);
SPI_SELECT(spi1, PX4_SPIDEV_GYRO, false);
SPI_SELECT(spi1, PX4_SPIDEV_HMC, false);
SPI_SELECT(spi1, PX4_SPIDEV_BARO, false);
SPI_SELECT(spi1, PX4_SPIDEV_MPU, false);
up_udelay(20);
@ -306,10 +305,11 @@ __EXPORT int nsh_archinitialize(void)
* and de-assert the known chip selects. */
// XXX start with 10.4 MHz in FRAM usage and go up to 37.5 once validated
SPI_SETFREQUENCY(spi2, 12 * 1000 * 1000);
SPI_SETFREQUENCY(spi2, 1 * 1000 * 1000);
SPI_SETBITS(spi2, 8);
SPI_SETMODE(spi2, SPIDEV_MODE3);
SPI_SELECT(spi2, SPIDEV_FLASH, false);
SPI_SELECT(spi2, PX4_SPIDEV_BARO, false);
#ifdef CONFIG_MMCSD
/* First, get an instance of the SDIO interface */

View File

@ -829,7 +829,7 @@ struct ms5611_bus_option {
{ MS5611_BUS_SPI_EXTERNAL, "/dev/ms5611_spi_ext", &MS5611_spi_interface, PX4_SPI_BUS_EXT, NULL },
#endif
#ifdef PX4_SPIDEV_BARO
{ MS5611_BUS_SPI_INTERNAL, "/dev/ms5611_spi_int", &MS5611_spi_interface, PX4_SPI_BUS_SENSORS, NULL },
{ MS5611_BUS_SPI_INTERNAL, "/dev/ms5611_spi_int", &MS5611_spi_interface, PX4_SPI_BUS_RAMTRON, NULL },
#endif
#ifdef PX4_I2C_BUS_ONBOARD
{ MS5611_BUS_I2C_INTERNAL, "/dev/ms5611_int", &MS5611_i2c_interface, PX4_I2C_BUS_ONBOARD, NULL },
@ -902,6 +902,8 @@ 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");
}
@ -909,6 +911,8 @@ 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);
@ -923,6 +927,8 @@ 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 */

View File

@ -149,6 +149,7 @@ MS5611_SPI::init()
if (ret != OK) {
DEVICE_DEBUG("SPI init failed");
warnx("SPI::init failed");
goto out;
}
@ -157,6 +158,7 @@ MS5611_SPI::init()
if (ret != OK) {
DEVICE_DEBUG("reset failed");
warnx("SPI::reset failed");
goto out;
}
@ -165,6 +167,7 @@ MS5611_SPI::init()
if (ret != OK) {
DEVICE_DEBUG("prom readout failed");
warnx("SPI::prom readout failed");
goto out;
}
@ -261,6 +264,7 @@ 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 */
@ -268,10 +272,12 @@ 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;
}