1、cc1101 运行一段时间后,GDO0触发不了接收中断,导致cc1101死机。当用导线触碰GDO0引脚后,接收恢复正常。
2、cc1101 运行一段时间后,通讯距离变短。
hea hea:
mcu采取GDO0中断接收数据的方式,寄存器配置如下
const registerSetting_t preferredSettings_1200bps[]=
{{IOCFG0, 0x06},{PKTCTRL0, 0x05},{FSCTRL1, 0x06},{ADDR,0x01},{PKTCTRL1,0x05},{PKTLEN, 0x1f},{FREQ2,0x10},{FREQ1,0xaa},{FREQ0,0x1e},{MDMCFG4, 0xf5},{MDMCFG3, 0x83},{MDMCFG2, 0x13},{DEVIATN, 0x15},{AGCCTRL2, 0x07},{AGCCTRL1, 0x40},{MCSM0,0x18},{FOCCFG, 0x16},{WORCTRL, 0xFB},{FSCAL3, 0xE9},{FSCAL2, 0x2A},{FSCAL1, 0x00},{FSCAL0, 0x1F},{TEST0,0x09},{PATABLE, 0xCB}
};cc1101_gdo0_rx_it在gpio的中断处理中被调用
static void cc1101_gdo0_rx_it(void)
{unsigned char rx_buf[MAX_FIFO_SIZE], rx_count;int ret, i;rx_count = MAX_FIFO_SIZE;ret = cc1101_receive_packet(rx_buf, &rx_count);
cc1101_set_rx_mode();if(ret == 0){for(i = 0; i < rx_count; i++){rf_dev.rx_buf[rf_dev.rx_wr++] = rx_buf[i];rf_dev.rx_wr %= RX_BUF_SIZE;/* overflow handle */if(rf_dev.rx_wr == rf_dev.rx_rd){rf_dev.rx_rd++;rf_dev.rx_rd %= RX_BUF_SIZE;}}cc1101_crash_cnt=0;rt_kprintf("cc1101 receive data<%d>:",rx_count);//cc1101_hex_printf(rx_buf, rx_count);rt_kprintf("\r\n");rt_sem_release(&(cc1101_rx_sem));}
}
static int cc1101_receive_packet(unsigned char *buf, unsigned char *count)
{ int i;rt_uint8_t tmp[128];unsigned char packet_len, status[2];trx8BitRegAccess(RADIO_READ_ACCESS|RADIO_SINGLE_ACCESS, RXBYTES, &packet_len, 1);rt_kprintf("packet len1 is %x\r\n",packet_len);if((packet_len & 0x7f) == 0){if (packet_len & 0x80)trx8BitRegAccess(RADIO_READ_ACCESS|RADIO_BURST_ACCESS, RXFIFO, tmp, 128);return -1;}//packet_len = cc1101_read_signle_reg(RF_RXFIFO);trx8BitRegAccess(RADIO_READ_ACCESS|RADIO_SINGLE_ACCESS, RXFIFO, &packet_len, 1);rt_kprintf("packet len2 is %d %d\r\n",packet_len, *count);if(packet_len <= *count){//cc1101_read_burst_reg(RF_RXFIFO, buf, packet_len);//cc1101_read_burst_reg(RF_RXFIFO, status, 2);trx8BitRegAccess(RADIO_READ_ACCESS|RADIO_BURST_ACCESS, RXFIFO, buf, packet_len);*count = packet_len;trx8BitRegAccess(RADIO_READ_ACCESS|RADIO_BURST_ACCESS, RXFIFO, status, 2);//rt_kprintf("status %x %x \r\n",status[0],status[1]);//trx8BitRegAccess(RADIO_READ_ACCESS | RADIO_BURST_ACCESS, RSSI, &status[0], 1);//trx8BitRegAccess(RADIO_READ_ACCESS | RADIO_BURST_ACCESS, LQI, &status[1], 1);rt_kprintf("status %x %x \r\n",status[0],status[1]);//*count = packet_len;r_signal = status[0];return ((status[1] & 0x80) ? 0 : -2);}else{trx8BitRegAccess(RADIO_READ_ACCESS|RADIO_BURST_ACCESS, RXFIFO, tmp, 128);cc1101_set_rx_mode();return -3;}
}
static void cc1101_set_rx_mode(void)
{
trxSpiCmdStrobe(RF_SFRX);trxSpiCmdStrobe(RF_SIDLE);trxSpiCmdStrobe(RF_SRX);rf_dev.mode = MODE_RX;
}
hea hea:
麻烦各位看下是哪的问题
Viki Shi:
1、看描述跟软件关系不大,建议排查下硬件线路的问题
2、用例程跑过吗?测试一下看看
hea hea:
回复 Viki Shi:
这是我们的硬件电路,做成了模块然后焊到板子上面直接连接在单片机上了,在硬件板子设计方面是不是还有什么样的要求呢
Viki Shi:
硬件电路建议参考我们提供的设计方案,确保RF性能达到最佳: www.ti.com.cn/…/toolssoftware
hea hea:
回复 Viki Shi:
我仔细看了下你们的手册跟设计方案,发现关于晶振的负载电容有几个说法,参考哪个比较好呢?
hea hea:
回复 Viki Shi:
我看你们文档关于晶振负载电容的值有不同的地方,我们应该参考哪个比较好呢