cancel
Showing results for 
Search instead for 
Did you mean: 

Core is held in reset, and debugging fails when plugging in camera

michaelmccartyeng
Associate II
Posted on September 12, 2013 at 04:00

Finally got my ov2640 cameras and was chugging through the code. But then I started a debug session (after several other successful ones) and I get this error 

''core is held in reset'' 

If I unplug the camera I can debug but that does me no good. If I start debugging without the camera then plug it in it will work for writing a few registers and then fail. 

Any ideas ? 

I'm using keil on a stm32f4 discovery

Update:

It does not seem to get in this state if I do not call 

OV2640_JPEGConfig(JPEG_160x120);

which does a lot of this type of stuff, seems to write a few i2c regs then stops responding.

void OV2640_JPEGConfig(ImageFormat_TypeDef ImageFormat)

{

  uint32_t i;

  OV2640_Reset();

  Delay(200);

  /* Initialize OV2640 */

  for(i=0; i<(sizeof(OV2640_JPEG_INIT)/2); i++)

  {

    OV2640_WriteReg(OV2640_JPEG_INIT[i][0], OV2640_JPEG_INIT[i][1]);

  }

  /* Set to output YUV422 */

  for(i=0; i<(sizeof(OV2640_YUV422)/2); i++)

  {

    OV2640_WriteReg(OV2640_YUV422[i][0], OV2640_YUV422[i][1]);

  }

#stm32f4discovery
5 REPLIES 5
michaelmccartyeng
Associate II
Posted on September 12, 2013 at 22:11

I still have no idea what causes this. I'm just writing to i2c registers in the camera and my debugging session crashes, followed by the inability to debug because 

''core is held in reset''. 

I've had issues like this with other MCU normally I would restart them and it would go away. Its like the MCU is not responding to debugging so thats why your debugging crashes, so obviously its not ready to start another debug session. 

Its so weird though that it would happen when i'm writing i2c regs ? Do you think maybe the camera is pulling too much power when I enable and causes the cpu to throw a piston ? 

Thanks, hope I can figure this out jpg is going to be sweet ! 

frankmeyer9
Associate II
Posted on September 13, 2013 at 12:41

? Do you think maybe the camera is pulling too much power when I enable and causes the cpu to throw a piston ?

 

That was my first idea, some kind of brown-out.

I once had such problems with a QVGA panel attached.

Perhaps you can try to supply your hardware externally (not by USB).

michaelmccartyeng
Associate II
Posted on September 14, 2013 at 21:08

I dont think its a power issue. I plugged in a computer ps with 5v to power everything and its exactly the same. I get to writing the reset register and I get stuck in

/* Test on I2C2 EV6 and clear it */
timeout = DCMI_TIMEOUT_MAX; /* Initialize timeout value */
while(!I2C_CheckEvent(I2C2, I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED))
{
/* If the timeout delay is exeeded, exit with error code */
if ((timeout--) == 0) return 0xFF;
}

and I can see the timeout counting down. It almost seems like its coming from somewhere else like a interrupt causes some horrible issue, but if i dont go into the function that writes those registers it works fine ? But of course if i cant write the cameras registers I cant use it. OV2640_WriteReg(OV2640_DSP_RA_DLMT, 0x01); OV2640_WriteReg(OV2640_SENSOR_COM7, 0x80); The first register just switches to page 1 the next should reset it, but Like I say above it never even gets past the check for transmitter mode ... ?
michaelmccartyeng
Associate II
Posted on September 14, 2013 at 23:10

I think that maybe this is all caused because the camera port on my board is connecting a data line from the camera to the ''Reset'' pin which is connected to ''NRST'' so maybe when the camera does something it is asserting that pin and causing all these issues. 

michaelmccartyeng
Associate II
Posted on September 14, 2013 at 23:21

Yes, thats exactly what it was. Problem solved, thanks for reading.