-
Notifications
You must be signed in to change notification settings - Fork 8.1k
sensor: icm45686: Change watermark threshold irq to equals #96246
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
base: main
Are you sure you want to change the base?
sensor: icm45686: Change watermark threshold irq to equals #96246
Conversation
This change would mute warnings thrown due to system latency on servicing the FIFO Watermark events, wouldn't it? |
Could you explain a bit more? From what I see, the rtio submission occurs in gpio interrupt context so it is always serviced. |
Right - so there's no good reason to have the Workqueue used for every submission. I have this in-flight PR which removes it from the sensor driver. In this case, subsequent FIFO_WM triggers are ignored at the handler level although logged as LOG_WRN. Would you mind looking over? Perhaps it will address your needs: #94832 |
You still do since
I see you've added disabling interrupts in icm45686_event_handler but to me that is a software fix for improperly configured hardware. From what I understand, once triggered by hardware, a vectored interrupt, even when preempted by higher priority interrupts, will always be serviced by the system eventually so |
The sensor_submit_fallback only kicks-in if the sensor driver doesn't implement the zephyr/drivers/sensor/default_rtio_sensor.c Lines 32 to 38 in d494f86
Take a look at: |
I see this is implemented by the icm45686 as For this implementation, it will go to zephyr/include/zephyr/drivers/spi.h Lines 1272 to 1279 in d494f86
From there, the vendor implementation. In most cases, the default implementation is used, #ifdef CONFIG_SPI_RTIO
.iodev_submit = spi_rtio_iodev_default_submit,
#endif which ends up at the rtio_workq Lines 137 to 153 in d494f86
It looks like that warning might exist to suppress the extra interrupts from watermark because the default configuration is set greater than or equals rather than just equals. I would say the warning should stay as a sanity check but the configuration should still be updated to only generate one interrupt per watermark. Other TDK IMU's which have the same interrupt behavior have watermark interrupt only once per threshold crossing so it is not an unusual request. In the case of icm42688 wm_gt_th is disabled, and interrupts are not disabled in gpio callback because it is not needed. zephyr/drivers/sensor/tdk/icm4268x/icm4268x_common.c Lines 315 to 325 in 216fc8f
zephyr/drivers/sensor/tdk/icm4268x/icm4268x_trigger.c Lines 21 to 37 in 216fc8f
on older drivers, such as icm42605, wm_gt_th is misconfigured as enabled and to suppress spurious interrupts, gpio interrupts are disabled in gpio callback.
|
Closed because this change will conflict fundamentally with #94832 interrupt handling |
I am revisiting this with the latest changes from #94832 and #97564 During periods of system latency am getting console log messages of spurious interrupts being triggered (and ignored) from the watermark >= threshold with high data rates.
With the current main branch driver, the IMU is being reset on init to a known state, interrupts are being enabled on stream enable, and only disabled on stream result error or callback trigger without stream submission. |
135e294
to
32ec119
Compare
32ec119
to
814d329
Compare
814d329
to
86320bf
Compare
Move the watermark threshold trigger mode to a configurable dt boolean. When using the default configuration of watermark threshold interrupt greater than or equals, extra interrupts are serviced to icm45686_event_handler(). When `fifo-watermark-equals;` is added to the sensor DT overlay, the new behavior is only one interrupt is generated per watermark threshold crossing. Until the host drains the fifo, no extra interrupts will be generated. Signed-off-by: Anthony Williams <[email protected]>
86320bf
to
fd64cac
Compare
|
When using the default configuration of watermark threshold interrupt greater than or equals, extra interrupts are serviced to icm45686_event_handler(). The expected behavior should be only one interrupt is generated per watermark threshold crossing, and until the host drains the fifo, no extra interrupts should be generated.
IMU dt fragment used,
This is the observed current behavior of the interrupt pin with the default setting, per datasheet.
This is the proposed expected behavior of the interrupt pin with the new setting, per datasheet.