Skip to content

Conversation

@not-na
Copy link
Contributor

@not-na not-na commented Dec 16, 2025

Currently, the DCMIPP driver for the STM32N6 only implements the DCMIPP's own IRQ. However, the CSI part of the DCMIPP has its own IRQ, which may be useful in some applications.

This PR adds the CSI IRQ to the STM32N6 devicetree and routes it to the ST HAL, just like the main DCMIPP ISR. Applications and libraries can then implement the various HAL_DCMIPP_CSI_*Callback weak methods they are interested in.

To demonstrate this, simply add something like below to the drivers/video/capture sample to log every CSI SOF:

diff --git a/samples/drivers/video/capture/src/main.c b/samples/drivers/video/capture/src/main.c
index f1b54aae110..bf5d86fc4c4 100644
--- a/samples/drivers/video/capture/src/main.c
+++ b/samples/drivers/video/capture/src/main.c
@@ -19,6 +19,11 @@ LOG_MODULE_REGISTER(main, CONFIG_LOG_DEFAULT_LEVEL);
 #error No camera chosen in devicetree. Missing "--shield" or "--snippet video-sw-generator" flag?
 #endif
 
+void HAL_DCMIPP_CSI_StartOfFrameEventCallback(DCMIPP_HandleTypeDef *hdcmipp, uint32_t VirtualChannel)
+{
+       LOG_INF("DCMIPP CSI IRQ!");
+}
+
 static inline int app_setup_display(const struct device *const display_dev, const uint32_t pixfmt)
 {
        struct display_capabilities capabilities;

As far as I can tell, only the N6 has the DCMIPP with CSI, so I only added the new IRQ to this SoC.

Please let me know if anything should be changed or more specific APIs for the various CSI events and errors are wanted.

@avolmat-st
Copy link

Hi @not-na,

thanks for this patch. Could you give us some example why you need to get notifications of the CSI events ?
I tend to go check them usually when there are issues with the sensor, phy configuration and want to see if there are activty at the CSI level but apart of that I haven't used it much so far.

Copy link
Contributor

@etienne-lms etienne-lms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you refine the commit message?

 soc: st: stm32n6: add DCMIPP CSI IRQ
 
-The STM32N6 devicetree is missing the CSI IRQ of the DCMIPP. Add it and pass it through to the ST HAL.
+Add DCMIPP CSI IRQ support for STM32N6.
 
 Signed-off-by: Anton Puppe <[email protected]>
-on-behalf-of: @ZEISS [email protected]

<&rcc STM32_SRC_IC17 DCMIPP_SEL(2)>,
<&rcc STM32_CLOCK(APB5, 6)>;
interrupts = <48 0>;
interrupts = <48 0>, <47 0>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If several interrupts are used, prefer using interrupt-names property to identify them.
(and use DT_DRV_IRQ_BY_NAME() in STM32_DCMIPP_INIT() and STM32_DCMIPP_CSI_IRQ_INIT())

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not know about interrupt-names, it seems useful here. If I change the main DCMIPP IRQ to e.g. DT_INST_IRQN_BY_NAME(inst, dcmipp), I also have to add interrupt-names to all other DTs using the DCMIPP driver, right? So that would be the STM32MP135.

Alternatively, I would just leave the main IRQ unchanged, basically assuming it's always the first. From what I can tell, the STM32 LTDC driver seems to do it like that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If interrupt-names is used - and it should be used here - then it must be used for all interrupts.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, including in stm32mp13.dtsi. interrupt-names property should be required in st,stm32-dcmipp.yaml.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. I've added interrupt-names to stm32mp135.dtsi and made it mandatory in st,stm32-dcmipp.yaml.

@not-na
Copy link
Contributor Author

not-na commented Dec 17, 2025

Hi @not-na,

thanks for this patch. Could you give us some example why you need to get notifications of the CSI events ? I tend to go check them usually when there are issues with the sensor, phy configuration and want to see if there are activty at the CSI level but apart of that I haven't used it much so far.

@avolmat-st Getting notifications of CSI events allows more precise timing alignment to the sensor scan itself. This can be useful if you want to synchronize e.g. a flash to the camera. It could also be done based on the DCMIPP IRQ, but that has more jitter and depends on memory access speeds etc. Given that the CSI IRQ is easy enough to use, it seems like the logical choice for such tasks.

Of course, you would not need this if you have access to the XVS etc. signals of the sensor, but some boards don't have that (e.g. the STM32N6570-DK does not give access to the XVS output of the camera). This would still be useful for all the other events and errors without having to poll for them though.

@not-na not-na force-pushed the feature/st-dcmipp-csi-isr branch from e88b17a to ac172cd Compare December 17, 2025 08:57
@not-na not-na requested a review from etienne-lms December 17, 2025 09:02
Add DCMIPP CSI IRQ support for STM32N6.

Signed-off-by: Anton Puppe <[email protected]>
on-behalf-of: @ZEISS [email protected]
@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants