Firmware Development

Hi Team,
I just bought RAK7249 and RAK7258.
Before I ordered them I used raspberry pi with RoLa comm module as a gateway. And I developed a ubuntu console program that runs in raspberry pi, receives data from RoLa clients, parses data sends data to external server.

Now I want to move those code to my new RAK gateway. How can I make a program and run it just like a built-in firmware?


They both run OpenWRT, a variation of Linux aimed at routers, so it should have a lot of similarity with the Raspberry Pi.

Because the way that OpenWRT organises the file system with some parts of it protected as read-only, you may want to learn the basics of OpenWRT development before diving in to your project too hard.

Thanks. Is there any good examples or guides for me to follow up to make and install openWrt for RAK7258?

Not sure, not something I personally do - what have you found using Ms Google - she can be very helpful.

Essentially you need a cross toolchain for OpenWRT 15.05 on the MT76x8.

One way to get one is to find the repo for the preceding “wislora” development kit and build that… it will take a few hours.

Then you can use generic OpenWRT instructions for setting sysroot etc and cross compiling.

Once you have an appropriate executable you can just copy it onto the box, it will end up in the overlay filesystem rather than the underlying squashfs, but it will look like it’s an ordinary part of things.

Or you can build your custom code as part of a full system image build from the wislora stuff.

Beware that unlike the upstream Mediatek version, RAK’s U-Boot doesn’t have the ability to flash a rescue image via USB, if you mess up, you’ll need to set up a TFTP server over wired Ethernet to put a good image back on.

Thanks for your reply.
Honestly, it seems like hard to follow the instruction. And I’m not sure if I can make it.
If I manage to upload openWrt to the 7258 device, how can I get LoRa data from my code?
Is there a s/w library that I can use any API from?

What is the common way for gateway to receive data from clients and send those data to other private server?
I have no idea how to use this gateway device? (by the way, I’ve bought 1 7249 and 2 7258 gateway)
Checking data through TTN doesn’t mean anything. I have to connect to my private server. But I just don’t have many options.

First, before you write any code you need to really understand how LoRaWAN networks work.

It’s not really clear why you want to run custom code on the gateway at all.

More typically, you would point the gateway at a LoRaWAN network server running in the cloud (eg, TTN, a hosted instance of Chirpstack, and instance of Chirpstack you set up, etc…)

Your custom data-consuming code would also be running in the cloud (or temporarily on your development PC) and interacting with the server in the cloud. Note that even if you use TTN as the server, you can still get the resulting data to your own cloud consumer by a variety of means.

Building code to run on OpenWRT is possible but painful. As a result, it doesn’t make sense to do so unless it is really necessary that the code run on the gateway and not elsewhere - which is really not how LoRaWAN is designed to work. LoRaWAN is designed to use the collective view of nodes acheived by uplinks reported in from multiple gateways, something that can really only be leveraged when the code that handles the network runs in the cloud and not an individual gateway.

So in a “real” LoRaWAN network, the only reason for code to run on a gateway is if that code has the purpose of managing or implementing the gateway functionality; any “network” or “data” code should be running elsewhere.

Even if you were going to build a small, isolated network somewhere off in a remote part of the world with no connection to anything else, you’d probably find things worked better if you added your own embedded computer to host the data-related tasks. Once you are very sure what you want, then porting python code (with limited dependencies) or C code to the gateway itself is technically possible, but it’s not a good place to start a learning project.

Another way of putting it: What exactly did you do on the previous pi? What sort of radio was involved (what is a “RoLa comm module”???) and how did you get data from it? The RAK7258 uses an ordinary SPI-interfaced LoRaWAN concentrator card, using what is basically the ordinary code for running that, but it’s not clear at all that your previous setup did.

Oh, is there a way getting data from TTN to my cloud server (ex: aws, firebase)?
If that is possible using openWrt is not necessary as I mentioned.

Of course, it wouldn’t be useful for much otherwise.

Look at MQTT or the various data integrations

One more question.
If I use RAK7244 LPWAN Developer Gateway then can I make my console app and start it on boot (register in start app)? It has a rasp pi board and raspbian OS.
If I am able to make and build my console program, how can I send and receive LoRa data with connected clients?

If you run ChirpStack on the device, you can then access the data feed from it from your app.

Please explain what you mean by this - are the devices in question LoRaWAN nodes, or do they immplement some simpler / custom scheme on top of LoRa?

What exactly was the radio you were using before, and how did your software interact with it?

Both the RAK7258 and the pi gateways behave the way LoRaWAN gateways are expected to, but it starts to sound like you might be used to working with something other than LoRaWAN.

Those are LoRAWAN devices. I used SX1276 shield with Arduino as a client node, same shield with Raspberry PI (UART connection to each other) as a gateway.
In gateway side I run a console program, when the RoLa data is received from clients it sends to rasp then I send it to was server by rest api.

Now I’m looking into TTN application. I can do something with it.

Before that, now I’m setting up the 7258 gateway following the guide ( . I can’t find SCAN button on wi-fi page. Maybe the firmware version is different.


Any one can help about how to configure RAK5146 with any openWRT based lorawan gateway!