-
Notifications
You must be signed in to change notification settings - Fork 13.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
px4fmu-v2 sensor reset #9031
px4fmu-v2 sensor reset #9031
Conversation
To be clear, there are still situations where we won't get the explicit full sensor reset (eg hardfault), but at this point I believe it's a choice between this PR supporting the majority of boards in most usage, or the more thorough sensor power reset on init that causes an unknown (but seemingly large) number of pixhawks to reset due to a hardware issue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dagar seems like a reasonable alternative. The concern I have is the reduced reliability on V2 compliant HW.
@LorenzMeier @dagar
For me working fix is: d36cd84 |
Could you send a PR with the fix? @dagar Do you have the setup to test all? |
@LorenzMeier I've created pull request with this fix a month ago: #8703 |
@svpcom I don't think that fix is correct. The core problem is what's causing the lsm303d to fail startup. Forcing the version is a workaround. To summarize, we know what the correct fix is, but it's going to cripple those fmu-v2 units with the incorrect resistor. We're trying to find an acceptable workaround that doesn't brick previously "working" boards. |
@dagar Core problem is that SPI init code doesn't init board with unknown HW version. static void stm32_spi1_initialize(void)
{
stm32_configgpio(GPIO_SPI1_CS_PC2);
stm32_configgpio(GPIO_SPI1_CS_PD7);
stm32_configgpio(GPIO_SPI1_EXTI_DRDY_PD15);
# if !defined(BOARD_HAS_VERSIONING)
stm32_configgpio(GPIO_SPI1_EXTI_DRDY_PB0);
stm32_configgpio(GPIO_SPI1_EXTI_DRDY_PB1);
stm32_configgpio(GPIO_SPI1_EXTI_DRDY_PB4);
stm32_configgpio(GPIO_SPI1_CS_PC13);
stm32_configgpio(GPIO_SPI1_CS_PC15);
# else
if (HW_VER_FMUV2 == board_get_hw_version()) {
stm32_configgpio(GPIO_SPI1_EXTI_DRDY_PB0);
stm32_configgpio(GPIO_SPI1_EXTI_DRDY_PB1);
stm32_configgpio(GPIO_SPI1_EXTI_DRDY_PB4);
stm32_configgpio(GPIO_SPI1_CS_PC13);
stm32_configgpio(GPIO_SPI1_CS_PC15);
} else if (HW_VER_FMUV2MINI == board_get_hw_version()) {
stm32_configgpio(GPIO_SPI1_EXTI_20608_DRDY_PC14);
stm32_configgpio(GPIO_SPI1_CS_PC15);
} else if (HW_VER_FMUV3 == board_get_hw_version()) {
stm32_configgpio(GPIO_SPI1_CS_PC1);
}
# endif
} |
Ok, that makes sense. The part I want to make sure we get right is the actual version detection. It's a bit convoluted. |
The bit in question is PB4. On FMUv2 is is connected to ACCEL_DRDY LSM303D. On the Cube and Mini it is a No connect. If it is a no connect, we would expect it to read back a 0 when pulled low and a 1 when pulled high. On the board in question it is driven to a 1. This may be a result of not powering up the sensors cleanly*. More specifically, the power is not shut off to the sensors (in stm32_boardinitialize the GPIO init is enabling the Sensor Vdd 3.3). I think it would be fine to add teh 0xB code point as has been done by @svpcom in #8703 *I still think it is not a good idea to not reset the sensors cleanly. |
I'll test and merge #8703. I'll do a more exhaustive test of all the fmu-v2/v3 variants early next week when I'm home. |
@dagar - Thank you. Once the testing is done please report back. |
This isn't the ideal solution, but for the majority of cases (good boards and bad) it will bring all sensors back (hard reset and reboot commanded).
Tested on several different pixhawks (3dr, hobbyking, etc).
@svpcom could you try this?