SI4432 偶尔收的到数据 和功率和 距离无关
接收数据:接收数据:
接收数据:
接收数据:1 2 3 4 5 6 7 8
接收数据:
接收数据:
接收数据:
接收数据:
接收数据:
接收数据:
接收数据:
接收数据:
接收数据:
接收数据:
接收数据:
接收数据:
接收数据:
接收数据:
接收数据:
接收数据:
接收数据:1 2 3 4 5 6 7 8
接收数据:
接收数据:
接收数据:
接收数据:
void int_4432(void)
{
//SW reset
SpiWriteRegister(0x07, 0x80); //write 0x80 to the Operating & Function Control1 register
//wait for POR interrupt from the radio (while the nIRQ pin is high)
while ( NIRQ_4432() == 1);
//read interrupt status registers to clear the interrupt flags and release NIRQ pin
ItStatus1 = SpiReadRegister(0x03); //read the Interrupt Status1 register
ItStatus2 = SpiReadRegister(0x04); //read the Interrupt Status2 register
//wait for chip ready interrupt from the radio (while the nIRQ pin is high)
while ( NIRQ_4432()== 1);
//read interrupt status registers to clear the interrupt flags and release NIRQ pin
ItStatus1 = SpiReadRegister(0x03); //read the Interrupt Status1 register
ItStatus2 = SpiReadRegister(0x04);
/*set the physical parameters*/
//write 0x80 to the Nominal Carrier Frequency0 register
SpiWriteRegister(0x75, 0x53); //write 0x75 to the Frequency Band Select register
SpiWriteRegister(0x76, 0x64); //write 0xBB to the Nominal Carrier Frequency1 register
SpiWriteRegister(0x77, 0x00);
//set the desired TX data rate (9.6kbps)
SpiWriteRegister(0x70, 0x0c); //write 0x4E to the TXDataRate 1 register
SpiWriteRegister(0x71, 0x22); //write 0xA5 to the TXDataRate 0 register
SpiWriteRegister(0x72, 0xc0); //write 0x2C to the Modulation Mode Control 1 register
SpiWriteRegister(0x6e, 0x0b); //write 0xA5 to the TXDataRate 0 register
SpiWriteRegister(0x6f, 0x85);
SpiWriteRegister(0x1C,0x88);
SpiWriteRegister(0x1D,0x00);
SpiWriteRegister(0x20,0x0B);
SpiWriteRegister(0x21,0x20);
SpiWriteRegister(0x22,0x7A);
SpiWriteRegister(0x23,0xE1);
SpiWriteRegister(0x24,0x00);
SpiWriteRegister(0x25,0x5E);
SpiWriteRegister(0x2A,0xFF);
SpiWriteRegister(0x2C,0x28);
SpiWriteRegister(0x2D,0x1B);
SpiWriteRegister(0x2E,0x27);
SpiWriteRegister(0x30,0xAC);
SpiWriteRegister(0x32,0x8C);
SpiWriteRegister(0x33,0x02);
SpiWriteRegister(0x34,0x08);
SpiWriteRegister(0x35,0x2A);
SpiWriteRegister(0x36,0x2D);
SpiWriteRegister(0x37,0xD4);
SpiWriteRegister(0x38,0x00);
SpiWriteRegister(0x39,0x00);
SpiWriteRegister(0x3A,0x00);
SpiWriteRegister(0x3B,0x00);
SpiWriteRegister(0x3C,0x00);
SpiWriteRegister(0x3D,0x00);
SpiWriteRegister(0x3E,0x00);
SpiWriteRegister(0x3F,0x00);
SpiWriteRegister(0x40,0x00);
SpiWriteRegister(0x41,0x00);
SpiWriteRegister(0x42,0x00);
SpiWriteRegister(0x43,0xFF);
SpiWriteRegister(0x44,0xFF);
SpiWriteRegister(0x45,0xFF);
SpiWriteRegister(0x46,0xFF);
/*set the GPIO's according to the RF switch */
//SpiWriteRegister(0x0C, 0x12); //write 0x12 to the GPIO1 Configuration(set the TX state)
//SpiWriteRegister(0x0b, 0x15); //write 0x15 to the GPIO2 Configuration(set the RX state)
SpiWriteRegister(0x0C, 0x15); //write 0x15 to the GPIO1 Configuration(set the rX state)
SpiWriteRegister(0x0b, 0x12); //write 0x12 to the GPIO0Configuration(set the tX state)
/*set the non-default Si443x registers*/
//setcap. bank
SpiWriteRegister(0x09, 0xD7); //write 0xD7 to the Crystal Oscillator Load Capacitance register
// Set AGC Override1 Register
SpiWriteRegister(0x69, 0x60); //write 0x60 to the AGC Override1 register
//set tx power 20dbm max
//SpiWriteRegister(0x6d, 0x1f);
SpiWriteRegister(0x6d, 0x18);
/*enable receiver chain*/
SpiWriteRegister(0x07, 0x05); //write 0x05 to the Operating Function Control 1 register
//Enable two interrupts:
// a) one which shows that a valid packet received: 'ipkval'
// b) second shows if the packet received with incorrect CRC: 'icrcerror'
SpiWriteRegister(0x05, 0x03); //write 0x03 to the Interrupt Enable 1 register
SpiWriteRegister(0x06, 0x00); //write 0x00 to the Interrupt Enable 2 register
//read interrupt status registers to release all pending interrupts
ItStatus1 = SpiReadRegister(0x03); //read the Interrupt Status1 register
ItStatus2 = SpiReadRegister(0x04); //read the Interrupt Status2 register
/*enable receiver chain*/
SpiWriteRegister(0x07, 0x05);
SpiWriteRegister(0x0d, 0xf4);
}
设置9.6k45khz频偏
经过几天的摸啊摸,接收部分有问题,另外程序结构上有BUG 接收部分的初始化 接收部分初始化有问题
频率偏了,换晶振试试。
页:
[1]