Author Topic: Zynqberry: bare metal camera initialization  (Read 97 times)

marph

  • Active Member
  • *
  • Posts: 2
Zynqberry: bare metal camera initialization
« on: December 02, 2018, 03:59:38 PM »
Hi,
I'm writing a bare metal application to initialize my raspberry camera. I tried to follow the instructions of https://forum.trenz-electronic.de/index.php?topic=939.0. The modified "rpicam.c" is attached (as .txt, because .c extension isn't allowed). So far i2c initialization seems to be successful, but the application hangs up at line 27 when calling "XIicPs_MasterSendPolled()". I couldn't find any solution for this. Could you point out where the mistake is?

Oleksandr Kiyenko

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 333
Re: Zynqberry: bare metal camera initialization
« Reply #1 on: December 03, 2018, 10:39:28 AM »
Hi,

To work with a camera using I2C bus, you have to program I2C mux first.
You need to switch it to bus 3. A code will be like
...
u8 WriteBuffer[1];
WriteBuffer[0] = 0x07;
Status = XIicPs_MasterSendPolled(InstancePtr, WriteBuffer, 1, 0x70);
...


Best regards
Oleksandr Kiyenko

marph

  • Active Member
  • *
  • Posts: 2
Re: Zynqberry: bare metal camera initialization
« Reply #2 on: December 04, 2018, 11:19:57 PM »
Hi,
where do I have to add the code for chosing the channel of the I2C mux?

I guessed at the "iic_init()" function. After doing it, the behaviour was the same as in the previous post. The program still hangs at the first occurence of "XIicPs_MasterSendPolled()".

Best regards
Marph

Oleksandr Kiyenko

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 333
Re: Zynqberry: bare metal camera initialization
« Reply #3 on: December 05, 2018, 09:07:17 AM »
Hi,
This code should be placed after iic_init() and before access to camera registers.

BR
Alex