nxp-mcuxpresso / mcux-sdk

MCUXpresso SDK
BSD 3-Clause "New" or "Revised" License
339 stars 148 forks source link

[BUG] CSI2-RX does not work after having deinitialized and initialized #213

Open trunghieulenxp opened 1 month ago

trunghieulenxp commented 1 month ago

Describe the bug

To Reproduce After having called function in fsl_mipi_csi2rx.c void CSI2RX_Deinit(MIPI_CSI2RX_Type *base) (https://github.com/nxp-mcuxpresso/mcux-sdk/blob/6958175a32bb12384e3635e28343c33daa3b2a42/drivers/mipi_csi2rx/fsl_mipi_csi2rx.c#L250)

and when we call again the function void CSI2RX_Init(MIPI_CSI2RX_Type *base, const csi2rx_config_t *config) (https://github.com/nxp-mcuxpresso/mcux-sdk/blob/6958175a32bb12384e3635e28343c33daa3b2a42/drivers/mipi_csi2rx/fsl_mipi_csi2rx.c#L220)

The module is halted completely. We have inspected the code, and we found that by removing: MIPI_CSI2RX_SoftwareReset(base, true) (https://github.com/nxp-mcuxpresso/mcux-sdk/blob/6958175a32bb12384e3635e28343c33daa3b2a42/drivers/mipi_csi2rx/fsl_mipi_csi2rx.c#L254)

We can deinit and init the module without problem. However, this is just a workaround.

trunghieulenxp commented 1 month ago

@zejiang0jason Can you take a look at this issue please ?

zejiang0jason commented 1 month ago

Hi @trunghieulenxp , thanks for report, can you access the SDK 2.16 package? I tried with the csi_mipi_rgb project, modify the code here https://github.com/nxp-mcuxpresso/mcux-sdk-examples/blob/fc18ff0c12ba90fe71714eaa4244717efa18c61c/evkbmimxrt1170/driver_examples/csi/mipi_rgb/cm7/camera_support.c#L242

to

    CSI2RX_Deinit(MIPI_CSI2RX);
    CSI2RX_Init(MIPI_CSI2RX, &csi2rxConfig);

but didn't reproduce.

trunghieulenxp commented 1 month ago

Hi Jason, thanks for your answer, this error only appeared on the second time you do which means you need to call: CSI2RX_Init(MIPI_CSI2RX, &csi2rxConfig) to start, and leave it work for at least one frame and then call: CSI2RX_Deinit(MIPI_CSI2RX); to stop the process.

After that you call again: CSI2RX_Init(MIPI_CSI2RX, &csi2rxConfig)