我用msp-expcc430rf4 开发板, 发现从将数据到通过smpl_send(); 发送,用示波器测得时长200ms。 请问有什么方法可以大大减少这段时间? 还是说可以不用simpliciti,直接用mrfi_radio.c里的函数来发射?
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.
我用msp-expcc430rf4 开发板, 发现从将数据到通过smpl_send(); 发送,用示波器测得时长200ms。 请问有什么方法可以大大减少这段时间? 还是说可以不用simpliciti,直接用mrfi_radio.c里的函数来发射?
貌似没有。 协议是simpliciti。 在建立连接之后 就进入while(1)循环,按一下键发送一次。 在进入transmit();前有许多验证,打包数据的步骤,不知道是不是这个原因?
发送是在主程序的调用了smpl_send,我将原例程注释掉了一些代码, 在while(1)中只留下 msg[0]=1; smpl_send();
另外,我尝试过修改data rate到500kbps, 从smart rf导出 MDMCFG4(2D),MDMCFG3(3B) 。 也试过修改MCSM0 的值来改变校准的模式。 但是修改后就无法通信。
static void linkTo() //linking
{
uint8_t msg[1]; //create a group to save message
//int temperature;
uint8_t misses, done;
/* Keep trying to link... */ //??
while (SMPL_SUCCESS != SMPL_Link(&sLinkID1))
{
SPIN_ABOUT_A_SECOND;
}
/* sleep until button press... */
SMPL_Ioctl( IOCTL_OBJ_RADIO, IOCTL_ACT_RADIO_SLEEP, 0);
RTCPS1CTL |= RT1PSIE;
while (1)
{
/* Send a message when either button pressed */
__bis_SR_register(LPM3_bits + GIE);
// __no_operation();
//if (buttonsPressed & 0x80) // writing message
//{
//msg[0] = MESSAGE_BUTTON_PRESSED; //0xff
//msg[1] = MESSAGE_BUTTON_PRESSED;
//msg[2] = MESSAGE_BUTTON_PRESSED;
//msg[3] = MESSAGE_BUTTON_PRESSED;
//buttonsPressed = 0; //set it back to 0
//}
//else // half a second heart beat
//{
//HalAdcStartRead(); //quit lmp3 after done
//__bis_SR_register(LPM0_bits + GIE);
// HalAdcConvertTempVcc();
msg[0] = 1;
//msg[1] = HalAdcGetVcc();
//temperature = HalAdcGetTempDegF();
//msg[2] = *( (unsigned char*)(&temperature) ) ;
//msg[3] = *((unsigned char*)(&temperature)+1) ;
// }
//sTid++;
//msg[4] = (unsigned char) (sTid>>8);
//msg[5] = (unsigned char) (sTid & 0xFF);
/* get radio ready...awakens in idle state */
SMPL_Ioctl( IOCTL_OBJ_RADIO, IOCTL_ACT_RADIO_AWAKE, 0);
/* Set TID and designate which LED to toggle */
//done = 0;
//while (!done)
// {
//for (misses=0; misses < MISSES_IN_A_ROW; ++misses)
if (SMPL_SUCCESS == SMPL_Send(sLinkID1, msg, sizeof(msg))); //send message
// break;
// if (misses == MISSES_IN_A_ROW)
// {
/* This can only happen if we are supporting Frequency Agility and we
* appear not to have received an acknowledge. Do a scan.
*/
//ioctlScanChan_t scan;
//freqEntry_t freq[NWK_FREQ_TBL_SIZE];
//scan.freq = freq;
// SMPL_Ioctl(IOCTL_OBJ_FREQ, IOCTL_ACT_SCAN, &scan);
/* If we now know the channel (number == 1) change to it. In any case
* try it all again. If we changed channels we should get an ack now.
*/
// if (1 == scan.numChan)
// {
// SMPL_Ioctl(IOCTL_OBJ_FREQ, IOCTL_ACT_SET, freq);
//}
//}
// else
//{
/* Got the ack. We're done. */
//done = 1;
//}
}
/* radio back to sleep */
SMPL_Ioctl( IOCTL_OBJ_RADIO, IOCTL_ACT_RADIO_SLEEP, 0); //special void, manage the i/o
}
//}