初级会员
- 积分
- 64
- 金钱
- 64
- 注册时间
- 2019-11-7
- 在线时间
- 38 小时
|
30金钱
- void radio_Init(void)
- {
- #ifdef USART_DEBUG
- #ifdef RADIO_DEBUG
- printf("%s \r\n",__FUNCTION__);
- #endif
- #endif
- sx126x_HwInit();
-
- sx126x_Reset();
-
- sx126x_SetStandby(STDBY_RC);
- #if 1
- sx126x_SetDIO3AsTCXOCtrl(DIO3_1V7,0xFF);
-
- sx126x_Calibrate(0x7f);//Calibrate all
-
- //sx126x_SetStandby(STDBY_XOSC);
- #endif
- sx126x_SetPacketType(PACKET_TYPE_LORA);
- printf("%x\r\n",sx126x_ReadRegisterByte(SyncWordMSB));
- printf("%x\r\n",sx126x_ReadRegisterByte(SyncWordLSB));
- printf("begin\r\n");
- #ifdef USE_CONFIG_PUBLIC_NETOWRK
- // Change LoRa modem Sync Word for Public Networks
-
- sx126x_WriteRegisterByte(SyncWordMSB,0x34);
- sx126x_WriteRegisterByte(SyncWordLSB,0x44);
- #else
- // Change LoRa modem SyncWord for Private Networks
- sx126x_WriteRegisterByte(SyncWordMSB,0x14);
- sx126x_WriteRegisterByte(SyncWordLSB,0x24);
- #endif
- printf("%x\r\n",sx126x_ReadRegisterByte(SyncWordMSB));
- printf("%x\r\n",sx126x_ReadRegisterByte(SyncWordLSB));
- printf("end\r\n");
-
-
- sx126x_SetRfFrequency(RF_FREQUENCY);
- sx126x_CalibrateImage(RF_FREQUENCY);
- sx126x_SetTxParams(dBm22_P,SET_RAMP_200U);
-
- sx126x_SetPacketParams(radio.packet_params_lora);
-
- sx126x_SetBufferBaseAddress(TX_BUFFER_BASE,RX_BUFFER_BASE);
-
- sx126x_SetModulationParams(radio.modulation_params);
-
- sx126x_SetDioIrqParams(radio.irq_mask,radio.irq_mask,0x000,0x000);//IRQ_TX_DONE|RX_DONE|IRQ_TIMEOUT
-
- sx126x_SetPaConfig(radio.pa_optimal_setting);
- //sx126x_SetDIO2AsRfSwitchCtrl(0x1);
- //radio_StartRx();
- }
复制代码
|
最佳答案
查看完整内容[请看2#楼]
已解决,具体操作如下把57行设置指令放到前面执行,不然会是用默认的pa参数,还有一个原因是我网上下的这个驱动setpaconfig指令弄错误了,现在rssi在-45左右 初步判断调通
|