This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
请问怎样使用csp实现CSMA? 在zigbee协议栈中,是通过下面的代码去实现,但是我移植出来后使用不了?
还有里面 的mac定时器2的 事件是怎么理解的 RFST = WEVENT1;
mac定时器2是需要怎样的初始化以及中断函数里面该处理什么?
是需要mac定时器2中的中断函数里面做什么设置之类的么?
还有里面的随机数值产生器需要进行怎样初始化以及怎样使用?
是否有csma的相关demo可以学习下?
void macCspTxPrepCsmaUnslotted(void)
{
cspPrepForTxProgram();
/*----------------------------------------------------------------------
* Load CSP program : Unslotted CSMA transmit
*/
/*
* Wait for X number of backoffs, then wait for intra-backoff count
* to reach value set for WEVENT1.
*/
RFST = WAITX;
RFST = WEVENT1;
/* wait for one backoff to guarantee receiver has been on at least that long */
RFST = WAITW(1);
RFST = WEVENT1;
/* sample CCA, if it fails exit from here, CSPZ indicates result */
RFST = SKIP(1, C_CCA_IS_VALID);
RFST = SSTOP;
/* CSMA has passed so transmit (actual frame starts one backoff from when strobe is sent) */
RFST = STXON;
/*
* Wait for the start of frame delimiter of the transmitted frame. If SFD happens to
* already be active when STXON is strobed, it gets forced low. How long this takes
* though, is not certain. For bulletproof operation, the first step is to wait
* until SFD is inactive (which should be very fast if even necessary), and then wait
* for it to go active.
*/
RFST = WHILE(C_SFD_IS_ACTIVE);
RFST = WHILE(C_SFD_IS_INACTIVE);
/*
* Record the timestamp. The INT instruction causes an interrupt to fire.
* The ISR for this interrupt records the timestamp (which was just captured
* when SFD went high).
*/
RFST = INT;
/*
* Wait for SFD to go inactive which is the end of transmit. Decrement CSPZ to indicate
* the transmit was successful.
*/
RFST = WHILE(C_SFD_IS_ACTIVE);
RFST = DECZ;
/*
* CC2530 requires SSTOP to generate CSP_STOP interrupt.
*/
RFST = SSTOP;
而且SimpliciTI协议 里面好像也没涉及到timer2 MAC定时器的, 我看cc2530的用户手册里面介绍的csma,是有用到timer2的,是这样的么?