diff --git a/src/Makefile b/src/Makefile index fc79b06e82bc3b62cae3a7c6094be09cded3fd35..c5e9d548a3370a696e54557e9bdca91c9b8652d2 100644 --- a/src/Makefile +++ b/src/Makefile @@ -13,7 +13,7 @@ PROGS = nmea2exif log_imu SRCS = nmea2exif.c log_imu.c OBJS = nmea2exif.o PHPSCRIPTS= start_gps_compass.php -PHPWEB= logger_launcher.php imu_setup.php +PHPWEB= logger_launcher.php imu_setup.php read_imu_log.php CFLAGS += -Wall -I$(STAGING_DIR_HOST)/usr/include-uapi LDLIBS += -lm diff --git a/src/imu_setup.php b/src/imu_setup.php index 3f62a5e6f7357576f4b9de53c7b8e63b68762611..8df798f1b09581ee70c2d2a43b8debe3ede49962 100755 --- a/src/imu_setup.php +++ b/src/imu_setup.php @@ -321,7 +321,7 @@ function help() {
  • gps_slot - specify the GPS board (103696) connection to the 10369 board 0 - none, 1 - J9, 2 - J10, 3 - J11. Default is 2 (J10)
  • gps_mode - synchronization mode for the GPS: 0 - pulse-per-sample external input, negative front, 1 - pps input positive front, 2 - start of a first sentence after pause, 3 - start of each individual sentence. Mode 2 is the default, modes 0 and 1 require that GPS has a dedicated synchro output
  • msg_conf - GPIO number and polarity (+16 - invert polarity) uses to log external events (i.e. odometer pulses from a vehicle wheel sensor). Timestamp uses leading edge, software may write to the 56-byte buffer (see 'msg=' command above) before the trailing edge to attach the message to the event after the event occured. In the case of short external pulses the logged message will be the last written before the event
  • -
  • img_sync - 0 - disable logging of the images, 1 - enable. In the case of the multiple synchronized cameras this provides a way to match external (master) camera timestamps transmitted over the synchronization cable, with the local camera timestamps used by the logger - both are logged. Default is 1
  • +
  • img_sync - 4 per-channel bits: 0 - disable logging of the images, 1 - enable. In the case of the multiple synchronized cameras this provides a way to match external (master) camera timestamps transmitted over the synchronization cable, with the local camera timestamps used by the logger - both are logged. Default is 0xf
  • extra_conf - Development signals (0 - config_long_sda_en, 1 -config_late_clk, 2 - config_single_wire, should be set for 103695 rev A). Default is 4
  • slow_spi - may be set to 1 for slow SPI devices (other changes may be needed, i.e. changing power from 3.3V to 5.0V selected by a resistor divider). Default is 0
  • imu_sa - i2c slave address modifier (matches hardware jumpers). Default is 3
  • @@ -638,7 +638,7 @@ function init_default_config() { 'gps_slot' => 2, 'gps_mode' => 2, // 0 - pps neg, 1 - pps pos, 2 - start of first sentence after pause, 3 start of sentence 'msg_conf' => 10, // GPIO bit number for external (odometer) input (+16 - invert polarity). Timestamp uses leading edge, software may write to 56-byte buffer before the trailing edge - 'img_sync' => 1, // enable logging image acquisition starts (0 - disable) + 'img_sync' => 0xf, // enable logging image acquisition starts (0 - disable) 'extra_conf' => 4, // 0 - config_long_sda_en, 1 -config_late_clk, 2 - config_single_wire, should be set for 103695 rev "A" 'slow_spi' => 0, // set to 1 for slow SPI devices (0 for ADIS-16375) 'imu_sa' => 3, // i2c slave address modifier for the 103695A pca9500 @@ -804,18 +804,27 @@ function setup_IMU_logger($conf) { $logger_conf |= (($conf ['msg_conf'] & 0x1f) | 0x20) << 8; // / #define IMUCR__SYN_CONF__BITNM 14 // logging frame time stamps (may be synchronized by another camera and have timestamp of that camera) // / #define IMUCR__SYN_CONF__WIDTH 1 // 0 - disable, 1 - enable - $logger_conf |= (($conf ['img_sync'] & 0x1) | 0x2) << 14; - // / #define IMUCR__RST_CONF__BITNM 16 // reset module + /// $logger_conf |= (($conf ['img_sync'] & 0x1) | 0x2) << 14; + //NC393 - per channel + $logger_conf |= (($conf ['img_sync'] & 0xf) | 0x10) << 14; + + + // / #define IMUCR__RST_CONF__BITNM 19 ///< reset module // was 16 in NC353 // / #define IMUCR__RST_CONF__WIDTH 1 // 0 - enable, 1 -reset (needs resettimng DMA address in ETRAX also) - // / #define IMUCR__DBG_CONF__BITNM 18 // several extra IMU configuration bits + // / #define IMUCR__DBG_CONF__BITNM 21 ///< several axtra IMU configuration bits (was 18 for NC353) // / #define IMUCR__DBG_CONF__WIDTH 4 // 0 - config_long_sda_en, 1 -config_late_clk, 2 - config_single_wire, should be set for 103695 rev "A" - $logger_conf |= (($conf ['extra_conf'] & 0xf) | 0x10) << 18; + $logger_conf |= (($conf ['extra_conf'] & 0xf) | 0x10) << 21; // was 18 in NC353; // / next bits used by the driver only, not the FPGA // / ((SLOW_SPI & 1)<<23) | \ // / (DFLT_SLAVE_ADDR << 24)) - $logger_conf |= ($conf ['slow_spi'] & 0x1) << 23; - $logger_conf |= ($conf ['imu_sa'] & 0x7) << 24; + //#define IMUCR__SLOW_SPI__BITNM 26 ///< just for the driver, not written to FPGA (was 23 for NC353) + //#define IMUCR__SLOW_SPI__WIDTH 1 ///< 0 - normal, 1 - slow SPI (programmed over i2c) + $logger_conf |= ($conf ['slow_spi'] & 0x1) << 26; // was 23 for NC353 + // #define IMUCR__I2C_SA3__BITNM 28 ///< Low 3 bits of the SA7 of the PCA9500 slave address + // #define IMUCR__I2C_SA3__WIDTH 3 ///< Should match jumpers + $logger_conf |= ($conf ['imu_sa'] & 0x7) << 28; // was 24 for NC353 + $data [$index ++] = $logger_conf & 0xff; $data [$index ++] = ($logger_conf >> 8) & 0xff; $data [$index ++] = ($logger_conf >> 16) & 0xff; @@ -964,23 +973,25 @@ function readSettings($conf = null) { // / #define IMUCR__SYN_CONF__WIDTH 1 // 0 - disable, 1 - enable // $logger_conf |= (($conf['img_sync'] & 0x1) | 0x2 )<< 14; - $conf ['img_sync'] = ($logger_conf >> 14) & 0x1; + //$conf ['img_sync'] = ($logger_conf >> 14) & 0x1; + $conf ['img_sync'] = ($logger_conf >> 14) & 0x0f; // was 1 in NC353 - // / #define IMUCR__RST_CONF__BITNM 16 // reset module + // / #define IMUCR__RST_CONF__BITNM 19 ///< reset module // was 16 in NC353 // / #define IMUCR__RST_CONF__WIDTH 1 // 0 - enable, 1 -reset (needs resettimng DMA address in ETRAX also) - // / #define IMUCR__DBG_CONF__BITNM 18 // several extra IMU configuration bits + // / #define IMUCR__DBG_CONF__BITNM 21 ///< several axtra IMU configuration bits (was 18 for NC353) // / #define IMUCR__DBG_CONF__WIDTH 4 // 0 - config_long_sda_en, 1 -config_late_clk, 2 - config_single_wire, should be set for 103695 rev "A" // $logger_conf |= (($conf['extra_conf'] & 0xf) | 0x10 )<< 18; - $conf ['extra_conf'] = ($logger_conf >> 18) & 0xf; + $conf ['extra_conf'] = ($logger_conf >> 21) & 0xf; // was 18 for NC353 // / next bits used by the driver only, not the FPGA // / ((SLOW_SPI & 1)<<23) | \ // / (DFLT_SLAVE_ADDR << 24)) // $logger_conf |= ($conf['slow_spi'] & 0x1)<< 23; // $logger_conf |= ($conf['imu_sa'] & 0x7)<< 24; - - $conf ['slow_spi'] = ($logger_conf >> 23) & 0x1; - $conf ['imu_sa'] = ($logger_conf >> 24) & 0x7; + //#define IMUCR__SLOW_SPI__BITNM 26 ///< just for the driver, not written to FPGA (was 23 for NC353) + //#define IMUCR__SLOW_SPI__WIDTH 1 ///< 0 - normal, 1 - slow SPI (programmed over i2c) + $conf ['slow_spi'] = ($logger_conf >> 26) & 0x1; // was 23 for NC353 + $conf ['imu_sa'] = ($logger_conf >> 28) & 0x7; // was 24 for NC353 // / read current time driver will go to sleep if the data is not ready yet (less than full sample in the buffer) diff --git a/src/start_gps_compass.php b/src/start_gps_compass.php index 485b10a065d2bf559a773f3e87f4e38edf2e5f89..f1b8e5eb0247be82cd1191d7bb8a332051363fd8 100755 --- a/src/start_gps_compass.php +++ b/src/start_gps_compass.php @@ -434,8 +434,8 @@ function init_default_config() { 'imu_slot' => 1, 'gps_slot' => 2, 'gps_mode' => 2, // 0 - pps pos, 1 - pps neg, 2 - start of first sesntence after pause, 3 start of sentence - 'msg_conf' => 10, // GPIO bit number for external (odometer) input (+16 - invert polarity). Timestamp uses leading edge, software may write to 56-byte buffer before the trailing edge - 'img_sync' => 1, // enable logging image acquisition starts (0 - disable) + 'msg_conf' => 6, // 10, // GPIO bit number for external (odometer) input (+16 - invert polarity). Timestamp uses leading edge, software may write to 56-byte buffer before the trailing edge + 'img_sync' => 0xf, // enable logging image acquisition starts (0 - disable), bit per channel 'extra_conf' => 4, // 0 - config_long_sda_en, 1 -config_late_clk, 2 - config_single_wire, should be set for 103695 rev "A" 'slow_spi' => 0, // set to 1 for slow SPI devices (0 for ADIS-16375) 'imu_sa' => 3, // i2c slave address modifier for the 103695A pca9500 @@ -602,18 +602,27 @@ function setup_IMU_logger($conf) { $logger_conf |= (($conf ['msg_conf'] & 0x1f) | 0x20) << 8; // / #define IMUCR__SYN_CONF__BITNM 14 // logging frame time stamps (may be synchronized by another camera and have timestamp of that camera) // / #define IMUCR__SYN_CONF__WIDTH 1 // 0 - disable, 1 - enable - $logger_conf |= (($conf ['img_sync'] & 0x1) | 0x2) << 14; - // / #define IMUCR__RST_CONF__BITNM 16 // reset module +/// $logger_conf |= (($conf ['img_sync'] & 0x1) | 0x2) << 14; + //NC393 - per channel + $logger_conf |= (($conf ['img_sync'] & 0xf) | 0x10) << 14; + + + // / #define IMUCR__RST_CONF__BITNM 19 ///< reset module // was 16 in NC353 // / #define IMUCR__RST_CONF__WIDTH 1 // 0 - enable, 1 -reset (needs resettimng DMA address in ETRAX also) - // / #define IMUCR__DBG_CONF__BITNM 18 // several extra IMU configuration bits + // / #define IMUCR__DBG_CONF__BITNM 21 ///< several axtra IMU configuration bits (was 18 for NC353) // / #define IMUCR__DBG_CONF__WIDTH 4 // 0 - config_long_sda_en, 1 -config_late_clk, 2 - config_single_wire, should be set for 103695 rev "A" - $logger_conf |= (($conf ['extra_conf'] & 0xf) | 0x10) << 18; + $logger_conf |= (($conf ['extra_conf'] & 0xf) | 0x10) << 21; // was 18 in NC353; // / next bits used by the driver only, not the FPGA // / ((SLOW_SPI & 1)<<23) | \ // / (DFLT_SLAVE_ADDR << 24)) - $logger_conf |= ($conf ['slow_spi'] & 0x1) << 23; - $logger_conf |= ($conf ['imu_sa'] & 0x7) << 24; + //#define IMUCR__SLOW_SPI__BITNM 26 ///< just for the driver, not written to FPGA (was 23 for NC353) + //#define IMUCR__SLOW_SPI__WIDTH 1 ///< 0 - normal, 1 - slow SPI (programmed over i2c) + $logger_conf |= ($conf ['slow_spi'] & 0x1) << 26; // was 23 for NC353 + // #define IMUCR__I2C_SA3__BITNM 28 ///< Low 3 bits of the SA7 of the PCA9500 slave address + // #define IMUCR__I2C_SA3__WIDTH 3 ///< Should match jumpers + $logger_conf |= ($conf ['imu_sa'] & 0x7) << 28; // was 24 for NC353 + $data [$index ++] = $logger_conf & 0xff; // DWORD 0x03 $data [$index ++] = ($logger_conf >> 8) & 0xff; $data [$index ++] = ($logger_conf >> 16) & 0xff;