当前位置: 首页 > 工具软件 > rate.sx > 使用案例 >

imx6ull调试sx1268 lora调试记录

谷梁嘉悦
2023-12-01

1、sx1268原厂只有基于单片机的参考代码:https://github.com/Lora-net/LoRaMac-node

2、如果基于linux平台使用,可以使用 github上sx1268代码

https://github.com/YukiWorkshop

https://github.com/YukiWorkshop/sx126x_linux_driver

需要Linux4.8以上才能使用。

3、调试过程供电和晶振都会影响到DIO的输出,需要测试各种电源和晶振。

4、可以通过测试用例先测试下spi读写是否是否ok。(注意cs引脚需要另外选择)

	printf("chipid=0x%x\n",Radio.ReadReg(0x0740));
	Radio.WriteReg(0x0740,0x34);
	printf("chipid=0x%x\n",Radio.ReadReg(0x0740));
	
	printf("chipid=0x%x\n",Radio.ReadReg(0x0741));
	Radio.WriteReg(0x0741,0x44);
	printf("chipid=0x%x\n",Radio.ReadReg(0x0741));

5、可以通过/sys/class/gpio来测试busy, nrst, nss, dio,这几个引脚是否ok?

//	struct PinConfig {
	//	int16_t busy = -1, nrst = -1, nss = -1, dio1 = -1, dio2 = -1, dio3 = -1;
	//	int16_t tx_en = -1, rx_en = -1;
	//};
echo 7 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio7/direction
echo 1 > /sys/class/gpio/gpio7/value

如下:

	SX126x_Linux Radio("/dev/spidev2.0", 0,
			   {
				   5, 6, 4,
				   3, -1,-1,
				   2, -1
			   }
	);

 

6、以上都ok后,如果发送成功,可以收到Wow RX done,如果没收到,需要两下DIO1引脚(DIO是默认低电平,cpu端也需要设置为默认低电平)

7、即为发送ok,在通过另外一个设置设置为接受,即lora初步调试ok

8、如果需要与其他lora模块通信,即使bw cr  ,sf都一致,也可以收到其他厂家的lora数据,但是数据被处理了,数据不对。

 

SFBWCode RateData Rate(bps) SFBWCode RateData Rate(bps) SFBWCode RateData Rate(bps)
51250000.800015625.00 52500000.800031250.00 55000000.800062500.00
61250000.80009375.00 62500000.800018750.00 65000000.800037500.00
71250000.80005468.75 72500000.800010937.50 75000000.800021875.00
81250000.80003125.00 82500000.80006250.00 85000000.800012500.00
91250000.80001757.81 92500000.80003515.63 95000000.80007031.25
101250000.8000976.56 102500000.80001953.13 105000000.80003906.25
111250000.8000537.11 112500000.80001074.22 115000000.80002148.44
121250000.8000292.97 122500000.8000585.94 125000000.80001171.88
              
SFBWCode RateData Rate(bps) SFBWCode RateData Rate(bps) SFBWCode RateData Rate(bps)
51250000.666713020.83 52500000.666726041.67 55000000.666752083.33
61250000.66677812.50 62500000.666715625.00 65000000.666731250.00
71250000.66674557.29 72500000.66679114.58 75000000.666718229.17
81250000.66672604.17 82500000.66675208.33 85000000.666710416.67
91250000.66671464.84 92500000.66672929.69 95000000.66675859.38
101250000.6667813.80 102500000.66671627.60 105000000.66673255.21
111250000.6667447.59 112500000.6667895.18 115000000.66671790.36
121250000.6667244.14 122500000.6667488.28 125000000.6667976.56
              
SFBWCode RateData Rate(bps) SFBWCode RateData Rate(bps) SFBWCode RateData Rate(bps)
51250000.571411160.71 52500000.571422321.43 55000000.571444642.86
61250000.57146696.43 62500000.571413392.86 65000000.571426785.71
71250000.57143906.25 72500000.57147812.50 75000000.571415625.00
81250000.57142232.14 82500000.57144464.29 85000000.57148928.57
91250000.57141255.58 92500000.57142511.16 95000000.57145022.32
101250000.5714697.54 102500000.57141395.09 105000000.57142790.18
111250000.5714383.65 112500000.5714767.30 115000000.57141534.60
121250000.5714209.26 122500000.5714418.53 125000000.5714837.05
              
SFBWCode RateData Rate(bps) SFBWCode RateData Rate(bps) SFBWCode RateData Rate(bps)
51250000.50009765.63 52500000.500019531.25 55000000.500039062.50
61250000.50005859.38 62500000.500011718.75 65000000.500023437.50
71250000.50003417.97 72500000.50006835.94 75000000.500013671.88
81250000.50001953.13 82500000.50003906.25 85000000.50007812.50
91250000.50001098.63 92500000.50002197.27 95000000.50004394.53
101250000.5000610.35 102500000.50001220.70 105000000.50002441.41
111250000.5000335.69 112500000.5000671.39 115000000.50001342.77
121250000.5000183.11 122500000.5000366.21 125000000.5000732.42

 

 

 

 

 类似资料: