Please
Problem scanning I2C bus
-
-
-
OK, when you mean the file: NKP1_CF2_AYG_070206.zip then I got it and it does not work in my PicoMod program. It does not hang up the CPU anymore, but the touch screen and the I2C is not working after about 1000 times reading the value of the I2C.
I'm working in .Net and I do the following:
Main functions:
Code- ' Get the result of a previously scheduled request
- Public Sub GetResult(ByVal msg() As NI2C_MSG_HEADER, ByVal data() As Byte)
- Dim BytesReturned As Integer
- Dim msglen, datalen As Integer
- msglen = Marshal.SizeOf(msg(0)) * msg.Length
- datalen = data.Length
- 'Here it hangs-->
- If DeviceIoControl1CE(m_hFile, IOCTL_NI2C_GET_RESULT, msg, msglen, _
- data, datalen, BytesReturned, IntPtr.Zero) = 0 Then
- Throw New NI2CException
- End If
- End Sub
Code- Public Function ReadData() As Integer
- Mut.WaitOne()
- Dim NewValue As Integer
- Dim i As Integer
- Try
- Dim SchedMsg(1), ResultMsg(1) As NI2C_MSG_HEADER
- Dim SchedData(2) As Byte
- SchedData(0) = &HE0
- ' Message 0: prepare message for device E0
- SchedMsg(0).chDevAddr = &H90
- SchedMsg(0).chFlags = 0
- SchedMsg(0).wLen = 1
- ' Message 1: read the bytes from the device
- SchedMsg(1).chDevAddr = &H91
- SchedMsg(1).chFlags = 0
- SchedMsg(1).wLen = 2 'Short = 2 Bytes
- ' Schedule the request of two messages
- Schedule(SchedMsg, SchedData)
- ' Check if result is available
- i = 0
- Do
- i = i + 1
- If CheckResult() = True Then Exit Do
- Threading.Thread.Sleep(10)
- If i > 100 Then
- Exit Do
- End If
- Loop
- ' Fetch the result and show it
- GetResult(ResultMsg, SchedData)
- NewValue = SchedData(1) * 256 + SchedData(2)
- Catch ex As Exception
- ' Handle any exception from NI2CFile
- 'MsgBox(ex.Message)
- frmMessageBox.ShowMessage("Fehler", ex.Message)
- NewValue = -2 'Error
- End Try
- Mut.ReleaseMutex()
- Return NewValue
- End Function
I tried it with a very simple button too. But it does hang up too if I really do the click-work 1000 times.
Or, I only have not the newest Kernel?
Timo
-
No, I sent you an E-Mail with subject "RE: I2C" and the files ni2c.cab, ni2c.dll, ni2cio.h, ni2c_touch.cab, ni2c_touch.dll attached to it.
Nevermind, I'll resend it, but in fact you *were* one of the first people to get the new version.
Regards,
H. Keller
-
Thanks I received it now.
AND IT WORKS
Now, with just some less lines code.
Thanks -
i see this thread is over one years old. but still there are the old versions (1.1) of the ni2c.dll in the actual windows ce 5.0 image for PicoMod1.
is there some place where i can download the new - and as i've read - much improved version of the driver?greetings
florian g. -
Quote from "fgrabher"
i see this thread is over one years old. but still there are the old versions (1.1) of the ni2c.dll in the actual windows ce 5.0 image for PicoMod1.
You are right. The drivers for NetDCU8 and PicoMOD1 are identical, but only the NetDCU8 directory was updated with the new versions. Therefore the PicoMOD1 still got the rather old release. I have updated the CD image and future CDs should have the current version now.Quoteis there some place where i can download the new - and as i've read - much improved version of the driver?
I've already sent the new version to you by e-mail.Regards,
H. Keller
-
Please send me your new files.