Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

   

.Net Micro + AP2

Rank

Total Posts: 15

Joined 0

PM

Hi,

I've been developing a windows based piece of software recieving from ANT+ sports equipment (using the usb stick that came with my garmin FR60). I'm now attempting to port it to an embedded .net micro framework based device (starting with a fez panda II).

I've wired the AP281M41B module to the Com2, and setup it with UART = 4800 and handshaking in Async mode with BR1,2,3, to ground to set the slowest mode.

SerialPort UART = new SerialPort("COM2", 4800);
UART.Handshake = Handshake.RequestToSend;

I reset the module by asserting the reset line low, then high, then low, then SRDY to to high, and SMSRDY to low. Then UART out to send the Reset command, then assign channel, then request channel status. This is where I'm getting nothing back.

I've attached the test library so you can see what I'm doing.

Since I'm getting nothing back when I request status I'm suspecting something is wrong and don't want to impement the rest of the setup commands if I'm getting nothing at this point.

Any suggestions?      
RankRankRank

Total Posts: 55

Joined 2008-10-24

PM

I do not see your attached test library.
BTW, have you observed the RTS pulse when you sending messages?
If you can see it, could you please send us the time diagrams of RTS, TX/RX for investigating?      
Rank

Total Posts: 15

Joined 0

PM

Sadly as I said I attached it, the sit refused *.cs files. I let the post go. So it refuse the file when I tried to post.

Anyway, I've tried to loop back the Com2 to com1 on the fez panda and the fez is recieving it. I'm using handshaking so it should (Can't tell if that is working at all, MS documentation is weak at best. Options include hardware, software, and no handshake)

Since Com 2 requires handshake, and com 1 does not (and doesn't support hardware handshake), it should mean that the ant+ module is asserting RTS but I'm going to investigate that by not not connecting it.

As for timing diagrams. Not sure how I can produce these without an oscillascope, which I am lacking.      
Rank

Total Posts: 15

Joined 0

PM

ANT lib, .cs renamed to .txt

Not much in it, just working to start translating one was developed for an arduino and the AP1 based board sold by sparkfun.      
Rank

Total Posts: 15

Joined 0

PM

Ugh. Try again on the file [file name=ant.txt size=8845]http://www.thisisant.com/images/fbfiles/files/ant.txt[/file]      
RankRankRank

Total Posts: 55

Joined 2008-10-24

PM

I cannot see the problem from the library. There are couple things you may need to check:
1. the hardware connection, to ensure the 17 wires of the AP2 module are connected well with FEZ PANDA.
2. After system reset command, waiting for 500 ms to see if you get the response:
you should expect the following message sending from the MCU: Tx - [A4][01][4A][00][EF]

[A4]: Sync
[01]: message length
[4A]: message code// system reset
[00]: data
[EF]: check sum

Then your code should wait for 500ms to ensure the RTS line toggled, which means ANT is in the proper, “after-reset” state; the response message should be observed from ANT: Rx - [A4][01][6F][20][EA]

[A4]: Sync
[01]: message length
[6F]: message code// start up message
[20]: command reset
[EA]: check sum

Care should be taken that the further commands can be issued from the MCU only after the RTS toggle has been observed.

If the problem still exist, please use oscilloscope to probe the signals of RTS,UART_TX/RX and RESET for further investigation.      
Rank

Total Posts: 15

Joined 0

PM

Seems I was opening the UART line to long after resetting the AP2 so it couldn't see the pulse. I found out that if I jiggled the wire between RTS and CTS on my protoboard that it would sent the commands and I would get them back.

Rewrote the initialization routine to open UART first then reset the chip and seems to resolve the problem.

Thanks a lot for your help and time! I'd like to put up my .net C# library for the AP2 once it's done. I'll have to check the licence agreement on that first though.