Serial Camera L2 Module take single image and save to microSD

Brett, but why the timer works perfect in debug mode? what the matter it doesn’t work in release?

Release runs faster because, for example, there is no checking for breakpoints, etc. So you can have timing and/or synchronization issues that are visible only in Release or Debug builds.

Exception class has StackTrace property. It is a string that shows snapshot of the stack. Try output it to your display. It should tell what method throws the exception.

1 Like

I wish i could but my carachter display it’s not enough to output the full stack trace…

I am stuck :frowning:

Becase i cant show a stack trace on display, i tried to write a stack trace to sd log file, but with no success:


catch (Exception exp)
{
       string rootDirectory = VolumeInfo.GetVolumes()[0].RootDirectory;
       byte[] data = Encoding.UTF8.GetBytes(exp.StackTrace.ToString());
       FileHandle = new FileStream(rootDirectory + @ "\logfile.txt", FileMode.Create);
       FileHandle.Write(data, 0, data.Length);
       FileHandle.Close();

       DisplayStatus(1, exp.StackTrace.ToString()); 
}

There is no file on SD…

Try to clean up your code a bit. Start communication and do processing loop in the same thread, instead of using two separate threads. In the take picture case check that you are done taking previous picture.

1 Like

I will try to do what you suggest, but i really don’t understand if the code works under debug it should work under release like in windows app.

Finally i could read an exception output with MF Deploy tool, John from GHI advice me to use this tool. And exceptions starts right after the initialization of wifi thread. I even dont send a take picture command to robot and have different exceptions from camera module, but why? in debug mode everything is ok.

Here is exception that casing a OutOfMemory under release mode :

Here is output in visual studio, i can see a OutOfMemory exception but picture is saved anyway:

@ Alex Bilityuk - Hi Alex.

Thanks for contacting all the GHI employees for help; that is what we are here for. That said, it doesn’t usually benefit to ask the same question via email and the forum.The advice here is excellent.

Most, if not all your problems, relate to timing issue, memory issues, and threading issues. I suggest that you find information explaining these topics. It will help you as you work on your project.

I did some brief searches (using Google) with the following strings:
“NETMF timer threads”
“NETMF garbage collection”

Both of these returned many results that are very good discussions of the topics.

PS thanks (!) to all the community members helping Alex.

1 Like

Yes i really thanks all the community members!!! You are the best!!! all of you! Ok Jeff i will try to search it… thank you!

Architect, you are right my friend!!! You are right right right ;D ;D ;D ;D ;D

It works… i just do it in one thread and tonight i am the hapiest man )) lol

1 Like

yep, I thought a timer was the wrong approach. Moving to a thread has probably allowed GC to do it’s business

1 Like

@ Alex Bilityuk - I am glad you figured it out.

2 Likes

I didn’t move from a timer Brett. still using a timer, but transform the code as Architect suggested. ;D