Hello All,
We have a MIPI CSI Camera OV5640 and Ixora and Apalis Imx8!!
I’m looking into checking the state of the Imx8 MIPI CSI Registers when I run gstreamer pipeline at userspace:
Is there a standard command(s) to find out MIPI CSI status register?
I want to check MIPI status register at runtime userpace, such as:
a. ECC and CRC Error Status Register
b. IRQ Status Register
c. ErrSot HS Status Register
d. ErrSotSync HS Status Register
e. ErrEsc Status Register
f. ErrSyncEsc Status Register
g. ErrControl Status Register
Can you please guide me?
Thank you in advance.
Hi @hhami_2040!
memtool is a tool for reading and writing registers in user space, similar to linux devmem. You can find discussion and usage on this topic in the community.
Hope this information is helpful to you.
Hello @Chavira
Thank you for your answer.
I cant find some example for that ,right i dont have their physical register addrese !!
Can you guide me, if i want to write CSI block Register Status in the driver ,where can i do that??
in the /kernel-source/drivers/staging/media/imx/imx8-mipi-csi2.c/imx8-mipi-csi2.c( mxc_mipi_csi2_reg_dump(csi2dev) )
static void mxc_mipi_csi2_reg_dump(struct mxc_mipi_csi2_dev *csi2dev) { struct device *dev = &csi2dev->pdev->dev; struct { u32 offset; const char name[32]; } registers[] = { { 0x100, "MIPI CSI2 HC num of lanes" }, { 0x104, "MIPI CSI2 HC dis lanes" }, { 0x108, "MIPI CSI2 HC BIT ERR" }, { 0x10C, "MIPI CSI2 HC IRQ STATUS" }, { 0x110, "MIPI CSI2 HC IRQ MASK" }, { 0x114, "MIPI CSI2 HC ULPS STATUS" }, { 0x118, "MIPI CSI2 HC DPHY ErrSotHS" }, { 0x11c, "MIPI CSI2 HC DPHY ErrSotSync" }, { 0x120, "MIPI CSI2 HC DPHY ErrEsc" }, { 0x124, "MIPI CSI2 HC DPHY ErrSyncEsc" }, { 0x128, "MIPI CSI2 HC DPHY ErrControl" }, { 0x12C, "MIPI CSI2 HC DISABLE_PAYLOAD" }, { 0x130, "MIPI CSI2 HC DISABLE_PAYLOAD" }, { 0x180, "MIPI CSI2 HC IGNORE_VC" }, { 0x184, "MIPI CSI2 HC VID_VC" }, { 0x188, "MIPI CSI2 HC FIFO_SEND_LEVEL" }, { 0x18C, "MIPI CSI2 HC VID_VSYNC" }, { 0x190, "MIPI CSI2 HC VID_SYNC_FP" }, { 0x194, "MIPI CSI2 HC VID_HSYNC" }, { 0x198, "MIPI CSI2 HC VID_HSYNC_BP" }, { 0x000, "MIPI CSI2 CSR PLM_CTRL" }, { 0x004, "MIPI CSI2 CSR PHY_CTRL" }, { 0x008, "MIPI CSI2 CSR PHY_Status" }, { 0x010, "MIPI CSI2 CSR PHY_Test_Status" }, { 0x014, "MIPI CSI2 CSR PHY_Test_Status" }, { 0x018, "MIPI CSI2 CSR PHY_Test_Status" }, { 0x01C, "MIPI CSI2 CSR PHY_Test_Status" }, { 0x020, "MIPI CSI2 CSR PHY_Test_Status" }, { 0x030, "MIPI CSI2 CSR VC Interlaced" }, { 0x038, "MIPI CSI2 CSR Data Type Dis" }, { 0x040, "MIPI CSI2 CSR 420 1st type" }, { 0x044, "MIPI CSI2 CSR Ctr_Ck_Rst_Ctr" }, { 0x048, "MIPI CSI2 CSR Stream Fencing" }, { 0x04C, "MIPI CSI2 CSR Stream Fencing" }, }; u32 i; pr_info("mxc_mipi_csi2_reg_dump\n"); dev_dbg(dev, "MIPI CSI2 CSR and HC register dump, mipi csi%d\n", csi2dev->id); for (i = 0; i < ARRAY_SIZE(registers); i++) { u32 reg = readl(csi2dev->base_regs + registers[i].offset); dev_dbg(dev, "%20s[0x%.3x]: 0x%.3x\n", registers[i].name, registers[i].offset, reg); } }
I found a function to debug register status , but it just shows the status when the start( mxc_mipi_csi2_reg_dump(csi2dev) ) !!
static int mipi_csi2_s_stream(struct v4l2_subdev *sd, int enable) { struct mxc_mipi_csi2_dev *csi2dev = sd_to_mxc_mipi_csi2_dev(sd); struct device *dev = &csi2dev->pdev->dev; int ret = 0; dev_dbg(&csi2dev->pdev->dev, "%s: %d, csi2dev: 0x%x\n", __func__, enable, csi2dev->flags); if (enable) { pm_runtime_get_sync(dev); if (!csi2dev->running++) { pr_info("mipi_csi2_s_stream__pm_runtime_get_sync\n"); mxc_csi2_get_sensor_fmt(csi2dev); mxc_mipi_csi2_hc_config(csi2dev); mxc_mipi_csi2_reset(csi2dev); mxc_mipi_csi2_csr_config(csi2dev); mxc_mipi_csi2_enable(csi2dev); mxc_mipi_csi2_reg_dump(csi2dev); } } else { if (!--csi2dev->running) mxc_mipi_csi2_disable(csi2dev); pm_runtime_put(dev); } return ret; }
If i want to debug CSI register status at kernel mode as dynamic no just when the start ,where can i do that??
Thank you in advance.
Hi @hhami_2040!
You have to identify the registers that you want to read on the reference manual of your processor, after that you have to use the memtool with the next command:
To read:
./memtool [-8 | -16 | -32] <phys addr> <count>
To write:
./memtool [-8 | -16 | -32] <phys addr>=<value>
Note:
[-8,-16,-32] -> is the size of the register you can consult the size of the register in the reference manual.
<phys addr> -> the address of the register that you want to write/read
<count> -> the spaces that you want to read
<value> -> the value to write in the register
https://community.nxp.com/t5/i-MX-Processors/memtool-support-for-i-MX8MM/m-p/1677999
Hello @Chavira
Thank your for your answer.
I have an error at IRQ Status Register (CSI2RX_IRQ_STATUS) when log them.
Based IMX8 TRM document,
0x10C, IRQ Status Register (CSI2RX_IRQ_STATUS) and based CSI Register Debug we have 0x28 value
that fifth bit is equal bellow error(DPHY ErrSotSync_HS has occurred):
What does mean that??Can you guide me??
Thank you in advance.