temp sensor 1124: trying to understand underlying details

Supporting 2.6 and up
bobicanprogram
Phidgetly
Posts: 35
Joined: Thu May 08, 2008 6:30 pm

temp sensor 1124: trying to understand underlying details

Postby bobicanprogram » Thu Nov 10, 2011 3:54 pm

I have an SBC + temp sensor 1124. I'm trying to understand more about how the software works "under the hood". I have a couple of questions.

1) is the built in 8/8/8 interface kit on the SBC still using an internal USB interface? or is there some direct calls that can be made to connected sensors (eg. 1124)?

2) on page 35 of the 1072 Product Manual there is a description of the API for the Interfacekit. However when I grep in the library source I can't find any of those functions. Is this API available? if so where can I find a piece of sample code which uses it?

Thanks in advance for all your help.

bob

User avatar
Patrick
Lead Developer
Posts: 3165
Joined: Mon Jun 20, 2005 8:46 am
Location: Canada
Contact:

Re: temp sensor 1124: trying to understand underlying detail

Postby Patrick » Thu Nov 10, 2011 5:05 pm

Yes, the interfacekit is connected via USB.

The API in the product manual is language-independent. You should look at the API manual for your chosen language for the actual calls. There are also examples written for all languages. You can run C and Java directly on the SBC, or you can use the openRemote/openRemoteIP calls from a program written in any language running on your network.

-Patrick

bobicanprogram
Phidgetly
Posts: 35
Joined: Thu May 08, 2008 6:30 pm

Re: temp sensor 1124: trying to understand underlying detail

Postby bobicanprogram » Tue Nov 15, 2011 9:05 am

Thanks.

I'm struggling to get an "anchor point" in the libphidget C code for the 1124 temperature sensor. I'm assuming that this sensor uses an analog channel on the 8/8/8 ie. a voltage is read. Where in the code is the USB data "string" that is issued to the 8/8/8 to read an analog voltage? Since the 1124 isn't connected by USB directly, how does the system "discover" that it is a 1124?

Thanks in advance for your help.

bob

erik
King of the Lab
Posts: 476
Joined: Fri Mar 06, 2009 12:42 pm
Location: Calgary, Canada
Contact:

Re: temp sensor 1124: trying to understand underlying detail

Postby erik » Tue Nov 15, 2011 9:28 am

It doesn't discover anything about the sensor. Regardless of what sensor is attached, all it does is measure the signal and report the value between 0 and 1000.

Depending on the sensor, you need to take the value between 0 and 1000 and run it through the formula that is associated with the product. This will be found in the 1124 Product Manual, in this case.

bobicanprogram
Phidgetly
Posts: 35
Joined: Thu May 08, 2008 6:30 pm

Re: temp sensor 1124: trying to understand underlying detail

Postby bobicanprogram » Tue Nov 22, 2011 12:10 pm

It is certainly tough slogging to plow through the library code. I am slowly making progress in my understanding.

Is there any documentation publicly available on the USB packet structures exchanged with the embedded 8/8/8 interfacekit on the SBC? This type of documentation would certainly help provide an anchor point into the code.

Thanks in advance.

bob

User avatar
Patrick
Lead Developer
Posts: 3165
Joined: Mon Jun 20, 2005 8:46 am
Location: Canada
Contact:

Re: temp sensor 1124: trying to understand underlying detail

Postby Patrick » Tue Nov 22, 2011 12:56 pm

There is no documentation, but you are welcome to browse the source code. You will need to look at the files cphidgetinterfacekit.c and cusblinux.c from the linux phidget21 library download.

Is there a reason that you need to understand the underlying USB packet protocol?

-Patrick

bobicanprogram
Phidgetly
Posts: 35
Joined: Thu May 08, 2008 6:30 pm

Re: temp sensor 1124: trying to understand underlying detail

Postby bobicanprogram » Wed Nov 23, 2011 8:37 am

I would assume that the USB packet documentation does exist somewhere. Is there a reason why Phidgets doesn't put that in the public domain? As for my purpose ... I like solving C puzzles and your codebase is certainly that. I also like understanding the fundamentals associated with an embedded device. Ultimately, I'd like to use that knowledge to "teach myself" how to use libusb-1.0. If I get that far I plan to open all my code for others to peruse and use. Any other Linux Phidget developers who want to volunteer are welcome to help out. I'd love to see if this puzzle can be crowd solved.

I'm assuming that the 8/8/8 has to be "initialized" in some fashion. I haven't yet found the "hook" into the code where that occurs. I'm also assuming that the write thread "polls" the 8/8/8 periodically for values. I seem to have found the function which gets called (CGETPACKET(InterfaceKit)) ... although I haven't yet puzzled out how it gets called. I can see the bit bashing section in this function which sets the outgoing USB buffer. Just a matter now of puzzling out what is happening. I have been able to cradle this call in a separate executable so that I can probe more directly what the bit bashing is doing. I've done a similar thing for the CPHIDGETDATA(InterfaceKit) data decomposition function. Unfortunately, while I can see what the bit bashing is doing, I don't readily "know" what bits are set for a 1124 temperature read. Plowing forward ...

Thanks.

bob

User avatar
Patrick
Lead Developer
Posts: 3165
Joined: Mon Jun 20, 2005 8:46 am
Location: Canada
Contact:

Re: temp sensor 1124: trying to understand underlying detail

Postby Patrick » Wed Nov 23, 2011 12:58 pm

The packet protocol is documented only in the library sourcecode - we don't maintain external documentation.

The interfacekit doesn't need to be 'initialized'. You just open it and start polling on the interrupt endpoint.

-Patrick


Return to “Linux”

Who is online

Users browsing this forum: No registered users and 1 guest