Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

   

Can’t receive ant module’s response

RankRankRankRank

Total Posts: 523

Joined 2012-11-15

PM

I'm working with the ANT11Txx3MxIB module in async mode using the schematics in the page 8 as it follows:

High = 3V
Low = 0V

PIN01 GND = Low
PIN02 /RESET = High
PIN03 Vcc = High
PIN04 Low
PIN05 Low
PIN06 /SUSPEND = High
PIN07 SLEEP = Low
PIN08 Low
PIN09 PORTSEL = Low
PIN10 BR2 = High
PIN11 TXD0 = connect to mcu's uart_RX
PIN12 RXD0 = connect to mcu's uart_TX
PIN13 BR1 = Low
PIN14 BR3 = Low
PIN15 Low
PIN16 Low
PIN17 RTS = connect to mcu's uart_CTS

the main flow:
{...
ANT_ResetSystem();//this command has no response
usleep(500000);

ANT_SetNetworkKey(ANT_NETWORK_NUM, ucNetKey);//should get response;
if(!ANT_AssignChannel(ANT_CHANNEL_NUM,ANT_CHANNEL_TYPE,ANT_NETWORK_NUM))
{
printf("ANT channel estabish Error\\n");
return FALSE;
}
....
}


I can see the pulse of RTS when sending message;but nothing received.
Can anybody help me?Thanks.      
RankRankRank

Total Posts: 55

Joined 2008-10-24

PM

Are the PINs tied to high/low or logic high/low? It seems the reset pin is not controlled by the MCU and the baud rate is set as 19200.

There are two things you may need to check in your code:
1.The UART drive, ensure the MCU implement the ANT drive correctly;
2.The messages which you sent are correct, including Check sum byte.

You may send us the time diagrams of the RTS,UART_TX/RX and RESET, if the problem still can not be found.      
RankRankRankRank

Total Posts: 523

Joined 2012-11-15

PM

Hi,Thanks for your help

Yes,the reset pin is not controlled by the MCU ,is tied to high(Vcc)and the baud rate is set to 19200.

The message is below:

BOOL ANT_ResetSystem()
{

Uint8 antBuf[5];
int ret;

antBuf[0] = MESG_TX_SYNC;
antBuf[1] = MESG_OPEN_CHANNEL_SIZE;//0x01;
antBuf[2] = MESG_SYSTEM_RESET_ID;//0x4A;
antBuf[3] = 0;
antBuf[4] = CheckSum_Calc8(antBuf, 4);

ret=write(uart_fd, antBuf,5);

}



BOOL ANT_OpenChannel(Uint8 ucChannel)
{
Uint8 aucTxFifo[TX_FIFO_SIZE];
Uint8 ucTotalSize;
int ret=0;
aucTxFifo[0] =MESG_TX_SYNC;
aucTxFifo[1] = MESG_OPEN_CHANNEL_SIZE;
aucTxFifo[2] = MESG_OPEN_CHANNEL_ID;
aucTxFifo[3] = ANT_NETWORK_NUM;//0;
aucTxFifo[4] = CheckSum_Calc8(aucTxFifo, 4);

ret=write(uart_fd, &aucTxFifo;[0],5);

if(!ANT_GetResponse(rspBuf,5,ANT_WAIT_TIME))
return FALSE;

if(rspBuf[1]==MESG_RESPONSE_EVENT_ID &&
rspBuf[2]==ucChannel &&
rspBuf[3]==MESG_OPEN_CHANNEL_ID &&
rspBuf[4]==RESPONSE_NO_ERROR)
return TRUE;

return FALSE;

}      
RankRankRank

Total Posts: 55

Joined 2008-10-24

PM

The code does not make sense for me. The waiting time in your code is usleep(500000); how long is it?
Can you please send us the time diagrams of the RTS,UART_TX/RX and RESET for the investigation.

Execution the system reset () command, 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.      
RankRankRankRank

Total Posts: 523

Joined 2012-11-15

PM

Hi

Yes, I changed my ant module's pin connection:
High = 3V
Low = 0V

PIN10 BR2 = High
PIN13 BR1 = High
PIN14 BR3 = High //baudrate=57600

PIN17 RTS = connect to mcu's gpio which is setting to input;

After setting my uart port, I send system reset message,but I get nothing response

BOOL ANT_ResetSystem()
{
Uint8 antBuf[8];
int ret;
Uint8 rspBuf[5];

antBuf[0] = 0xa4;
antBuf[1] = 0x01;
antBuf[2] = 0x4A;
antBuf[3] = 0;
antBuf[4] = 0xef;
antBuf[5] = 0;
antBuf[6] = 0;

ret=write(uart_fd, antBuf,7);
usleep(500000); //wait for 500ms

if(!ANT_GetResponse(rspBuf,5,ANT_WAIT_TIME))
return FALSE;

if(rspBuf[0]== 0xA4&& //sync;
rspBuf[1]== 0x01&& //message length;
rspBuf[2]== 0x6f&& //message code// start up message
rspBuf[3]== 0x20&& //command reset
rspBuf[4]== 0xea) //check sum;
return TRUE;
return FALSE;

}

By the way,how can I upload my time diagrams?
Thank you.      
RankRankRank

Total Posts: 55

Joined 2008-10-24

PM

Have you set the UART port properly? The UART communication settings are for one start bit, 8 bits of data and no parity.
I do not see you monitor the RTS flow control in your code.

Please use oscilloscope to probing the signals and capturing the time diagrams.      
RankRankRank

Total Posts: 55

Joined 2008-10-24

PM

Just noticed that you are working on the AT3 module, the AT3 does not have startup message after Reset.
Any message is required to send to AT3 to check the response:

For example, the MCU Execution the system reset () command, you should expect the following message sending from the MCU: Tx - [A4][01][4A][00][EF], then you can send a request message Tx - [A4][02][4D][00][52][B9]; then the response message should be observed from ANT: Rx- [A4][02][52][00][00][F4]      
RankRankRankRank

Total Posts: 523

Joined 2012-11-15

PM

My UART communication settings are for
one stop bit,
8 bits of data,
no parity.
flow control=CTSRTS.

Is that right?      
RankRankRank

Total Posts: 55

Joined 2008-10-24

PM

It is not right.

Please note that all UART communication settings are for one start bit, one stop bit,8 bits of data and no parity.
Data is sent and received LSBit first.      
RankRankRankRank

Total Posts: 523

Joined 2012-11-15

PM

I can get the response now. It's nothing to do with UART setting. I connect the ANT module to my processer board with 17 wires. I use USB board to power the ant module ,then it works.
Anyway,thank you for your help.