Skip to main content
its
Associate III
December 3, 2012
Question

Usb mass storage Hard fault Handler?

  • December 3, 2012
  • 12 replies
  • 2858 views
Posted on December 03, 2012 at 06:42

hi:

    after receiving DCMI data i am writing it to USB. after writing some files Hard fault handler occurs... why is it so?

Firstly I capture the DCMI data to buffer, after one frame capture I stop the DCMI and start to transmit data over serial. I repeat this in while(1) loop. e.g

              while(1)

     {

      frame_capture();

      //when frame is capture

      Send_usart(Buffer);

     }     // it works fine it keep on running

secondly, I capture a single frame, then write it on USB mass storage device, repeatedly. e.g like this

 

  frame_capture();

  while(1)

  {

     fopen(......);

    fwrite(buffer);

     fclose(....);

  }   // it works also fine. it keep on running

but whne I combine both codes , Hard fault Handler occurs. like this

while(1)

{

  frame_capture();

     fopen(......);

    fwrite(buffer);

     fclose(....);

 

}  // i get error after random file write after at 15, at 90 at 110  etc

  // some time i even go 400 write file but then fault handler occurs.

why is this happening? I also have set interrupt priority differently. but no effect !!

thanks

#usb-mass-storage #hard-falt-hanlder #dcmi
This topic has been closed for replies.

12 replies

its
itsAuthor
Associate III
December 26, 2012
Posted on December 26, 2012 at 05:15

thanks clive

I have resolved the issue by replacing the frame_capture() function by its definition.

So i am not calling the frame_capture() any more, I just put the code where i call this function.

while(1)

{

 fopen();

 // code of frame capture

 ...

...

...

fwrite();

fclose();

}

But i am still interested why the error was occurring at the first place. I will do the steps u told, and update the status.

thanks.

sangilipandian
Associate
December 28, 2012
Posted on December 28, 2012 at 14:52

Hi  tech.haris,

         I'm newbie to STM32. I need your help. I'm also developing a project that is similar to your's. So i need a help for how did you initialize/deinitialize the camera and captured a frame from it?. So please could you share your code ?.. It would be more helpful for me. 

Thanks in Advance.