搜索
bottom↓
回复: 1

关于FAP频率捷变的笔记

[复制链接]

出0入0汤圆

发表于 2010-2-22 23:08:13 | 显示全部楼层 |阅读模式
nAN24-07讲的主要是Frequency agility protocol for a 2.4GHz mouse/keyboard application。FAP频率捷变在nRF24XX上的实现。
“A protocol that will move own traffic to another channel in the 2.4GHz band if a stationary disturbance occurs at the currently used frequency.”
频率捷变就是将流量从受到干扰的频率移到另一个频道。
The main functionality of the frequency agility protocol will be to:
• Detect stationary disturbance.
• Move in such manner that new disturbance from the same source will not occur.
• Do not move if disturbed by a frequency hopping source.
• Give priority to mouse traffic.
(本文中的)频率捷变要实现的主要功能:
测出干扰。
移到没有干扰的频道。
如果干扰源是跳频,就不要移动。
给鼠标数据以高优先权。
It is important to notice that this protocol will only force a change in operating frequency when a stationary disturbance occurs. After it has changed the operating frequency, it will be on the new channel for a relative long time.
频率捷变不是跳频,当且仅当有固定干扰源时,才会变换频道,避开干扰源后,它会停在这里。
The frequency agility protocol functionality is based on the communication between the mouse and the dongle. When the mouse is in use, it will send a packet to the dongle every 8th millisecond and wait for acknowledge. The mouse will re-send a packet up to two times if no acknowledgement has been received. Bluetooth will stay up to 650 microseconds on one channel before hopping. This means that if a Bluetooth system is knocking out the mouse’s first attempt to send a packet, the next two should get trough since each packet –acknowledgement cycle takes about one millisecond. It is therefore not likely that a frequency hopping system will cause a change in frequency.
频率捷变协议(在这个方案里)主要用来实现鼠标和dongle之间的通讯。鼠标工作时,每8ms向dongle发一个包,并等待ACK,等不到,就重发,最多两次。蓝牙在跳频之前,最多会在一个频道停留650us,也就是说,如果鼠标发向dongle的包在第一次被冲突的话,后两次也可以通过,因为鼠标的包有1ms长。所以FPA不用在FHSS的环境里。
If all three attempts to send a packet fail, the mouse and dongle will change channel according to a table. The table is built up to take care of the functionality that avoids disturbance from the same source at the new channel. Figure 2 shows a typical table with channels used by the
frequency agility protocol. The table is “WLAN weighted,” meaning it will find the next channel outside of the assumed WLAN channel that is disturbing the currently used channel.
如果三发不过,鼠标和dongle就会改频道了。改频道按照一个预定的表进行,这个表叫做“WLAN回避”,就是改到WLAN不用的频道上。
在这个文本里,鼠标和键盘的FAP实现是不一样的。鼠标作为一个高数据率的设备,是主动执行FAP的,而键盘作为一个偶发的设备,是一个Follow。下面是具体算法。
鼠标的初始态是IDLE,当有移动时,进入RF updating,向dongle发出数据,并Wait for ACK。正常情况下收到ACK后,鼠标又回到RF updating,如此循环,直到没有移动,又进入IDLE。
当三发不过发生时,开始改频道。
In the Change Frequency state it will perform a table look up to find the next channel to use.It will also mask out a channel that is very noisy, preventing use of this channel in close future. A background timer telling how long the current channel has been used will give input to the masking process. If a channel has been used for less than 20ms before a new frequency change is initiated, it should be masked out. The masked out channels should be reset after a given time period.
改频道就是在频道表里先找到下一个可用的频道,并判断它是否可用,标准是噪声。如果20ms之内,改频道又开始了,那么这个频道一段时间内不可用,它被masked out了。
After changing frequency, the mouse enters the Wait for dongle to time out state. Since the dongle might has received the packets from the mouse, and it is the acknowledgements that have been lost that is the reason for the frequency change, the mouse must wait for the dongle to time out.
找到一个可用的频道后,鼠标要(重发三发不过的包?并?)等待dongle的ACK直到超时。
Then the mouse will enter the Update and check channel loop counter state where it updates and check its channel loop counter to determine if the dongle is still present or not.This decision is made from checking how many times the mouse has looped trough the channel table without contact with the dongle. If the decision is that the dongle is still present,the mouse returns to the Send Packet to Dongle state, if not it returns to the Idle, No movement, No RF state.
(如果超时一直发生?)鼠标进入改频道循环?直到又和dongle联系上为止,如果一定次数之后仍然联系不上,那么(就算出了服务区?)进入IDLE。
In the Idle, In Use, RF updating state the mouse will time out if no user evens has not occurred in a while. The mouse will then send a “I’m going to sleep” packet to the dongle by entering the Send “Go to sleep” packet to dongle state. After receiving acknowledgement from the dongle, the mouse enters the low power state; Idle, No movement, No RF.
鼠标进入休眠模式之前,要向dongle发一个“Go to sleep”包,并在收到ACK之后进入休眠模式。
The keyboard will use a channel table like the mouse, but it will not perform any masking of channels. After changing frequency, the keyboard will also determine if the dongle is present or not in the Update and check channel loop counter state. If the dongle is still present, it will return to the Send Packet to dongle state where it will try to send the packet to the dongle at the new channel. If the dongle is not present, it will go to the Idle, No RF state.
键盘的频道改变和鼠标类似,但不判断它是否可用,没有masked out,而是简单的进入改频道循环,直到又和dongle联系上为止,如果一定次数之后仍然联系不上,那么(就算出了服务区?)IDLE。
As seen here, the keyboard will follow the mouse and the dongle in frequency. The dongle or the mouse will not tell the keyboard that a channel change has taken place. The keyboard will therefore have to run trough its channel table until it finds the dongle, if the mouse and dongle have moved. Since this is a relative rare event, it will not cause any problems for the keyboard user. The benefit is that the keyboard does not need to receive messages from the dongle when it rests in the idle state, and will therefore use minimum of current.
这里可以看到,当鼠标和dongle改变了频道时,键盘并不知道,但它会自己去找dongle。这么做的原因是为了省电,键盘不用接收一个改频道的通知包,可以长时间IDLE。
The dongle uses the DuoCeiver functionality and is able to receive from two different channels simultaneously, one for the mouse and one for the keyboard.
Dongle使用双通道接收数据,一个鼠标一个键盘。
If a packet from the mouse is received, it will enter the Check if mouse is going to sleep state and set a flag if the mouse is going to sleep and clear the flag if it is an ordinary packet from the mouse.
Dongle有一个标志位,标志鼠标是否going to sleep。
If eight milliseconds elapse without receiving any packets from the mouse, the dongle will enter the Check if channel change is allowed state. If the mouse sleeps, the dongle is not allowed to change channel. Also, if the dongle has not had communication with the mouse on the current channel, it is not allowed to change channel. This is done to avoid a “runaway dongle.“
如果鼠标没有Sleep,并且8ms没有收到包,就要执行改频道了。如果dongle has not had communication with the mouse on the current channel(没有接鼠标?),也不能改频道(因为要减少对外干扰?)。

总结:
本文以dongle和无线鼠标,无线键盘为例,以FAP算法实现数据的可靠传输。无线鼠标可以看成是大数据量的,无线键盘可以看成是小数据量的。8ms的发包周期和SLEEP包是这个算法实现的关键。如果用在其他环境下,可以将8ms的时间改大。
蓝牙用的是FHSS,和nRF24XX冲突时会自动避开这个频道,接下来nRF24XX将独占这个频道。WLAN用的DSSS,不会严重干扰nRF24XX,但nRF24XX会在DSSS的频段中产生干扰,不过估计问题不大。
nRF24XX的FAP算法应该说是为了nRF24XX们而准备的。对付一片nRF24XX的最好办法是另一片nRF24XX,当然都要运行FAP。

阿莫论坛20周年了!感谢大家的支持与爱护!!

一只鸟敢站在脆弱的枝条上歇脚,它依仗的不是枝条不会断,而是自己有翅膀,会飞。

出0入0汤圆

 楼主| 发表于 2010-2-22 23:09:13 | 显示全部楼层
回复【楼主位】Taylor1
-----------------------------------------------------------------------

NORDIC为nRF24XX做的通讯协议,有实用价值。
回帖提示: 反政府言论将被立即封锁ID 在按“提交”前,请自问一下:我这样表达会给举报吗,会给自己惹麻烦吗? 另外:尽量不要使用Mark、顶等没有意义的回复。不得大量使用大字体和彩色字。【本论坛不允许直接上传手机拍摄图片,浪费大家下载带宽和论坛服务器空间,请压缩后(图片小于1兆)才上传。压缩方法可以在微信里面发给自己(不要勾选“原图),然后下载,就能得到压缩后的图片】。另外,手机版只能上传图片,要上传附件需要切换到电脑版(不需要使用电脑,手机上切换到电脑版就行,页面底部)。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|Archiver|amobbs.com 阿莫电子技术论坛 ( 粤ICP备2022115958号, 版权所有:东莞阿莫电子贸易商行 创办于2004年 (公安交互式论坛备案:44190002001997 ) )

GMT+8, 2024-5-15 10:48

© Since 2004 www.amobbs.com, 原www.ourdev.cn, 原www.ouravr.com

快速回复 返回顶部 返回列表