Glide and Initial Touch response speed on CP7

Mainboard: FEZ Spider
Firmware: 4.2.11.1
Display: CP7

Hi,

I am designing an interface on the CP7 and have a problem where after the initial window is loaded in Glide it can take upwards of 25 seconds before the CP7 generates any touch events.

I have tested the code by removing Glide (not the reference to the dll but the loading of the main window) and the CP7 generates the touch events almost instantly.

I am not sure why this is happening or where to even start to begin trying to troubleshoot this, as this is occurring after the window is displayed, so I am assuming that all the processing necessary to generate it has already been completed.

Any ideas or push in the right direction would be appreciated.

Thanks,
Khalil

The best thing here is to show us a simple project that can demonstrate this on someone else’s system.

I was afraid you may say that.

The only reason I didn’t was because I am using the SDCard and loading images off that to create the screen etc.

Ok I will create a project with the bare minimum and attach it to the post.

Thanks,
Khalil

Ok as requested, here is the project with some details.

Hardware: FEZ Spider with SD-Card , CP7 and USB-ClientDP

The images are loaded from the SDCard and can be found in the images directory off the root.

Again the problem is that the CP7 does not generate a touch event until at least 25s after the main window is shown.

Thanks in advance to anyone who tries this. The zip file can be found here:

https://drive.google.com/file/d/0B33xtdsvpTTSM1lmZlcydVRyVW8/edit?usp=sharing

Khalil

and of course, it’s not like that may cause the issue :wink:

This process may simply help you understand what in your code might be influencing this too.

I guess the thing that is confusing me is that this is happening after the screen is loaded and shown. I am assuming that Glide is complete at that time but maybe it is not, I just don’t see what other functions would be called.

Just to be clear, I expect the delay on loading the images from the SDCard. I just didnt expect the delay to receive the touch events after the screen is shown.

But you are probably 100% correct in that it is something I am doing, but I thought I would blame it on Glide first :stuck_out_tongue:

Thanks,
Khalil

It might help if you hit the break button in the debugger, while the delay is occurring, and look at what threads are active.

Mike thanks for the suggestion. I did as you suggested and have attached two screenshots. One of the Callstack and the other of the Local variables.

Honestly I am not quite sure how to interpret this based upon my limited knowledge. To me it appears to be sleeping after calling the SDCard dll?? Why, I have no idea.

Just to put it out there, I am using this same routine on a TE35 and it works right away. I am going to test on the T43 later on today.

If anyone can shed more light on this I would appreciate it.

Thanks,
Khalil

@ khalilm - There is also a Threads window in VS. This will list all the active threads. You should look at the call stack for all of the threads, and see if anything is happening.

Ah the things you learn…

I opened the Thread window and the information seems to be pointing to the same information in the Callstack. Please see attached screenshot.

It looks like everything is pointing to the SD card and I have looked at my implementation but cannot see anything blatantly wrong with it. And as I said, I am using the same code with the TE35 which works fine.

I will continue to look at the SDCard code to see if I did anything wrong…

Thanks,
Khalil

Just an update on this.

With the idea from Mike and the fact that it seems like the SDCard, I have commented out the code and added it back line by line to see where the problem is occurring.

It seems that my LoadBitmap function(s) is causing this delay. Not sure why yet, but at least it is a step forward.

Khalil

I am really hoping someone with more experience can help me to solve this problem.

In looking at the thread output it appears that the code is “stuck” in the _sdCardDetect_Interrupt function.

In looking at the source in Codeplex, I can see a thread delay there but it is only 500ms. But for some reason either this stuck there or is being called multiple times. I am not sure how to figure which and why.

** I have changed the way the bitmap are loaded using the following code:



** I have tried to mount the card during initialization (yes I know this is done automatically on startup) but I had to try using this code[/li]

```cs

if (!sdCard.IsCardMounted)
{
       sdCard.MountSDCard();
       System.Threading.Thread.Sleep(500);
}            

but it is never called. So it seems to be mounted correctly.

** I have commented out (and moved to ProgramStarted) the SD Card handlers.
** I have even made the _storage variable static.
** I have tried running the code in release mode.

Nothing I have tried so far seems to affect why the code is stuck in the _sdCardDetect_Interrupt function and for now I am out of ideas on what to try.

Help anyone? GHI? Can anyone try this code if they have the available modules.

Thanks,
Khalil

Well, I got desperate and decided to swap out the SDCard reader and no luck.

Then I swapped out the connecting cable and bingo. It worked.

I had the SDCard mounted in a box a distance away from the micro. Now many gray hairs later, I know.

Turns out that the SDCard will NOT work with the long 8" cables. Yes I did try two different ones to verify. Only the shorter cables remedy this issue.

Anyway, I would like to thank everyone who offered their advice. At least it wasnt a complete waste for me as I did learn something.

Khalil

This might be a good addition to the Specifications tab:
Maximal/Prefered Gadgeteer cable length.

Ok I will add this to the Task Tracker.