Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

   

how to receive data from master

Rank

Total Posts: 7

Joined 0

PM

Hello all,

I can config the 1st board to send broadcast data. But I do not know how to config the 2st board to recieve this data. Please help me

Thanks all.      
Avatar
RankRankRankRank

Total Posts: 213

Joined 2011-05-02

PM

Please have a look at this post.      
Rank

Total Posts: 7

Joined 0

PM

Thanks for help.
I aready read this post.But I am still can not recieve data.

Here code in Master board:

ANT_AssignChannel(ucAntChannel,0x10,ANT_NETWORK_NUMBER);

ANT_ChannelId(ucAntChannel,0,1,1);

ANT_ChannelPeriod(ucAntChannel,WGTRX_CHANNEL_PERIOD);

ANT_ChannelRFFreq(ucAntChannel, ANT_RF_FREQ);

ANT_ChannelPower(ucAntChannel, 2);
ANT_OpenChannel(ucAntChannel);

while(1){
ANT_Broadcast(ucAntChannel, aucTxBuf);
}



and here code in Slave to recieve this data:

ANT_AssignChannel(ucAntChannel,0x00,ANT_NETWORK_NUMBER);

ANT_ChannelId(ucAntChannel,0,1,1);

ANT_ChannelPeriod(ucAntChannel,WGTRX_CHANNEL_PERIOD);

ANT_ChannelRFFreq(ucAntChannel, ANT_RF_FREQ);

ANT_ChannelPower(ucAntChannel, 2);
ANT_OpenChannel(ucAntChannel);

while(1){
while (GPIO_ReadInputDataBit(RF_SEN_PORT,RF_SEN_PIN) != 0) ;
ReceiveBytes(); /*Revieve data from spi via*/
}


I can not recieve any data form master, can not recieve 0xA4 SYNC

Please help me.
}      
Avatar
RankRankRankRank

Total Posts: 213

Joined 2011-05-02

PM

Do you ever receive the response no error that your channel is opened? i.e. something that looks like [40][00][4B][00]      
Rank

Total Posts: 7

Joined 0

PM

Hi,


I sure that I receive response no error with any command when I set.
I do not understand how slave work. is it auto send data to host when receive data from master?
Because after I open channel for slave, SEN pin is alway low.      
Avatar
RankRankRankRank

Total Posts: 213

Joined 2011-05-02

PM

Can you provide your code?      
Rank

Total Posts: 7

Joined 0

PM

Here is my code with rx and tx. Thanks for help.      
Avatar
RankRankRankRank

Total Posts: 213

Joined 2011-05-02

PM

It doesn't appear as though your code is attached. Can you please try again?

Thanks,

Kassandra      
Rank

Total Posts: 7

Joined 0

PM

I can not attach my code, It alway error.
Now I can sloved my module work well. Thanks for help.
I have other question is: How to reduce minimum power consumption for master mode, and how much can it reduce?
Thanks for help.      
Avatar
RankRankRankRank

Total Posts: 213

Joined 2011-05-02

PM

Please have a read through AN13-Power States. This application node provides details on how ANT manages its power state and what the application host processor's role should be to achieve this result.      
Rank

Total Posts: 7

Joined 0

PM

Thanks for help.
And I have other problem that when I Close Channel, I open it again it not work.which I need do before open channel again?      
Avatar
RankRankRankRank

Total Posts: 213

Joined 2011-05-02

PM

When you say it doesn't work, what do you mean exactly? Do you receive the Response no error to your open channel message? Or does it just not provide a response at all? I will need more information on what exactly your particular issue is.      
Rank

Total Posts: 7

Joined 0

PM

Hello,

I try to communicate between my computer with an usb stick and a MCU with an AP2.
When mcu is master there is (now) no problem to communicate with the antwareII but when mcu is slave that doesn't work.

Here is my setting for mcu :
uint8_t assign_channel[7]= {0xA4, 0x03, 0x42, 0x01, 0x00, 0x00, 0xE4};
uint8_t set_channel_ID[9]= {0xA4, 0x05, 0x51, 0x01, 0x21, 0x00, 0x01, 0x01, 0xD0};
uint8_t set_rf_frequency[6]= {0xA4, 0x02, 0x45, 0x01, 0x42, 0xA0};
uint8_t set_channel_period[7]= {0xA4, 0x03, 0x43, 0x01, 0x00, 0x20, 0xC5};
uint8_t set_tx_power[6]= {0xA4, 0x02, 0x60, 0x01, 0x03, 0xC4};
uint8_t set_search_timeouts[6]= {0xA4, 0x02, 0x44, 0x01, 0x14, 0xF7};
uint8_t open_channel[5]= {0xA4, 0x01, 0x4B, 0x01, 0xEF};
uint8_t open_RX_scan_mode[5]= {0xA4, 0x01, 0x5B, 0x00, 0xFE};
Which open channel i must use in this case ?

Then in my main loop i'm waiting rst=low then i read several bytes. But the result correpond of an answer of channel event, is it normal ?

Thanks.      
Avatar
Rank

Total Posts: 19

Joined 2012-05-08

PM

Hello yougo,

To better understand whats happening on your system, would you please post a log of the channel response/event messages. These messages are expected every time the MCU sends an instruction to the ANT chip. Just for ultimate clarity: These messages will be coming from the AP2 to the MCU via the serial connection between them.
Pages 84 - 88 of the ANT Message Protocol and Usage document describes how to interpret these messages.

Also, your configuration uses both open channel and open Rx scan mode. This is a conflict. Open channel tells the AP2 to operate at the message period that you specified, listening periodically for the master’s signal. On the other hand, Rx scan mode doesn’t listen at the set period, but continuously searches for masters. This is why the two modes can’t be operating at the same time.
More information about the continuous scanning mode and how to implement it can be found on the bottom of page 25 of the ANT Message Protocol and Usage document.

Let us know what happens next for you.