RAK4630 and RAK1906 LoRaWAN compilation fails because of region definition

Hi,

i’m new in developing with Wisblock, Arduino and LoRaWAN.
I’m using Arduino-IDE - 2.0.3 and wanted to program the “Environment_Monitoring.ino” to my device. I have made no changes to the code and all libraries and BSP are fresh installed at the newest versions. I’ve read the “README_V2.md” for SX126-Arduino, but i stuck with an compilation issue.
Before i was able to program the device with an example code and it is answering via serial port correctly and shows the measurements from the BME680.

This is the message i get:


In file included from c:\Users[…]\Dokumente\Arduino\libraries\SX126x-Arduino\src/mac/LoRaMacHelper.h:27,
from c:\Users[…]\Dokumente\Arduino\libraries\SX126x-Arduino\src/LoRaWan-Arduino.h:17,
from c:\Users[…]\Dokumente\Arduino\libraries\SX126x-Arduino\src/LoRaWan-RAK4630.h:1,
from C:\Users[…]\yodelnet_Projects\Arduino_IDE_sketch\RAK1906_Environmental_Sensor_onRAK4630_LoRaWAN\RAK1906_Environmental_Sensor_onRAK4630_LoRaWAN.ino:12:
c:\Users[…]\Dokumente\Arduino\libraries\SX126x-Arduino\src/mac/Commissioning.h:40:2: error: #error “SX126x-Arduino V2.0 does support all LoRaWAN regions without definition of 'REGION_XXYYY.\n\nPlease read detailed information how to use it on SX126x-Arduino/README_V2.md at master · beegee-tokyo/SX126x-Arduino · GitHub
40 | #error “SX126x-Arduino V2.0 does support all LoRaWAN regions without definition of 'REGION_XXYYY.\n\nPlease read detailed information how to use it on SX126x-Arduino/README_V2.md at master · beegee-tokyo/SX126x-Arduino · GitHub
| ^~~~~

exit status 1

Compilation error: exit status 1


I wandt to use the Sensor in “EU686”.

Thank you!

Welcome to RAK forum @nicetomeetyou ,

I tried to compile the Environment_Monitoring example from RAKwireless nRF modules BSP version 1.3.3.

It compiles successfully on Arduino 2.0.3.

Do you did any change on the default example? If you can share me the code, I can try to compile it and test.

Hi Carl,

thanks for your quick reply. I have not made any changes to the code, but i wanted to use the RAKwireless RUI nRF BSP and now i think that’s the point.

I followed these (“RAK4630 Module Quick Start Guide | RAKwireless Documentation Center”) instructions and it worked. So i continued to do this - “RAK1906 Quick Start Guide | RAKwireless Documentation Center”. As i see now, there is the BSP mentioned which you named.

If i use this, the code compiles successfully but i can’t program it to the device via USB and get this message:


Failed to upgrade target. Error is: Attempting to use a port that is not open
Traceback (most recent call last):
File “main.py”, line 296, in serial
File “dfu\dfu.py”, line 235, in dfu_send_images
File “dfu\dfu.py”, line 203, in _dfu_send_image
File “dfu\dfu_transport_serial.py”, line 155, in send_init_packet
File “dfu\dfu_transport_serial.py”, line 241, in send_packet
File “serial\serialwin32.py”, line 306, in write
serial.serialutil.PortNotOpenError: Attempting to use a port that is not open

Possible causes:

  • Selected Bootloader version does not match the one on Bluefruit device.
    Please upgrade the Bootloader or select correct version in Tools->Bootloader.
  • Baud rate must be 115200, Flow control must be off.
  • Target is not in DFU mode. Ground DFU pin and RESET and release both to enter DFU mode.

This is the bootloader version from my device:
AT+VER=RUI_3.5.3_RAK4631

I asume, i have to change the bootloader? Thank you for your advise!

Also the Software-Configuration and Example from this (“RAK1906 Quick Start Guide | RAKwireless Documentation Center”) instruction worked fine, but the rest did not.

Hi @nicetomeetyou ,

If you are working with RUI3 firmware, basically that is RAK4631-R and not RAK4631. Those examples won’t work because RUI3 has different set of example code. The two approaches are very different.

If you want to see basic LoRaWAN example for RAK4631-R, the best example will be the Smart_Farm. It also uses RAK libraries.

We have a complete step-by-step guide how to run that example in our documentation center -

If you want an external sensor library (not RAK), I created a working example here that works with sparkfun library RUI3-LoRaWAN-sample. This is for RAK1901 though but you can have an idea how to use the same approach with RAK1906.

Hi @carlrowan,

thank you for your inputs! I will study and test the options you have given me and will give a feedback here.

Have a nice christmas time!

Hi @carlrowan,

when i bought the core i was not aware of the different versions and i updated the firmware following these instructions - Device Firmware Upgrade | RAKwireless Documentation Center and it worked.
My question is - are the 4631 and 4631-R different hardware, or can the firmware be changed in each case.
I guess it doesn’t matter much for my first steps, but I haven’t quite figured it out yet.
Thank you.

Hi @nicetomeetyou ,

RAK4631 and RAK4631-R are WisBlock Cores with common hardware which are based on RAK4630 LoRa module. The difference they have are the firmware. You can change the firmware back and forth also by following the guide on the link you shared above.

Hi,
that’s what I thought - thank you. It’s strange that I can’t get back to the 4631 firmware. I can repeatedly install the 4631-R firmware without any problems.
I tried it this way - Bootloader Fails to upgrade via BLE - #3 by beegee

By the way, the smart farm example with the RAK1906 now works. Thanks for the great help!

Hello again - unfortunately not everything works after all.
I want to connect the device to a TTN server. The APP KEY I get generated from the server looks like this:

NNSXS.U4XU3NKEMVQNDWXYOQ2D5BO356SOFB2RUY345II.3ZQ2MPACGZJ3E3OPEISZ2FLAUZUQNSNLI5I2QL4ESCW2O4VXDTLA

I have no idea how to store this in the code. Surely this should be a 16-byte key?

Thanks for your patience.

I think you are looking in the wrong direction. The APPKEY is here

I have also just found it - it is working - thanks!!

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.