Hi team, I am using the CC1310 RTOS this code is in a while(1),I found that it's consuming time is about 180ms(approxiately),is the consuming time in this while(1) correct 50kbps rfpacketTX?and then I noticed that the current also seems to be relatively high than CC1310 datasheet explained.
/* 待机定时10秒 */ sleepTickCount = 1000000 / Clock_tickPeriod; //UART_write(uart,&by, 1); while(1){ ledPinHandle = PIN_open(&ledPinState, pinTable); // IOCPinTypeGpioOutput(0x1); ADC_init(); ADC_Handle adc; ADC_Params params; int_fast16_t res; ADC_Params_init(¶ms); adc = ADC_open(CC1310_LAUNCHXL_ADC7 , ¶ms); if (adc == NULL) { while (1); } /* Blocking mode conversion */ res = ADC_convert(adc, &adcValue0); packet[4]=adcValue0 & 0xFF; packet[5]=adcValue0; if (res == ADC_STATUS_SUCCESS) { adcValue0MicroVolt = ADC_convertRawToMicroVolts(adc, adcValue0); packet[0] =(adcValue0MicroVolt >> 24) & 0xFF; // 获取高8位 packet[1] =(adcValue0MicroVolt >> 16) & 0xFF; // 获取次高8位 packet[2]= (adcValue0MicroVolt >> 8) & 0xFF; // 获取次低8位 packet[3] = adcValue0MicroVolt & 0xFF; // UART_write(uart,&byte, 4); double X= (double)adcValue0MicroVolt; // 将 adcValue0MicroVolt 转换为 double 类型的变量 number uint16_t integer_part; calculate_R(X, &integer_part); double ln_R = log(integer_part); // 计算ln(R) double result=3950/(ln_R+4.038); result= result-273.15; uint8_t xx=(uint8_t)result;//取整 double erWithTwoDecimals = result * 100; // 将原始数乘以 100,以保留两位小数 uint16_t xy = (uint16_t)erWithTwoDecimals; uint8_t de = xy % 100; packet[4]=xx; packet[5]=de; packet[6]=1; // sprintf("%d",packet[6]); packet[7]=1; //UART_write(uart,&packet, 8); // sprintf(byte[0],"%d",30); // UART_write(uart,&byte, 1); // sprintf(ascii_array[0],"%d",packet[6]); // UART_write(uart,&ascii_array, 1); } // Task_sleep(sleepTickCount); ADC_close(adc); PIN_close(ledPinHandle); ledPinHandle = PIN_open(&ledPinState, shutTable); // PIN_setOutputValue(ledPinHandle, CC1310_LAUNCHXL_PIN_RLED , !PIN_getOutputValue(CC1310_LAUNCHXL_PIN_RLED )); // usleep(10000); // PIN_setOutputValue(ledPinHandle, CC1310_LAUNCHXL_PIN_RLED , !PIN_getOutputValue(CC1310_LAUNCHXL_PIN_RLED )); // UART_write(uart, &input, 2); // AONBatMonDisable (); /* Request access to the radio */ #if defined(DeviceFamily_CC26X0R2) rfHandle = RF_open(&rfObject, &RF_prop, (RF_RadioSetup*)&RF_cmdPropRadioSetup, &rfParams); #else rfHandle = RF_open(&rfObject, &RF_prop, (RF_RadioSetup*)&RF_cmdPropRadioDivSetup, &rfParams); #endif// DeviceFamily_CC26X0R2 // RF_cmdPropRadioDivSetup.txPower=0x913F; //设置频率 RF_CmdHandle txTestHnle=RF_postCmd(rfHandle, (RF_Op*)&RF_cmdFs, RF_PriorityNormal, NULL, 0); /* Create packet with incrementing sequence number and random payload */ // packet[0] = input[0]; uint8_t i; for (i = 7; i < PAYLOAD_LENGTH; i++) { packet[i] = 1; } xor_encrypt_decrypt(packet, key, PAYLOAD_LENGTH); /* Send packet */ RF_EventMask terminationReason = RF_runCmd(rfHandle, (RF_Op*)&RF_cmdPropTx, RF_PriorityNormal, NULL, 0);//stuck on this step // switch(terminationReason) // { // case RF_EventLastCmdDone: // // A stand-alone radio operation command or the last radio // // operation command in a chain finished. // break; // case RF_EventCmdCancelled: // // Command cancelled before it was started; it can be caused // // by RF_cancelCmd() or RF_flushCmd(). // break; // case RF_EventCmdAborted: // // Abrupt command termination caused by RF_cancelCmd() or // // RF_flushCmd(). // break; // case RF_EventCmdStopped: // // Graceful command termination caused by RF_cancelCmd() or // // RF_flushCmd(). // break; // default: // // Uncaught error event // while(1); // } // // uint32_t cmdStatus = ((volatile RF_Op*)&RF_cmdPropTx)->status; // switch(cmdStatus) // { // case PROP_DONE_OK: // // 传输包成功 // break; // case PROP_DONE_STOPPED: // // received CMD_STOP while transmitting packet and finished // // transmitting packet // break; // case PROP_DONE_ABORT: // // Received CMD_ABORT while transmitting packet // break; // case PROP_ERROR_PAR: // // Observed illegal parameter // break; // case PROP_ERROR_NO_SETUP: // // Command sent without setting up the radio in a supported // // mode using CMD_PROP_RADIO_SETUP or CMD_RADIO_SETUP // break; // case PROP_ERROR_NO_FS: // // Command sent without the synthesizer being programmed // break; // case PROP_ERROR_TXUNF: // // TX underflow observed during operation // break; // default: // // Uncaught error event - these could come from the // // pool of states defined in rf_mailbox.h // while(1); // } #ifndef POWER_MEASUREMENT // PIN_setOutputValue(ledPinHandle, Board_PIN_LED1,!PIN_getOutputValue(Board_PIN_LED1)); #endif /* Power down the radio */ RF_yield(rfHandle); #ifdef POWER_MEASUREMENT /* Sleep for PACKET_INTERVAL s */ sleep(PACKET_INTERVAL); #else /* Sleep for PACKET_INTERVAL us */ usleep(PACKET_INTERVAL); #endif RF_cancelCmd(rfHandle,txTestHnle,0); // RF_flushCmd (rfHandle,txTestHnle,1); //擦除 RF_yield(rfHandle); //断电 RF_close(rfHandle); PIN_close(ledPinHandle); Task_sleep(sleepTickCount); }