-
Notifications
You must be signed in to change notification settings - Fork 26
Description
@kersing
Firstly, thanx for nice sw.
However, I had considerable problems getting the Lora gateway running with the multi packet forwarder. A little looking around in the logs with various debugging on, showed the problem was in libloragw, source loragw_radio.c function lgw_setup_sx125x.
It almost always failed to lock the PLL. Fiddling around with different variants of RAK831 reset in the startup.sh didn’t help much either. Also, the displayed version registers were almost always different.
My setup is a Raspberry Pi 3B, with converter board without GPS and the RAK831 board, using Raspbian lite Stretch 4.14.71-v7.
The solution proved to be inserting a delay of 500 ms at the beginning of lgw_setup_sx125x:
/* Get version to identify SX1255/57 silicon revision */
wait_ms(500);
MSG("INFO: SX125x #%d version register returned 0x%02x\n", rf_chain, sx125x_read(rf_chain, 0x07));
and another in the locking loop at the end of lgw_setup_sx125x:
/* start and PLL lock /
do {
if (cpt_attempts >= PLL_LOCK_MAX_ATTEMPTS) {
DEBUG_PRINTF("ERROR: SX125x #%d FAILED TO LOCK PLL\n", rf_chain);
return -1;
}
wait_ms(100);
sx125x_write(rf_chain, 0x00, 1); / enable Xtal oscillator */
After this, it almost always starts with only one attempt to lock the PLL. And the printed version registers are much more stable, too, although still not entirely consistent.
Further tests also proved, that with this modification, it was possible to dispose with the hw reset code in startup.sh. It was only necessary to reset the hw after a Raspi reboot. But better safe than sorry, and keep the reset code in startup.sh.