关于修改cc1310的RF信道频率
请教下在contiki上如何修改cc1310的RF信道频率,例子里默认的是868M,我想改成315M,请问具体应该如何修改。
我之前通过修改smartrf-setting.c里的smartrf_settings_cmd_fs的成员,总是不生效,调用rf_core_send_cmd又总是返回失败,这问题搞了两天了。
还请大神们帮忙看看,最好有个例子,谢谢了!
要改
.centerFreq
.loDivider
.frequency
这几个值我都改了,还是不生效。后来我发现是被prop-mode.c里的set_channel函数给覆盖了
static void
set_channel(uint8_t channel)
{
uint32_t new_freq;
uint16_t freq, frac;
new_freq = DOT_15_4G_CHAN0_FREQUENCY + (channel * DOT_15_4G_CHANNEL_SPACING);
freq = (uint16_t)(new_freq / 1000);
frac = (new_freq - (freq * 1000)) * 65536 / 1000;
PRINTF("set_channel: %u = 0x%04x.0x%04x (%lu)\n", channel, freq, frac,
new_freq);
smartrf_settings_cmd_prop_radio_div_setup.centerFreq = freq;
smartrf_settings_cmd_fs.frequency = freq;
smartrf_settings_cmd_fs.fractFreq = frac;
}
我把上面红色的3行注释掉之后,打开debug标志,再运行,就出现下面的错误
Starting Contiki-3.x-2606-g80e4ca7
With DriverLib v0.44336
TI SmartRF06EB + CC13xx EM
Net: Rime
MAC: CSMA
RDC: nullrdc
set_channel: 25 = 0x013b.0x0000 (868125)
prop_fs: CMD_FS wait, CMDSTA=0x00000001, status=0x0809
on: prop_fs() failed
init: on() failed
prop_fs: CMD_FS wait, CMDSTA=0x00000001, status=0x0809
on: prop_fs() failed
set_channel: 25 = 0x013b.0x0000 (868125)
prop_fs: CMD_FS wait, CMDSTA=0x00000001, status=0x0809
on: prop_fs() failed
set_value: on() failed (2)
还请帮忙再看看,谢谢了!
没有用过contiki,不过如果smartrf setting中的参数会被覆盖不就没有意义了吗,估计应该是在例程中有模式选择可以决定rf参数获取的方式,和easylink可能差不多,看看例程的readme有没有帮助