RAK2247 mPCIe USB and Siemens IOT2050

Hi, has anyone already managed to install RAK2247 on Siemens IOT2050 or IOT2040?

Does the embedded box run Linux and allow you to build and run arbitrary software? Do you have root access to create udev rules or otherwise change permissions?

If so there’s a fairly decent chance you can build and install the needed software on it.

If not, it’s unlikely to work.

Yes, the Siemens IOT2050 run Linux:
Operating System: Debian GNU/Linux 10 (buster)
Kernel: Linux 4.19.94
Architecture: arm64
Yes I have root access and I can build and install software.
But I don’t know which driver to install and how to check if it works.

You’d basically have to reverse engineer the pi install instructions / scripts.

USB is no longer supported in the upstream packet forwarder so a pointer to that won’t work, you’ll have to go through the pi instructions, understand what they’re accomplishing, and re-create the equivalent in the context of your platform.

This should be possible, but isn’t something for which you’ll find any official support.

How can i find out if RAK2247 works? Is there any command that you can see if receives any data?

Doesn’t sound like you’ve tried to port the software yet (take the pi instructions and adapt what each step in that process is trying to do, to the details of your system)

It’s extremely unlikely to do anything at all until you do.

This isn’t an officially supported host platform, you’re going to have to some real work on your own to get it to work.

I managed to install the driver.
When I go to: /opt/ttn-gateway/packet_forwarder/lora_pkt_fwd
and write sudo ./install.sh I recive samo packets like this:
JSON up: {“rxpk”:[{“tmst”:103698851,“chan”:1,“rfch”:1,“freq”:868.300000,“stat”:1,“modu”:“LORA”,“datr”:“SF7BW125”,“codr”:“4/5”,“lsnr”:9.2,“rssi”:-16,“size”:23,“data”:“AAAAAAAAAAAACYgkMzIKYai6nqMxWak=”}]}`
As far as i understand, they are forwart packet to TTN server but I would like the packets to be read directly from the node-red.
How can I do this? Wich port I havo to listen or where can I pull this data (I don’t wont to send it to TTN server!)

Congratulations, you do indeed have the packet forwarder running. Where it sends data is controlled by the server entry in a file with a name something like local_conf.json or global_conf.json (local overriding global)

You can’t put the data directly into node red however, it first needs to be decrypted and validated by a LoRaWAN network server - a piece of software that understands the LoRaWAN protocol.

Since you say you don’t want to use TTN for that, you’ll need your own network server, probably a copy of chirpstack running in the cloud. In theory you could build that to run locally, too, but it’s likely to be a fairly large porting project, and anyway running it in the cloud is better since then that allows multiple gateways or a damaged/stolen gateway to be replaced with losing or compromising encryyption keys.

Thanks for your answer. How can I now read data from MQTT?

If you’re using chirpstack in the cloud, please see the documentation on the chirpstack site.

If you’re using something else as your LoRaWAN network server, please see the documentation applicable to that.

If you aren’t yet using a LoRaWAN network server, you need to be - this won’t work without one.

Now I see that I have all the time problems to install Lora packet_forwarder (/home/rak_common_for_gateway/lora/packet_forwarder).
How can I install this. When I do:
sudo ./install.sh

I have this errors:

src/loragw_spi.ftdi.c: In function ‘lgw_spi_w’:
src/loragw_spi.ftdi.c:112:40: warning: unused parameter ‘spi_mux_mode’ [-Wunused-parameter]
int lgw_spi_w(void *spi_target,uint8_t spi_mux_mode, uint8_t spi_mux_target, uint8_t address, uint8_t data) {
^~~~
src/loragw_spi.ftdi.c:112:62: warning: unused parameter ‘spi_mux_target’ [-Wunused-parameter]
int lgw_spi_w(void *spi_target,uint8_t spi_mux_mode, uint8_t spi_mux_target, uint8_t address, uint8_t data) {
^~~~~~
src/loragw_spi.ftdi.c: In function ‘lgw_spi_r’:
src/loragw_spi.ftdi.c:146:41: warning: unused parameter ‘spi_mux_mode’ [-Wunused-parameter]
int lgw_spi_r(void *spi_target, uint8_t spi_mux_mode, uint8_t spi_mux_target,uint8_t address, uint8_t *data) {
^~~~
src/loragw_spi.ftdi.c:146:63: warning: unused parameter ‘spi_mux_target’ [-Wunused-parameter]
int lgw_spi_r(void *spi_target, uint8_t spi_mux_mode, uint8_t spi_mux_target,uint8_t address, uint8_t *data) {
^~~~~~
src/loragw_spi.ftdi.c: In function ‘lgw_spi_wb’:
src/loragw_spi.ftdi.c:188:42: warning: unused parameter ‘spi_mux_mode’ [-Wunused-parameter]
int lgw_spi_wb(void *spi_target, uint8_t spi_mux_mode, uint8_t spi_mux_target,uint8_t address, uint8_t *data, uint16_t size) {
^~~~
src/loragw_spi.ftdi.c:188:64: warning: unused parameter ‘spi_mux_target’ [-Wunused-parameter]
int lgw_spi_wb(void *spi_target, uint8_t spi_mux_mode, uint8_t spi_mux_target,uint8_t address, uint8_t *data, uint16_t size) {
^~~~~~
src/loragw_spi.ftdi.c: In function ‘lgw_spi_rb’:
src/loragw_spi.ftdi.c:255:42: warning: unused parameter ‘spi_mux_mode’ [-Wunused-parameter]
int lgw_spi_rb(void *spi_target, uint8_t spi_mux_mode, uint8_t spi_mux_target,uint8_t address, uint8_t *data, uint16_t size) {
^~~~
src/loragw_spi.ftdi.c:255:64: warning: unused parameter ‘spi_mux_target’ [-Wunused-parameter]
int lgw_spi_rb(void spi_target, uint8_t spi_mux_mode, uint8_t spi_mux_target,uint8_t address, uint8_t data, uint16_t size) {
^~~~~~
gcc -c -O2 -Wall -Wextra -std=c99 -Iinc -I. src/loragw_aux.c -o obj/loragw_aux.o
gcc -c -O2 -Wall -Wextra -std=c99 -Iinc -I. src/loragw_radio.c -o obj/loragw_radio.o
gcc -c -O2 -Wall -Wextra -std=c99 -Iinc -I. src/loragw_fpga.c -o obj/loragw_fpga.o
gcc -c -O2 -Wall -Wextra -std=c99 -Iinc -I. src/loragw_lbt.c -o obj/loragw_lbt.o
ar rcs libloragw.a obj/loragw_hal.o obj/loragw_gps.o obj/loragw_reg.o obj/loragw_spi.o obj/loragw_aux.o obj/loragw_radio.o obj/loragw_fpga.o obj/loragw_lbt.o
gcc -O2 -Wall -Wextra -std=c99 -Iinc -I. -L. tst/test_loragw_spi.c -o test_loragw_spi -lloragw -lrt -lmpsse -lm
gcc -O2 -Wall -Wextra -std=c99 -Iinc -I. -L. tst/test_loragw_reg.c -o test_loragw_reg -lloragw -lrt -lmpsse -lm
gcc -O2 -Wall -Wextra -std=c99 -Iinc -I. -L. tst/test_loragw_hal.c -o test_loragw_hal -lloragw -lrt -lmpsse -lm
gcc -O2 -Wall -Wextra -std=c99 -Iinc -I. -L. tst/test_loragw_gps.c -o test_loragw_gps -lloragw -lrt -lmpsse -lm
tst/test_loragw_gps.c: In function ‘main’:
tst/test_loragw_gps.c:201:59: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘ssize_t’ {aka ‘long int’} [-Wformat=]
printf(“WARNING: [gps] read() returned value %d\n”, nb_char);
~^ ~~~~~~~
%ld
gcc -O2 -Wall -Wextra -std=c99 -Iinc -I. -L. tst/test_loragw_cal.c -o test_loragw_cal -lloragw -lrt -lmpsse -lm
make[1]: Leaving directory ‘/home/rak_common_for_gateway/lora/rak2247_usb/lora_gateway/libloragw’
make all -e -C util_pkt_logger
make[1]: Entering directory ‘/home/rak_common_for_gateway/lora/rak2247_usb/lora_gateway/util_pkt_logger’
gcc -c -O2 -Wall -Wextra -std=c99 -Iinc -I. -I…/libloragw/inc src/util_pkt_logger.c -o obj/util_pkt_logger.o
src/util_pkt_logger.c: In function ‘main’:
src/util_pkt_logger.c:489:58: warning: ‘%02i’ directive writing between 2 and 11 bytes into a region of size between 0 and 16 [-Wformat-overflow=]
sprintf(fetch_timestamp,"%04i-%02i-%02i %02i:%02i:%02i.%03liZ",(x->tm_year)+1900,(x->tm_mon)+1,x->tm_mday,x->tm_hour,x->tm_min,x->tm_sec,(fetch_time.tv_nsec)/1000000); /
ISO 8601 format /
^~~~
src/util_pkt_logger.c:489:37: note: directive argument in the range [-9223372036854, 9223372036854]
sprintf(fetch_timestamp,"%04i-%02i-%02i %02i:%02i:%02i.%03liZ",(x->tm_year)+1900,(x->tm_mon)+1,x->tm_mday,x->tm_hour,x->tm_min,x->tm_sec,(fetch_time.tv_nsec)/1000000); /
ISO 8601 format */
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/util_pkt_logger.c:489:13: note: ‘sprintf’ output between 25 and 88 bytes into a destination of size 30
sprintf(fetch_timestamp,"%04i-%02i-%02i %02i:%02i:%02i.%03liZ",(x->tm_year)+1900,(x->tm_mon)+1,x->tm_mday,x->tm_hour,x->tm_min,x->tm_sec,(fetch_time.tv_nsec)/1000000); /
ISO 8601 format */
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gcc -L…/libloragw obj/util_pkt_logger.o obj/parson.o -o util_pkt_logger -lloragw -lrt -lm -lmpsse
make[1]: Leaving directory ‘/home/rak_common_for_gateway/lora/rak2247_usb/lora_gateway/util_pkt_logger’
make all -e -C util_spi_stress
make[1]: Entering directory ‘/home/rak_common_for_gateway/lora/rak2247_usb/lora_gateway/util_spi_stress’
gcc -c -O2 -Wall -Wextra -std=c99 -Iinc -I. -I…/libloragw/inc src/util_spi_stress.c -o obj/util_spi_stress.o
gcc -L…/libloragw obj/util_spi_stress.o -o util_spi_stress -lloragw -lrt -lm -lmpsse
make[1]: Leaving directory ‘/home/rak_common_for_gateway/lora/rak2247_usb/lora_gateway/util_spi_stress’
make all -e -C util_tx_test
make[1]: Entering directory ‘/home/rak_common_for_gateway/lora/rak2247_usb/lora_gateway/util_tx_test’
gcc -c -O2 -Wall -Wextra -std=c99 -Iinc -I. -I…/libloragw/inc src/util_tx_test.c -o obj/util_tx_test.o
gcc -L…/libloragw obj/util_tx_test.o -o util_tx_test -lloragw -lrt -lm -lmpsse
make[1]: Leaving directory ‘/home/rak_common_for_gateway/lora/rak2247_usb/lora_gateway/util_tx_test’
make all -e -C util_lbt_test
make[1]: Entering directory ‘/home/rak_common_for_gateway/lora/rak2247_usb/lora_gateway/util_lbt_test’
gcc -c -O2 -Wall -Wextra -std=c99 -Iinc -I. -I…/libloragw/inc src/util_lbt_test.c -o obj/util_lbt_test.o
gcc -L…/libloragw obj/util_lbt_test.o -o util_lbt_test -lloragw -lrt -lm -lmpsse
make[1]: Leaving directory ‘/home/rak_common_for_gateway/lora/rak2247_usb/lora_gateway/util_lbt_test’
make all -e -C util_tx_continuous
make[1]: Entering directory ‘/home/rak_common_for_gateway/lora/rak2247_usb/lora_gateway/util_tx_continuous’
gcc -c -O2 -Wall -Wextra -std=c99 -Iinc -I. -I…/libloragw/inc src/util_tx_continuous.c -o obj/util_tx_continuous.o
gcc -L…/libloragw obj/util_tx_continuous.o -o util_tx_continuous -lloragw -lrt -lm -lmpsse
make[1]: Leaving directory ‘/home/rak_common_for_gateway/lora/rak2247_usb/lora_gateway/util_tx_continuous’
make all -e -C util_spectral_scan
make[1]: Entering directory ‘/home/rak_common_for_gateway/lora/rak2247_usb/lora_gateway/util_spectral_scan’
make[1]: Nothing to be done for ‘all’.
make[1]: Leaving directory ‘/home/rak_common_for_gateway/lora/rak2247_usb/lora_gateway/util_spectral_scan’
/home/rak_common_for_gateway/lora/rak2247_usb /home/rak_common_for_gateway/lora/rak2247_usb
/home/rak_common_for_gateway/lora/rak2247_usb/packet_forwarder /home/rak_common_for_gateway/lora/rak2247_usb /home/rak_common_for_gateway/lora/rak2247_usb
make all -e -C lora_pkt_fwd
make[1]: Entering directory ‘/home/rak_common_for_gateway/lora/rak2247_usb/packet_forwarder/lora_pkt_fwd’
gcc -c -O2 -Wall -Wextra -std=c99 -Iinc -I. -D VERSION_STRING=""cat ../VERSION"" -I…/…/lora_gateway/libloragw/inc src/lora_pkt_fwd.c -o obj/lora_pkt_fwd.o
src/lora_pkt_fwd.c: In function ‘thread_up’:
src/lora_pkt_fwd.c:1628:105: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 4 has type ‘uint64_t’ {aka ‘long unsigned int’} [-Wformat=]
j = snprintf((char )(buff_up + buff_index), TX_BUFF_SIZE-buff_index, “,“tmms”:%llu”,
~~~^
%lu
pkt_gps_time_ms); /
GPS time in milliseconds since 06.Jan.1980 */
~~~~~~~~~~~~~~~

In file included from src/lora_pkt_fwd.c:50:
src/lora_pkt_fwd.c: In function ‘thread_gps’:
src/lora_pkt_fwd.c:2796:21: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘ssize_t’ {aka ‘long int’} [-Wformat=]
MSG(“WARNING: [gps] read() returned value %d\n”, nb_char);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~
inc/trace.h:27:29: note: in definition of macro ‘MSG’
#define MSG(args…) printf(args) /* message that is destined to the user */

Were any of these actually errors, and not warnings? I’m assuming not, as you ended up with a binary you could run.

Different compilers tend to have different default levels of pickiness, and this is perhaps not the most perfect code ever written, but it does generally work.

Not certain the the automated “install” script is suitable for your environment though, quite likely there are some aspects you’ll need to do by hand.