@BoRRoZ, I understand the problem comes from the SPI bus is not running at the expected 8MHz even though the #define SPI_SPEED 8000000 instruction was issued. This is caused by the variable VPU clock rate in the Pi3. As the VPU changes frequency the SPI speed changes. At the RP3 default VPU clock rate you correct by setting the SPI for 5MHz to obtain the required 8 MHz SPI speed. I also understand even with this correction the VPU can still change speed and the connection to the Lora chips stops working and a different correction factor is required. I went about this a different way, rather trying to account for this error I locked the VPU frequency by adding the line “core_freq=250” to /boot/config.txt By doing this the #define SPI_SPEED 8000000 instruction has the correct effect and sets the SPI speed to 8MHz.
it worked in my RP3B+ gateway with a RAK831
(some more detail I found. The VPU can switch from 250MHz to 400MHz in Turbo mode and will drop back under some conditions. The SPI clock rate is linked to the VPU frequency and as it steps up to 400MHz the SPI speed increases. Hence setting SPI to 8MHz means its actually running at 12.8MHz when the VPU is in Turbo mode, so setting it to 5MHz means its actually running at 8MHz (5MHz * 400/250 = 8MHz). The core_freq=250 instructions stops the VPU going into Turbo mode and the SPI speed is then set as expected)