RPi3 + IC880A-SPI + MP Packet Forwarder = Failed to start concentrator?

It is not a secret, the SPI interface of the RPi3 has some issues and from time to time the MP Packet Forwarder from @kersing is is not too happy and spits out the infamous “failed to start the concentrator” message.

I have now 2 RPi3/IC880A and I was observing different behaviour: one of them could almost never start the Packet Forwarder from the first time, while the other had usually no problem.

The funny thing is that the one having more problem was the one with the frequency locked at 250MHz (core_freq=250)!

So I decided to look more in detail on what was happening with the SPI interface.

The Packet Forwarder set the SPI speed to 8MHz.
By default, the RPi3 runs at 250MHz, but the SPI speed is calculated for the full speed of the processor. When you ask 8MHz, you actually get 8/400*250 = 5MHz!
If the RPi suddenly decides to go in “Turbo” mode to 400MHz, then you get variable SPI Speed, which is why it is recommended to lock the speed at 250MHz with core_freq=250.

But when you have core_freq=250, the SPI speed is set correctly: you ask 8MHz, you get 8MHz.

So to make this long story short: when you ask to get a slower CPU, your SPI speed will be higher! (at least most of the time)

That’s what gave me the idea to run at 250MHz (core_freq=250) but with a SPI speed kept at 5MHz (using the -s option of the Packet Forwarder).
I have now restarted the Packet Forwarder on my gateways dozens of time, without a single error.
So far my conclusion is that 8MHz is to fast to get a stable communication between the RPi3 and the IC880A.

Hope this can help somebody else – if you have “failed to start the concentrator” when you restart the packets forwarder, try to lower the SPI speed.
(I have added a speed parameter on my docker/resin configs)

2 Likes

This also goes for the UART on the Raspberry PI.

This issue is not limited to the MP forwarder. Poly_pkt_fwd and the Semtech reference implementation have the same SPI issue. Last time I check the ‘-s’ solution was unique to MP forwarder, the only way to change the SPI speed for the other two is (was) to change the sources.

1 Like

Absolutely – it is really an RPi3 issue (and most probably also the latest serie of RPi2 as they have changed the chipset for the one of the RPi3).

And indeed the -s is very convenient.

2 Likes

Can you tell me what i must change in src Semtech reference packet_forwarder? I cant find…

Also I was trying to install your implementation of packet-forwarder https://github.com/kersing/packet_forwarder but failed on make command with this error:

make all -e -C mp_pkt_fwd
make[1]: Entering directory ‘/home/pi/pck_fwd/packet_forwarder/mp_pkt_fwd’
Makefile:74: *** [error] Can’t find configuration for SPI phy. Stop.
make[1]: Leaving directory ‘/home/pi/pck_fwd/packet_forwarder/mp_pkt_fwd’
Makefile:11: recipe for target ‘all’ failed
make: *** [all] Error 2

  1. check the LoRaWAN library sources. SPI configuration is in there.
  2. check the RPi build info as you need a lot more sources to build the software, these partly require configuration as well.

You mean from https://github.com/Lora-net/lora_gateway modify this file lora_gateway/libloragw/src/loragw_spi.native.c? Am I right?

I need to use build instructions from build.txt or just simply use build-pi.sh?

Yes, SPI_SPEED is the constant to change.

Build-pi.sh has been used by several people so it should work. Build.txt should have almost identical instructions however it has not been updated in a while so it might contain errors. Of course there is no need to run build-pi.sh, you can just read the contents and perform steps manually and adapt to suit your needs along the way.

Is the forwarders using a symlink ?

I mean ; I’m still running the semtech forwarder , but would like to change to MP.

If i run Build-pi.sh , would it install the new forwarder “on top” of the semtech ?
Making it difficult to do a “fallback” , or is it installing and just replacing a “symlink” ?

TIA
/Bingo

It will create an executable called mp_pkt_fwd, I would be surprised if the Semtech forwarder uses that name.

Ok , thanx

How do i activate the new mp_pkt_fwd , to be used instead of the semtech ?

Sorry for all the “install/activate” questions

/Bingo

Simply start it in stead of the Semtech forwarder. Make sure the config files are in the same folder you start the software in or add -c /directory/with/config to the command line.