Author |
Topic |
|
steg80
12 Posts |
Posted - 10 Jul 2008 : 06:33:42
|
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
|
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. |
|
|
steg80
12 Posts |
Posted - 11 Jul 2008 : 02:36:21
|
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); } |
|
|
akidder
1519 Posts |
Posted - 11 Jul 2008 : 11:01:50
|
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. |
|
|
|
Topic |
|
|
|