Example using camera with XIP kernel 4.9


Is there any example available of a working device-tree using a camera (any OVxxxx) for the 4.9 kernel in XIP with single QSPI ?

Best regards

  • Here's the status on camera interfacing (for RZ/A Linux that is).
    * There is a old V4L2 CEU driver in the kernel, but it's got some issues and more work that it's worth
    * There is some work going on in the upstream team to make a new V4L2 CEU driver, but it's not clear when that will get done
    * I created a very simple example at one point that basically sets up all the CEU and OV7670 registers from a user app (not a kernel driver). Basically, no V4L2 (just read camera frames to a buffer so you can pass them to OpenCV, libJPEG, the LCD, or whatever you want).

    Since #1 and #2 are not great options for right now, I was going to clean up #3 and post it. It was done with Linxu-3.14, but as I mentioned, it's all contained in a user app, so there isn't really and "porting" except add the pin mux setup in the Device Tree.

    So the question is, do you want the current ugly version now? Or wait till it's cleaned up and posted? (probably December time frame)

    NOTE: On the RZ/A1 RSK board, you can't use the LCD and CEU camera at the same time (pin conflict). So you have to save JPEGs to a file on a SD card/USB stick, or stream them via Ethernet/HTTP.

  • Thanks for your reply Chris.
    I'll receive my hardware in early december (board based on RZ/A1L, single QSPI, OV6211) and my aim is to ensure our hardware can get frame from OV6211. I'm afraid I'll run out of time if I wait for the new driver.
    Actually I wanted to use 4.9 kernel to play around but if there is a better solution with the 3.14 I don't mind using it again :)
    As long as it works every solution suit me well !
  • >Actually I wanted to use 4.9 kernel to play around but if there is a better solution with the 3.14 I don't mind using it again :)

    The 4.9 BSP is going to be easier than 3.14, especially for a custom board. There are scripts now that will help you generate and customize the files (and device tree) for u-boot and kernel with the 4.9 BSP for your board. Basically you fill out a GUI with what's on your board, and 1/2 work will be done for you automatically. We have no plan to go back and add that for the 3.14 BSP.

    As for that #3 simple CEU camera driver, when i go back and clean it up, it will go into the 4.9 BSP, not the 3.14 BSP. I'll make a note to have a look at it and see if it's in a state that I can share it next week (it's been a while since i've built and ran it).

    NOTE: I just had a look at the OV6211 data sheet. It looks like it only outputs MIPI. The RZ/A1L doesn't support MIPI, only parallel.
  • Well then I will finally play with the 4.9 kernel :)
    > It looks like it only outputs MIPI. The RZ/A1L doesn't support MIPI, only parallel.
    Yes, we're aware of this issue, a FPGA will convert MIPI to parallel and I'll check if it's work.

    Thanks for the incoming release of your work !
  • Ahh, FPGA to the rescue!
  • When it comes to video, FPGA is sometimes the only solution :)
  • , did you find some time to cleanup your app ? I would like to give it a try.

  • Not yet.
    The reason was that with the RZ/A1H RSK board, you can't use the LCD and camera at the same time. Also, with the RZ/A1L Stream-it board, you can't use the SDRAM and camera at the same time.
    However, a new version of the Stream it board is coming out that with a resistor change, you can use SDRAM, LCD and camera at the same time. So, that was what I was going to base my example code on.
  • Just FYI, I cleaned up that camera code and added it to the 4.9 BSP.

    I used a new Stream it V2.3 board that can be easily modified to support the CEU interface and Linux at the same time.

    The code supports both OV7670 and OV7740 cameras which came with the Stream It kit.

    The app code is pretty generic, and should work with any board (but you have to set up the CEU pins yourself)
  • Thanks a lot Chris ! I'll give it a try. Currently I'm using the ongoing upstream CEU driver and a 4.15 kernel it works so far with an OV7670 (I'm still working on OV6211)
  • I've been meaning to try that new CEU driver and backport it to 4.14 (our next BSP kernel version). I wasn't sure if it would back port easily to 4.9, so I just put up the sample code that sets the registers from user space.

    Out of curiosity, is everything you need (RZ/A1 drivers) in the 4.15 upstream release?
  • TBH I tried to backport it to the 4.9 kernel but I gave up a few hours after that, lot of things changed and it make the backport too heavy (for me). But I guess it will be much more easier to backport it to the 4.14 kernel.
    Regarding the 4.15 kernel I only had to add and patch AXFS to the kernel. I don't think I had to modify something else (except devicetree) Maybe I reused some ASM files (startup code) from the 4.9 to solve some compilations errors ? I didn't wrote down all the changes I've made.

  • > Regarding the 4.15 kernel I only had to add and patch AXFS to the kernel.

    Can I get your AXFS patch??? It's the only thing I need left before we can release the 4.14 BSP. I've been meaning to get back to it, but haven't.

    If it looks good, maybe you can submit a pull request to the official repo ( github.com/.../ ).
  • > Can I get your AXFS patch???
    Sure, I'll open a PR before the end of the day.
  • I just saw the PR. Thanks!

    At first glance, I have some questions on it, but I'll ask them via github.

    One more think I forgot to mention was that now as of 4.15, cramfs has an XIP option now. However unlike AXFS, it's all or nothing when you choose to XIP a file (you can't select just the pages you want XIP-ed). However, it is an 'upstream' option. But, you do need a new mkcramfs tool to use it. I plan on updating Buildroot (upstream) at some point (hopefully sooner than later)