HD and SD Streams from AR0521 camera

Hi @rudhi.tx I’m not using torizon os but have installed the necessary on our custom image now so will let you know how resetting the pin goes.

Ty

Hi @rudhi.tx we’ve had another crash and I’ve tried the reset, but don’t think I know the magic :slight_smile:

here’s the ouput from gpioinfo

 gpioinfo
gpiochip0 - 32 lines:
        line   0: "SODIMM_206"       unused   input  active-high
        line   1: "SODIMM_208"       unused   input  active-high
        line   2:      unnamed       unused   input  active-high
        line   3:      unnamed  "interrupt"   input  active-high [used]
        line   4:      unnamed    "sd-vsel"  output  active-high [used]
        line   5: "SODIMM_210"       unused   input  active-high
        line   6: "SODIMM_212"       unused   input  active-high
        line   7: "SODIMM_216" "ar0521_mipi_reset" output active-high [used]
        line   8: "SODIMM_218" "ar0521_mipi_pwdn" output active-high [used]
        line   9:      unnamed       unused  output  active-high
        line  10:      unnamed  "interrupt"   input  active-high [used]
        line  11:  "SODIMM_16"       unused   input  active-high
        line  12: "SODIMM_155" "regulator-usb1-vbus" output active-high [used]
        line  13: "SODIMM_157"       unused   input  active-high
        line  14: "SODIMM_185" "regulator-usb2-vbus" output active-high [used]
        line  15:  "SODIMM_91"       unused   input  active-high
        line  16:      unnamed       unused   input  active-high
        line  17:      unnamed       unused   input  active-high
        line  18:      unnamed       unused   input  active-high
        line  19:      unnamed       unused   input  active-high
        line  20:      unnamed       unused   input  active-high
        line  21:      unnamed       unused   input  active-high
        line  22:      unnamed       unused   input  active-high
        line  23:      unnamed       unused   input  active-high
        line  24:      unnamed       unused   input  active-high
        line  25:      unnamed       unused   input  active-high
        line  26:      unnamed       unused   input  active-high
        line  27:      unnamed       unused   input  active-high
        line  28:      unnamed       unused   input  active-high
        line  29:      unnamed       unused   input  active-high
        line  30:      unnamed       unused   input  active-high

When I perform commands like this

gpioset gpiochip0 7=0

I just get “device busy” presumably because I can’t actually unload that built in kernel module?

Hello @alan01252,

I thought you were using Torizon because you tagged “torizon” on the topic. Anyway, if you are using a Yocto built image based on the meta layers for the reference image BSP 6 from Toradex, you should already have the libgpiod library in it.

Do you see only the gpiochip0 lines when you run gpioinfo?

Also, could you try to set the ar0521_mipi_pwdn to 0? ie, gpioset 0 8=0

Whoops sorry about the Torizon tag @rudhi.tx , I’ll blame my lack of familiarity with the ecosystem when creating this thread for that one…

Unfortunately I get the same thing there too.

gpioset 0 8=0
gpioset: error setting the GPIO line values: Device or resource busy

I also tried removing the galcore and imx8_media_dev and killing anything that was using /dev/video but nothing seemed to work :frowning:

Module                  Size  Used by
imx8_media_dev         24576  0
galcore               393216  2

For completeness here’s the full gpioinfo

gpiochip0 - 32 lines:
        line   0: "SODIMM_206"       unused   input  active-high
        line   1: "SODIMM_208"       unused   input  active-high
        line   2:      unnamed       unused   input  active-high
        line   3:      unnamed  "interrupt"   input  active-high [used]
        line   4:      unnamed    "sd-vsel"  output  active-high [used]
        line   5: "SODIMM_210"       unused   input  active-high
        line   6: "SODIMM_212"       unused   input  active-high
        line   7: "SODIMM_216" "ar0521_mipi_reset" output active-high [used]
        line   8: "SODIMM_218" "ar0521_mipi_pwdn" output active-high [used]
        line   9:      unnamed       unused  output  active-high
        line  10:      unnamed  "interrupt"   input  active-high [used]
        line  11:  "SODIMM_16"       unused   input  active-high
        line  12: "SODIMM_155" "regulator-usb1-vbus" output active-high [used]
        line  13: "SODIMM_157"       unused   input  active-high
        line  14: "SODIMM_185" "regulator-usb2-vbus" output active-high [used]
        line  15:  "SODIMM_91"       unused   input  active-high
        line  16:      unnamed       unused   input  active-high
        line  17:      unnamed       unused   input  active-high
        line  18:      unnamed       unused   input  active-high
        line  19:      unnamed       unused   input  active-high
        line  20:      unnamed       unused   input  active-high
        line  21:      unnamed       unused   input  active-high
        line  22:      unnamed       unused   input  active-high
        line  23:      unnamed       unused   input  active-high
        line  24:      unnamed       unused   input  active-high
        line  25:      unnamed       unused   input  active-high
        line  26:      unnamed       unused   input  active-high
        line  27:      unnamed       unused   input  active-high
        line  28:      unnamed       unused   input  active-high
        line  29:      unnamed       unused   input  active-high
        line  30:      unnamed       unused   input  active-high
        line  31:      unnamed       unused   input  active-high
gpiochip1 - 32 lines:
        line   0:      unnamed       unused   input  active-high
        line   1:      unnamed       unused   input  active-high
        line   2:      unnamed       unused   input  active-high
        line   3:      unnamed       unused   input  active-high
        line   4:      unnamed       unused   input  active-high
        line   5:      unnamed       unused   input  active-high
        line   6: "SODIMM_143"       unused   input  active-high
        line   7: "SODIMM_141"       unused   input  active-high
        line   8:      unnamed       unused   input  active-high
        line   9:      unnamed       unused   input  active-high
        line  10: "SODIMM_161"         "id"   input  active-high [used]
        line  11:      unnamed "regulator-wifi-en" output active-high [used]
        line  12:  "SODIMM_84"         "cd"   input   active-low [used]
        line  13:  "SODIMM_78"       unused   input  active-high
        line  14:  "SODIMM_74"       unused   input  active-high
        line  15:  "SODIMM_80"       unused   input  active-high
        line  16:  "SODIMM_82"       unused   input  active-high
        line  17:  "SODIMM_70"       unused   input  active-high
        line  18:  "SODIMM_72"       unused   input  active-high
        line  19:      unnamed       unused   input  active-high
        line  20:      unnamed "regulator-module-eth1phy" output active-high [used]
        line  21:      unnamed       unused   input  active-high
        line  22:      unnamed       unused   input  active-high
        line  23:      unnamed       unused   input  active-high
        line  24:      unnamed       unused   input  active-high
        line  25:      unnamed       unused   input  active-high
        line  26:      unnamed       unused   input  active-high
        line  27:      unnamed       unused   input  active-high
        line  28:      unnamed       unused   input  active-high
        line  29:      unnamed       unused   input  active-high
        line  30:      unnamed       unused   input  active-high
        line  31:      unnamed       unused   input  active-high
gpiochip2 - 32 lines:
        line   0:  "SODIMM_52" "red:debug-1" output active-high [used]
        line   1:  "SODIMM_54" "green:debug-1" output active-high [used]
        line   2:      unnamed       unused   input  active-high
        line   3:      unnamed       unused   input  active-high
        line   4:      unnamed       unused   input  active-high
        line   5:      unnamed       unused   input  active-high
        line   6:  "SODIMM_56" "blue:debug-1" output active-high [used]
        line   7:  "SODIMM_58" "red:debug-2" output active-high [used]
        line   8:  "SODIMM_60" "green:debug-2" output active-high [used]
        line   9:  "SODIMM_62" "blue:debug-2" output active-high [used]
        line  10:      unnamed       unused   input  active-high
        line  11:      unnamed       unused   input  active-high
        line  12:      unnamed       unused   input  active-high
        line  13:      unnamed       unused   input  active-high
        line  14:  "SODIMM_66"       unused   input  active-high
        line  15:      unnamed       unused   input  active-high
        line  16:  "SODIMM_64"       unused   input  active-high
        line  17:      unnamed       unused   input  active-high
        line  18:      unnamed       unused   input  active-high
        line  19:  "SODIMM_34"       unused   input  active-high
        line  20:  "SODIMM_19"       unused   input  active-high
        line  21:      unnamed       unused   input  active-high
        line  22:  "SODIMM_32"       unused   input  active-high
        line  23:      unnamed       unused   input  active-high
        line  24:      unnamed       unused   input  active-high
        line  25:  "SODIMM_30"       unused   input  active-high
        line  26:  "SODIMM_59"       unused   input  active-high
        line  27:  "SODIMM_57"       unused   input  active-high
        line  28:  "SODIMM_63"       unused   input  active-high
        line  29:  "SODIMM_61"       unused   input  active-high
        line  30:      unnamed       unused   input  active-high
        line  31:      unnamed       unused   input  active-high
gpiochip3 - 32 lines:
        line   0: "SODIMM_252"    "Wake-Up"   input   active-low [used]
        line   1: "SODIMM_222"       unused   input  active-high
        line   2:  "SODIMM_36"       unused   input  active-high
        line   3: "SODIMM_220"       unused   input  active-high
        line   4: "SODIMM_193"       unused   input  active-high
        line   5: "SODIMM_191"       unused   input  active-high
        line   6: "SODIMM_201"       unused   input  active-high
        line   7: "SODIMM_203"       unused   input  active-high
        line   8: "SODIMM_205"       unused   input  active-high
        line   9: "SODIMM_207"       unused   input  active-high
        line  10: "SODIMM_199"       unused   input  active-high
        line  11: "SODIMM_197"       unused   input  active-high
        line  12: "SODIMM_221"       unused   input  active-high
        line  13: "SODIMM_219"       unused   input  active-high
        line  14: "SODIMM_217"       unused   input  active-high
        line  15: "SODIMM_215"       unused   input  active-high
        line  16: "SODIMM_211"       unused   input  active-high
        line  17: "SODIMM_213"       unused   input  active-high
        line  18: "SODIMM_189"       unused   input  active-high
        line  19: "SODIMM_244"       unused  output  active-high
        line  20:  "SODIMM_38"       unused   input  active-high
        line  21:      unnamed       unused   input  active-high
        line  22:  "SODIMM_76" "regulator-usdhc2" output active-high [used]
        line  23: "SODIMM_135"       unused   input  active-high
        line  24: "SODIMM_133"       unused   input  active-high
        line  25:  "SODIMM_17"       unused   input  active-high
        line  26:  "SODIMM_24"       unused   input  active-high
        line  27:  "SODIMM_26"       unused   input  active-high
        line  28:  "SODIMM_21"       unused   input  active-high
        line  29: "SODIMM_256" "CTRL_SLEEP_MOCI#" output active-high [used]
        line  30:  "SODIMM_48"       unused   input  active-high
        line  31:  "SODIMM_44"       unused   input  active-high
gpiochip4 - 32 lines:
        line   0:  "SODIMM_42"       unused   input  active-high
        line   1:  "SODIMM_46"       unused   input  active-high
        line   2: "SODIMM_187"       unused   input  active-high
        line   3:  "SODIMM_20"       unused   input  active-high
        line   4:  "SODIMM_22"       unused   input  active-high
        line   5:  "SODIMM_15"       unused   input  active-high
        line   6: "SODIMM_196"       unused   input  active-high
        line   7: "SODIMM_200"       unused   input  active-high
        line   8: "SODIMM_198"       unused   input  active-high
        line   9: "SODIMM_202"       unused   input  active-high
        line  10:      unnamed       unused   input  active-high
        line  11:      unnamed       unused   input  active-high
        line  12:      unnamed       unused   input  active-high
        line  13:      unnamed       unused   input  active-high
        line  14:      unnamed        "scl"  output  active-high [used open-drain]
        line  15:      unnamed        "sda"   input  active-high [used open-drain]
        line  16:  "SODIMM_55"        "scl"  output  active-high [used open-drain]
        line  17:  "SODIMM_53"        "sda"   input  active-high [used open-drain]
        line  18:  "SODIMM_95"        "scl"  output  active-high [used open-drain]
        line  19:  "SODIMM_93"        "sda"   input  active-high [used open-drain]
        line  20:  "SODIMM_14"        "scl"  output  active-high [used open-drain]
        line  21:  "SODIMM_12"        "sda"   input  active-high [used open-drain]
        line  22: "SODIMM_129"       unused   input  active-high
        line  23: "SODIMM_131"       unused   input  active-high
        line  24: "SODIMM_137"       unused   input  active-high
        line  25: "SODIMM_139"       unused   input  active-high
        line  26: "SODIMM_147"       unused   input  active-high
        line  27: "SODIMM_149"       unused   input  active-high
        line  28: "SODIMM_151"       unused   input  active-high
        line  29: "SODIMM_153"       unused   input  active-high
        line  30:      unnamed       unused   input  active-high
        line  31:      unnamed       unused   input  active-high

Thanks again for all your help on this!

Hello @alan01252,

I want to confirm that we were able to reproduce the camera freeze in our testing.

Also, upon further investigation, the driver requires ownership of the reset and power down GPIOs to function.
Therefore, removing those GPIOs from the ar0521 device tree node is not possible and this makes it impossible to toggle these GPIOs outside of the driver.

Another detail which we initially missed when thinking about this workaround is that the ar0521 driver is built-in to the kernel, and does not work if built as an external module.
This means that we have no way to unload this driver at runtime.

I will raise this internally so we solve this problem.
Just to confirm, do you plan to use the AR0521 camera module in your product?

Best Regards,
Bruno

Really appreciate this Bruno. I am actually having my longest run right now ever at 2024-07-07 08:46 UTC start time without a hang…

Do you have any idea what the cause might be at the moment.

Just to confirm, do you plan to use the AR0521 camera module in your product?

I guess the answer to this is whether we think this crashing is specific to this hardware/driver combination…

We are looking at other sensors but these don’t have the “out of the box” support that this one should have and we’re likely going to require external consultancy firm to write the drivers to support it.

Hello @alan01252,

Unfortunately no specific cause is clear at the moment.
It may be related to the camera module’s firmware or the driver.
What I can say is that I had conducted tests with this camera driver for several days with previous versions of the Toradex BSP in the past without issues, so it may also be related to a change done to the BSP.


Noted, we will conduct additional tests and look into what may be the problem here.
There is some work being done to support more camera modules on the Verdin iMX8MP, so there may be alternatives very soon.
What are your requirements in terms of the image resolution and focus?

Best Regards,
Bruno