Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

   

Low level access to USB stick

RankRankRankRank

Total Posts: 523

Joined 2012-11-15

PM

I am trying to build an application in APL to communicate with a USB ANT+ stick. I can import all of the functions from the ANT_DLL and make use of them to make the appropriate calls to the stick. I can also assign a response function which runs successfully on a callback from the stick but what I cannot do is assign a response buffer as I cannot see any way in which my application and the dll can share the same section of memory. Is this possible. Is there anyway for example to implement file mapping?

Failing that is there any low level documentation available that specifies the win32 api calls which I assume the dll eventually relies on. I am quite happy to implement these calls and construct/decode the appropriate communication message packets.

Finally has anyone/can anyone convert the dll to an activex control which would dramatically widen the range of programming languages that could communicate with the USB stick. I have seen requests from others in the forum who would like to use languages other than C++      
Avatar
RankRankRankRank

Total Posts: 213

Joined 2011-05-02

PM

Hi,

The ANT Library Windows Package contains example source code This can be found here:

http://www.thisisant.com/pages/ant/ant-software-tools

Cheers      
Rank

Total Posts: 7

Joined 0

PM

I am sorry but simply referring to the library package does not help me a great deal. I was looking for a little more in the way of guidance. I have a copy of and have studied the package.

As to my first question. I am not coding in C++ so the examples are not directly applicable but do serve as guidance. I can import the dll functions and use them what I do not seem to be able to do is share the memory associated with the response and event messages. There is nothing in the package that indicates how memory can be shared across applications/languages.

With regard to my second question then it is clear that the library was created to obviate the need to code the communications with the USB stick at the windows level. However armed with the relevant documentation setting out the low level windows calls used and things like the IOCTLs then I am happy to code my interface at that level. Is such documentation available. It is clearly not part of the package.

Finally I asked whether anyone had or could convert the ANT_DLL to an activex control to vastly improve its interoperability with non C based languages. I will leave that to others if it is something ANT has not considered.      
Avatar
RankRankRankRank

Total Posts: 213

Joined 2011-05-02

PM

Hello,

We currently have no low level documentation that corresponds to what you're looking for. The Library windows package has all the documentation within it that we have related to coding with ANT at this time. It has a wrapper that allows coding in C#, so you might be able to use this as reference to what you're trying to do.

Good Luck,

Kassandra      
Avatar
RankRank

Total Posts: 39

Joined 2011-06-29

PM

I cannot speak directly in terms of Windows DLLs, but from my work with linux drivers I can tell you that in order to:
1) keep user space and kernel space separate
2) have a kernel that does not panic (crash)
kernel code gets separated and doesn't call user space code, ever. Two common ways I found to "call" user space from kernel are:
1) signals: some way for the kernel to tell user space to call a read function with a data buffer
2) read thread: have a thread which loops trying to read and either block in the driver while data is not available or wait in user space in between reads
In linux the interface is something like a socket or a device, I am not entirely sure how windows does it but I hope this helps.      
Rank

Total Posts: 7

Joined 0

PM

Hi Maurits, Thanks for the advice but in the end I found a simpler solution. By dropping down one level to that of the device driver I now have a prototype real time heart rate monitor app running on my PC.

I found that by downloading the USBXpress development kit from:

http://www.silabs.com/products/mcu/Pages/USBXpress.aspx

I was able to use just a few of its API functions described in its manual to allow me to configure my USB stick and then send messages to and receive messages from it. Then with just a few more lines of code to encode and decode the messages described in the ANT Protocol and for general process control that's it done.

In the end it appeared to be far simpler than trying to use the ANT_DLL and library with their considerable overheads and pages of associated code.

Suggestion for ANT: why not put a link to the USBXpress development kit in your resources section and advise developers that it represents an alternative to the ANT_DLL if they want to implement the ANT Protocol more directly on a windows PC. The USB API is far more non-C++ language friendly than the ANT_DLL. After all your documentation says that the system is implemented over a simple serial interface. Well armed with the USBXpess development kit it is.      
Rank

Total Posts: 2

Joined 0

PM

Hi APL Sport.
Do you mind sharing some of your findings about low level access? If possible could you email me .(JavaScript must be enabled to view this email address)      
Rank

Total Posts: 7

Joined 0

PM

Hi Kostya,

Sure. No problem email on its way. In the mean time be sure to download the USBXpress development kit from:

http://www.silabs.com/products/mcu/Pages/USBXpress.aspx

I am using the latest API dlls from that kit which are:

CP210xManufacturing.dll and SiUSBXp.dll