RAK811-Trackerboard with mbed & Arduino frameworks

The RAK811 Trackerboard thread i getting quite big.
If you want to add hardware you might want to consider using the Arduino or mbed frameworks.

This guy is working on an Arduino port, https://github.com/stm32duino/Arduino_Core_STM32

Also some people are looking at the mbed framework that recently has added support for the RAK811 board.

However using the mbed framework with OS fills the entire flash and not the basic support for the gps and sensor. I would like to get the people interested in this to write in this thread.

I will do my best to get the GPS and mems sensor working here,

2 Likes

When I compile I get,
Link: RAK811-mbed
Elf2Bin: RAK811-mbed

Total Static RAM memory (data + bss): 3464 bytes
Total Flash memory (text + data): 41070 bytes

Image: ./BUILD/MTB_RAK811/GCC_ARM/RAK811-mbed.bin

I was able to get mbed working with the RAK811 (Trackerboard) without much extra work, following your instructions on your blog (https://nicbkw.com/stmicro-nucleo-disco-l072cz-lrwan1-quickstart-mbed-os/) and reducing the size of the image by turning off RTOS and changing to minimal-printf

Mbed LoRaWANStack initialized 
CONFIRMED message retries : 3 
Adaptive data  rate (ADR) - Enabled 
Connection - In Progress ...
Connection - Successful 
Dummy Sensor Value = %3.1f 
27 bytes scheduled for transmission 
Message Sent to Network Server 

@BoRRoZ as this thread is already getting confusing with the different options for the RAK811, could you split off the mbed question from @OlofAst and reply from @nicbkw above.

2 Likes

Hi @chaolue, good news! I am glad that my post helped you to reduce build size.
Did you use the target MTB_RAK811 and the demo code without change?

I’m starting to study I still do not understand but I will try to understand.

Thank you for share
jojo ballinw

The first compile was with an emply main() function.
Now when I compile I get,

Total Static RAM memory (data + bss): 8716 bytes
Total Flash memory (text + data): 108304 bytes

Image: ./BUILD/MTB_RAK811/GCC_ARM/RAK811-mbed.bin
Not possible to compile with debug info but probably enough.

Yeah thanks,

No changes to main.cpp. Built RAK target.

Adjusted mbedapp.json

  • my TTN details
  • my correct region (lora.phy: 0-8)
  • turned off duty for testing (lora.duty-cycle-on: false)
  • and also reduced the stack size (main_stack_size: 1024) but not sure whether that was important

And as I said above, remove RTOS (https://os.mbed.com/blog/entry/Reducing-memory-usage-by-tuning-RTOS-con/) but without ignoring the events (mbed-os/events/*)

And using minimal-printf - https://github.com/ARMmbed/minimal-printf

This was my first use of mbed-os and I’m reasonably impressed with it. Will wait to see how @OlofAst gets on with it, his git looks promising so far.

1 Like

If anyone was interest in the Arduino port for RAK811… here is the link to it - https://github.com/sabas1080/Arduino_Core_STM32

1 Like

I have added MEMS and GPS support and it seems to work.
I still just send 4 bytes. 00010203 and the data gets through but it sends way too fast and too often. Maybe someone can help me understand the results.

Why does payloadsize vary so much? Why all the zero size downlinks?

app

gateway

It was “lora.duty-cycle-on”: true,
When I set it to false, sending was ok.
However I would have guessed that the lorawan stack should have kept the data rate at a lower level.

I also added a 1306 display. Tomorrow I will add data from the gps.

Really interested on getting https://github.com/ARMmbed/mbed-os-example-lorawan
going on either an mDot or RAK811. The problem I have is that when I set the lora.phy value to 2 (AU915) the compiler gives this error-

Error: Declaration does not declare anything in “extras/mbed-os.lib/features/lorawan/LoRaWANStack.h”, Line: 446, Col: 6 and-
Error: Declaration does not declare anything in “extras/mbed-os.lib/features/lorawan/LoRaWANStack.h”, Line: 446, Col: 6

All other PHY numbers compile fine :frowning:
Because I have an 8 channel gateway I also need to select sub band 2, which the MBed docs don’t seem to mention how to do.

Thats the example I have used.

You should write an issue on their github page.

If you want to fix it yourself.
You can compile with lora.phy = 0 and save the result in one directory then compile with lora.phy=2 and see what defines are missing.
Its probably something easy to fix.

Hello,
I Implemented the GPS function in my example, but it is not working.
I am not sure what is the problem but there does not seem like I get any serial data from the GPS.
If anyone with more experience could look at this, I would be greatful.

Lora OTAA and sending seems to work fine

This code could come handy.

FYI. Now it works.
I think it was that Gps.service(); was not called often enough.
The payload format still needs some fixing.
If you have an 1306 I2C display, checn #define HAS_DISPLAY 1 in main.cpp

Hi,

I just started “playing” more with this module on the mbed OS environment. Has anyone got deepsleep working successfully on it?

Continuing the discussion from RAK811-Trackerboard with mbed & Arduino frameworks:

I ended up creating an issue on github. The cause turned out to be an semicolon typo.
I’m now trying to get the RAK811 to sleep using -

case TX_DONE:
dbg.printf("\r\n Message Sent to Network Server\r\n");
if (MBED_CONF_LORA_DUTY_CYCLE_ON) {
dbg.printf("\r\n Sleeping for %d seconds, sleep allowed %i \r\n",SEND_INTERVAL,sleep_manager_can_deep_sleep());
wait(SEND_INTERVAL);
send_message();

sleep_manager_can_deep_sleep() returns 0, the processor doesn’t sleep.
Is there a better place to stick the wait statement?
Sorry for the borked code formatting.

1 Like