Rak 5010 Board Questions

Issue: Software/Hardware

Details: Hi @nero, I am actually a part of a company which is trying to build a product on top of rak 5010 board and in regards with the same I actually had a few list of questions that I wanted to ask you. All of these questions are of different topics in general but since you told me to try to concentrate all of the questions in one topic, I am doing so:

  1. In the other topic about the sensor data information not being correctly sent and being valued as all 0’s instead of correct sensor data- I spent hours working on the program and following your instructions and looking out what could be wrong and I found out, after spending hours, that the reason why it was sending out 0’s as sensor data values was because I didn’t include the “inner.h” header file in my user_app.c file. After the inclusion of “inner.h” header file in my user_app.c file, now my sensor data values are sent correctly via UDP as I can see on my server. Also you said that your user_app.c code that you sent out me, worked and was sending you the correct sensor data values when you didn’t have the “inner.h” header file in your code. So I was actually wondering as to how the sensor information was displayed correctly magically with the inclusion of “inner.h” file in my user_app.c file and what does that “inner.h” file actually do, and why did your code work even though you didn’t have “inner.h” header file. in your code.

  2. Also regarding the use of external libraries with my source code files. You said that I just need to include the library .a and .h files and then my code would work. However in my user-app.c file when I try to use the library function call, the rui online compiler said that there was undefined reference to my function call even though I had my library header file and library .a file in the zip file of my code files, which was uploaded to the rui online compiler. Attached below is zip file link of the source code files as to what I am talking about for your reference. So my question as a whole is that how do I use external library files with the existing source code files.

https://drive.google.com/file/d/1-4jvXmhdrh2UAIHqsLbVkWeyS1QRSo-K/view?usp=sharing

  1. I was actually working on reading and writing the GPIO pins and was trying to work with the green LED light of the board. I observed some strange behavior when I wrote to the GPIO pin with a low state first and then the high state, the green LED worked fine i.e. it was flashing correctly. However, when I wrote to the GPIO pin with a high state first and then the low state, the LED green light continued to stay high i.e. the green LED light was not flashing and was solid. Also I did a grep search regarding this rui_gpio_rw function and I saw that in all the files where the user is trying to do something with GPIO led lights, the user first sets the state to be low and then to be high. So I wanted to confirm if this behavior of flashing that I observed was correct or incorrect and as to whether we should first set the state of the GPIO to be low and then to high to observe the flashing.

  2. I was actually trying to burn the new 3.0.0.10 rak 5010 version on my board and I was successful in doing so. I then checked through termite, the version of my board and it said RUI Firmware Version was 3.0.0.10. However when I compiled the zip file of my source code files and flashed it to my rak 5010 board and then saw the firmware version- it said that the firmware version was now 3.0.0.9. So I wanted to know why was my firmware version downgraded and how can I solve this problem.

  3. I was actually trying to work with the GPIO pins and I wanted to access the pin which was labelled as GPIO pin 2 with GPIO port as 1. So I wanted to when I am setting up a RUI_GPIO_ST variable how do I set the pin number of the GPIO pin so that I can access GPIO pin 2 with GPIO port 1.

  4. I was also actually trying to work with BLE and I wanted to know how would I be able to switch the BLE off to save power and how would I be able to switch it back on i.e. what are the rui/bg96 commands to turn the BLE off and on.

  5. I was also actually trying to work with timer callback function and I was using the rui_timer_setvalue function and I had a question regarding that. I wanted to know how does that timer value that we set using the rui_timer_setvalue function compare to the physical clock exactly and what is the working behind it.

  6. I also wanted to ask you that in the schematic of the rak5010 board we can see that the RX-TX pins aren’t connected together so when the commands are sent to the RX-TX what is happening in the background? i.e. what/who in the board/UART interface is echoing the debug messages that helps to get the log messages on screen?. And how does that process exactly work.

  7. My final question is that, I wanted to know if there was an rui api enforced command/function to get the rui firmware version of the rak 5010 board.

Thank you for helping and hoping to heard from you soon @nero.

1 Like

Hi, my answer is below:

  1. I copy your sendOK funciton in my app_task.c( it is based on timer) and test OK. Then I move them to your user_app.c. I actually not find it has no inner.h. So this issue is solved.

  2. RUI just support .c and .h upload now. You can add the source code of the .a file. If you must use .a, it needs to modify makefile. But not open for user now.

  3. The Green led is ok. It has nothing to do with the start state. Below is my code:

RUI_TIMER_ST rui_timer;

uint8_t timer_flag=0;

uint8_t state = 0;

void timer_callback(void)

{

timer_flag = 1;

if (state==1)

{

    state = 0;

}

else

{

    state = 1;

}

}

void timer_init()

{

rui_timer.timer_mode = RUI_TIMER_MODE_REPEATED;

rui_timer_init(&rui_timer, timer_callback);

rui_timer_setvalue(&rui_timer, 1000);

rui_timer_start(&rui_timer);

}

RUI_GPIO_ST led;

void main(void)

{

//system init 

rui_sensor_register_callback(sensor_on,sensor_off);

rui_init();

timer_init();

led.pin_num = 12;

led.dir = RUI_GPIO_PIN_DIR_OUTPUT;

led.pull = RUI_GPIO_PIN_NOPULL;

rui_gpio_init(&led);

rui_gpio_rw(RUI_IF_WRITE,&led,&state);

while(1)

{

    if (timer_flag == 1)

    {

        rui_gpio_rw(RUI_IF_WRITE,&led,&state);

        timer_flag = 0;

    }

    rui_running();

}

}

  1. Do you use our old RUI compiler? Last is this:
  1. Nordic pin num is from accumulated. For example, P1.02 is num 34 = 1* 32+ 2

  2. Refer to this API. rui_ble_set_work_mode. But it works after reset. It can’t work immediately.

  3. Timer source is the XTAL and accurate. Do not worry.

  4. The RX and TX is connected to BG96. 52840 has two uart. One for BG96 and another for uart to users from the GPIO on the board pin header.

  5. at+version. More is in

Hi, my answer is below:

  1. I copy your sendOK funciton in my app_task.c( it is based on timer) and test OK. Then I move them to your user_app.c. I actually not find it has no inner.h. So this issue is solved.
  2. RUI just support .c and .h upload now. You can add the source code of the .a file. If you must use .a, it needs to modify makefile. But not open for user now.
  3. The Green led is ok. It has nothing to do with the start state. Below is my code:

RUI_TIMER_ST rui_timer;
uint8_t timer_flag=0;
uint8_t state = 0;
void timer_callback(void)
{
timer_flag = 1;
if (state==1)
{
state = 0;
}
else
{
state = 1;
}
}

void timer_init()
{
rui_timer.timer_mode = RUI_TIMER_MODE_REPEATED;
rui_timer_init(&rui_timer, timer_callback);
rui_timer_setvalue(&rui_timer, 1000);
rui_timer_start(&rui_timer);
}
RUI_GPIO_ST led;

void main(void)
{
//system init
rui_sensor_register_callback(sensor_on,sensor_off);
rui_init();
timer_init();
led.pin_num = 12;
led.dir = RUI_GPIO_PIN_DIR_OUTPUT;
led.pull = RUI_GPIO_PIN_NOPULL;
rui_gpio_init(&led);

rui_gpio_rw(RUI_IF_WRITE,&led,&state);

while(1)
{
if (timer_flag == 1)
{

rui_gpio_rw(RUI_IF_WRITE,&led,&state);
timer_flag = 0;
}
rui_running();

}
}

  1. Do you use our old RUI compiler? Last is this:
    build.rakwireless.com

  2. Nordic pin num is from accumulated. For example, P1.02 is num 34 = 1* 32+ 2

  3. Refer to this API. rui_ble_set_work_mode. But it works after reset. It can’t work immediately.

  4. Timer source is the XTAL and accurate. Do not worry.

  5. The RX and TX is connected to BG96. 52840 has two uart. One for BG96 and another for uart to users from the GPIO on the board pin header.

  6. at+version. More is in
    https://docs.rakwireless.com/Product-Categories/WisTrio/RAK5010/Overview/#product-description

Regards.
Nero

Hey @nero thank you for your response, but I still have questions.

  1. For my first question, I still haven’t gotten an exact answer as to what inner.h exactly does and what is the working behind it?

  2. So for my question (2), does that mean there is no way to use the external libraries?

  3. So for my question (3) does that surely mean that you observed the flashing of the green led even when you set the state as low and then high?

  4. For my question (4)- yes I use the old compiler because I don’t have version 3.0.0.14 available. Can you tell me where I can get 3.0.0.14 version so that I can use the latest compiler.

  5. For my question (6) what would I need to do to switch the BLE off and on using the rui_ble_set_work_mode api

  6. For my question (7) I also wanted to know how does the timer source exactly work?

  7. For my question (8) I wanted to know what part of UART is responsible for echoing the debug messages or the RUI_LOG_PRINTF messages and what is exactly happening?

  8. For my question (9) does that mean there is no RUI API for getting the version of the board? Can rui_cellular_send(“AT+VERSION”) work to get the version of the board?

Hi,
What you mention mostly is not open. If explain ,it will need to expound the structure and more code not open for user. About your project, you should consider to use Arduino on RAK5010.
Then you can see all code include the bsp and source code. And you can change any code or add your own code in it. And install all sensors library to your project.
You can refer to this:

I send you a project on RAK5010 with Arduino to your email.

I forgot to send this yesterday. Because of the update of Adafruit, you should change the uart part like below in variant.h in line 100:

// Arduino Header D0, D1
#define PIN_SERIAL1_RX (33) // P1.01
#define PIN_SERIAL1_TX (34) // P1.02

// Connected to Jlink CDC
#define PIN_SERIAL2_RX (8)
#define PIN_SERIAL2_TX (6)

Hey @nero, actually my management has told me that we cannot use Arduino and we have to use RUI api’s to do tasks. Actually I was wondering if you could provide me the rui firmware version 3.0.0.14 or later so that I can use the latest rui online compiler build.rakwireless.com

Hi, we have received your request. After discussion, we will inform you how to help your case.

Hi @nero , actually I was using your new compiler that now supports the build and compilation of libraries. Actually I created my own libraries and compiled that along with the zip file of the source code files and I got an error which said the below. I have emailed you the zip file of the source code files and the build log of what I get when I compile the zip file.

/usr/share/gcc-arm-none-eabi-7-2018-q2-update/bin/…/lib/gcc/arm-none-eabi/7.3.1/…/…/…/…/arm-none-eabi/bin/ld: error: _build/nrf52_xxaa.out uses VFP register arguments, …/…/RUI/Source/nordic/app/rui_lib_link_test.a(rui_lib_link_test.o) does not
/usr/share/gcc-arm-none-eabi-7-2018-q2-update/bin/…/lib/gcc/arm-none-eabi/7.3.1/…/…/…/…/arm-none-eabi/bin/ld: failed to merge target specific data of file …/…/RUI/Source/nordic/app/rui_lib_link_test.a(rui_lib_link_test.o)
collect2: error: ld returned 1 exit status
…/…/components/toolchain/gcc/Makefile.common:292: recipe for target ‘_build/nrf52_xxaa.out’ failed
make: *** [_build/nrf52_xxaa.out] Error 1