All Forums
 Microsoft Windows CE
 General CE
 Reading port A causing lock up
 Forum Locked
 Send Topic to a Friend
 Printer Friendly
Author Topic  

steg80

12 Posts

Posted - 10 Jul 2008 :  06:33:42  Show Profile
Hi,

I am continually monitoring PortA on our BitsyX using SmartIO Api.

This is done in a thread, snippet below (c#):

while(bMonitorBrightness)
{
uint nPortA = SmartIO.ReadPort(SmartIO.PortName.A);
uint bit = nPortA & 0x2;
if (bit == 0)
{
// adjust screen brightness
}
Thread.Sleep(100);
}

After about 10 minutes, the whole system hangs. I commented out the ReadPort call and no hang occurs, thus, it isn't the thread causing the problem, it is the call to ReadPort.

Any ideas, why continually reading port A would cause Bitsy to hang?

Regards,
Steve

akidder

1519 Posts

Posted - 10 Jul 2008 :  08:43:17  Show Profile  Email Poster
You should be able to use the ADSmartIO as described.

Can you let us know the following?
- CE build version (+ Core or Pro)
- ADSmartIO version (displayed on debug output during boot)
- other ADSmartIO activity that may be occurring in your app

Also, are we correct to assume that you're using the C# wrapper classes we provide?

We'll be glad to help you figure out why this failure is occurring.
Go to Top of Page

steg80

12 Posts

Posted - 11 Jul 2008 :  02:36:21  Show Profile
Hi,

CE Build is 5.0. Unfortunately cannot get the debug info output during boot
as not got serial connection wired up.

I've converted the app to C++ and I get the same problem, so it isn't a C# wrapper
problem. The C++ SmartIO version is : 720020-1153x ( this is what it shows at the top of the
ADSmartIO.cpp file ).

This is the exact code that now gets called in a timer every 100 milliseconds :
Reason I have to keep initialising DDR etc is because when the system goes into standby and back out, PortA gets stuck at 0 without it?!

Regards,
Steve

void CBrightnessCppDlg::OnTimer(UINT_PTR nIDEvent)
{
m_pAds->SIOWritePortA(0xff);
m_pAds->SIOWritePortC(0xff);
m_pAds->SIOInitDDRA(0x4);
m_pAds->SIOInitDDRC(0);
m_pAds->SIOInitDDRB( 0xD );
UINT nPortA = m_pAds->SIOReadPortA();
UINT bit = nPortA & 0x2;
if (bit == 0)
{
if (BrightnessValue < 230)
{
BrightnessValue += 10;
m_pAds->SIOBackLightPwm(BrightnessValue);
}
}
else
{
nPortA = m_pAds->SIOReadPortA();
bit = nPortA & 0x1;
if (bit == 0x0)
{
if (BrightnessValue > 20)
{
BrightnessValue -= 10;
m_pAds->SIOBackLightPwm(BrightnessValue);
}
}
}

CDialog::OnTimer(nIDEvent);
}
Go to Top of Page

akidder

1519 Posts

Posted - 11 Jul 2008 :  11:01:50  Show Profile  Email Poster
Thanks for the details. We'll need to know the 5.0 build number and ADSmartIO release to be able to test this issue in detail.

In the meantime, for your application you could detect wakeup using the code posted at topic 2052. That will keep you from constantly having to update your ADSmartIO settings.
Go to Top of Page
  Topic  
 Forum Locked
 Send Topic to a Friend
 Printer Friendly
Jump To:
Eurotech Support Forums © Eurotech Inc. Go To Top Of Page
This page was generated in 0.03 seconds. Snitz Forums 2000