Open ryancwicks-voyis opened 6 months ago
Reopening, initial fix was incorrect.
Fix was two fold:
1) You have to call MipNodeFeatures::supportedGpioConfigurations() before the unit will accept the setGpioConfig command. 2) The unit was returning a MipCmdFailed - Bad Parameter error, which was due to the PPS_Input feature not supporting the pinMode PULLDOWN behaviour. Commenting out the pinMode setting in the above solved it. The working code now looks like:
// Set the current time
int64_t current_secs;
int32_t week_num, seconds_week, current_ns;
utils::getSystemTime(current_secs, current_ns);
utils::getGPSTime(current_secs, week_num, seconds_week);
p_imu_node->setGPSTimeUpdate(mscl::MipTypes::TIME_FRAME_WEEKS, week_num);
p_imu_node->setGPSTimeUpdate(mscl::MipTypes::TIME_FRAME_SECONDS, seconds_week);
// Set the PPS source
p_imu_node->setPpsSource(mscl::InertialTypes::PPS_GPIO);
// Left for future diagnostics, needs to be called to set the configuration
auto gpio_configurations = p_imu_node->features().supportedGpioConfigurations();
// Set the GPIO correctly for PPS input
mscl::GpioConfiguration gpio_config;
gpio_config.pin = 1; // pin 7 on the connector.
gpio_config.feature = mscl::GpioConfiguration::Feature::PPS_FEATURE;
gpio_config.behavior = mscl::GpioConfiguration::PpsBehavior::PPS_INPUT;
p_imu_node->setGpioConfig(gpio_config);
Leaving this open for a MSCL developer to comment on the requirement of calling the supportedGpioConfigurations command before setting the GpioConfig. Is this expected behaviour, and if so does the documentation need updating.
I'm using the mscl c++ library, version 65.0.0 for arm64, running on a Jetson Xavier NX and connected over ttl level serial with a 3DMCV7-AHRS. So far, I've found the library well set up and reasonably easy to use and have been able to successfully capture raw accelerometer, gyro and mag data at 100Hz with system level timestamping.
My issue is that I'm trying to set up PPS input on GPIO 1 (pin 7 on the connector). I've been able to set the time. I have not been able to set up the GPIO to act as a PPS input: I get seg faults when sending the GPIO config to the scanner.
Below is my code. The very last line is seg faulting when I leave it uncommented.