RUI: How to set RUI_I2C_ST - I2C_REG_MAGIC

Hi,@oleksander
The above post ends with a link to a reference:https://doc.rakwireless.com/rak811-wisnode-lora-module/upgrading-the-firmware


tools here:https://downloads.rakwireless.com/en/LoRa/RAK612-LoRaButton/Tools/
Burning bootloader guide:https://doc.rakwireless.com/rak811-wisnode-lora-module/burning-the-bootloader-into-the-device

I have rak811 breakout board, then i do this:qVaOTeklHt

2 step:
i go to https://downloads.rakwireless.com/en/LoRa/RAK811-BreakoutBoard/Firmware/

then i see:

8DVNyJ8GO3

3 step:
I must first download RUI_RAK811_BOOT_Version3_0_2, then download like this:

After this step, I need to do anything???

i try how you say, it work, thank

how use rui
i want send date to my gateway
I use COiDE

#include “rui.h”
#include “board.h”

static RUI_RETURN_STATUS rui_return_status;
RUI_LORA_STATUS_T app_lora_status; //record status

rui_lora_get_status(false,&app_lora_status);;//The query gets the current device status
static uint8_t sensor_data_cnt=0; //send data counter by LoRa

rui_lora_set_region(EU868);

rui_lora_set_work_mode(RUI_LORAWAN);

rui_lora_set_dev_eui(uint8_t *dev_eui);

rui_lora_set_app_eui(uint8_t *app_eui);

rui_lora_set_app_key(uint8_t *app_key);

rui_lora_set_join_mode(RUI_OTAA);

rui_lora_join();

rui_lora_set_dr(0x05);

/*
RUI_RETURN_STATUS rui_lora_send(uint8_t port,uint8_t* data,uint8_t len)
Copy
@brief rui_lora send
@return RUI_RETURN_STATUS
@param uint8_t port: send data port
uint8_t* data: send data string
uint8_t len: send data length
@module RAK811, RAK4200, and RAK4600 core module.
*/

rui_lora_send(2,“AABBCC”,3);

Hi,@oleksander
Pls refer to :https://doc.rakwireless.com/rak811-wisnode-lora-module/rui-online-compiler

My code here

#include “rui.h”
#include “board.h”

int main(void)
{
int i;
static RUI_RETURN_STATUS rui_return_status;
RUI_LORA_STATUS_T app_lora_status; //record status

rui_lora_get_status(false,&app_lora_status);;//The query gets the current device status
static uint8_t sensor_data_cnt=0;  //send data counter by LoRa

rui_init();

void rui_uart_recv(RUI_UART1, 2, 1)

while (1) {
rui_lora_get_status(false,&app_lora_status);//The query gets the current status
rui_running();

  for(i=0;i<0x100000;i++);
  rui_lora_set_region(EU868);
  for(i=0;i<0x800000;i++);
  rui_lora_set_work_mode(RUI_LORAWAN);
  for(i=0;i<0x800000;i++);
  rui_lora_set_dev_eui("003EBD495B106225");
  for(i=0;i<0x800000;i++);
  rui_lora_set_app_eui("70B3D57ED0027A86");
  for(i=0;i<0x800000;i++);
  rui_lora_set_app_key("B09751554689810EC3907461A97F29ED");
  for(i=0;i<0x800000;i++);
  rui_lora_set_join_mode(RUI_OTAA);
  for(i=0;i<0x800000;i++);
  rui_lora_join();
  for(i=0;i<0x800000;i++);
  rui_lora_set_dr(0x05);
  for(i=0;i<0x800000;i++);

  rui_lora_send(2,"AABBCC",3);

}
}

Hi,@oleksander
rui_uart_recv() this is callback function when UART receive data.

This function is automatically triggered by data received through the serial port.

i want to send data without using Uart. It mean my device first get connect with gateway then send data every 1 minute

@oleksander

" for(i=0;i<0x800000;i++);“If you want to delay,RUI has special delay functions"rui_delay_ms(x);”, x unit:ms.

That’s not the right way to write it either,you’d better refer to “lora_config.c”
This

this is the same error,you’d better refer to this usage in app_RAK811.c:


In this case:when RUI_UART1 received data ,then sent these data through lora. Also you can send data directly through lora, but not in the form of a string.
for example:
uint8_t ss[64];
strcpy(ss,“AABBCC”);
rui_lora_send(2,ss,strlen(ss));

i corrected my mistakes

MY code

#include “rui.h”
#include “board.h”

int main(void)
{
int i;
static RUI_RETURN_STATUS rui_return_status;
RUI_LORA_STATUS_T app_lora_status; //record status

rui_lora_get_status(false,&app_lora_status);;//The query gets the current device status
static uint8_t sensor_data_cnt=0;  //send data counter by LoRa

rui_init();

char lora_id_1[32] = {'0','0','3','E','B','D','4','9','5','B','1','0','6','2','2','5'};
char lora_id_2[32] = {'7','0','B','3','D','5','7','E','D','0','0','2','7','A','8','6'};
char lora_id_3[32] = {'B','0','9','7','5','1','5','5','4','6','8','9','8','1','0','E','C','3','9','0','7','4','6','1','A','9','7','F','2','9','E','D'};
//'\0'
static uint8_t a[80]={0x33,0x23,0xAA,0xFF};
//void rui_uart_recv(RUI_UART1, 2, 1);

while (1) {

  rui_lora_get_status(false,&app_lora_status);//The query gets the current status
  rui_running();

  rui_delay_ms(1000);
  rui_lora_set_region(EU868);
  rui_delay_ms(1000);
  rui_lora_set_work_mode(RUI_LORAWAN);
  rui_delay_ms(1000);
  rui_lora_set_dev_eui(lora_id_1);
  rui_delay_ms(1000);
  rui_lora_set_app_eui(lora_id_2);
  rui_delay_ms(1000);
  rui_lora_set_app_key(lora_id_3);
  rui_delay_ms(1000);;
  rui_lora_set_join_mode(RUI_OTAA);
  rui_delay_ms(1000);
  rui_lora_join();
  rui_delay_ms(1000);
  rui_lora_set_dr(0x05);
  rui_delay_ms(1000);

  //rui_lora_send(2,"AABBCC",3);
  rui_lora_send(8,a,3);

}
}

THen i compil
chrome_uEHumlOOCN

Hi,@oleksander
You’d better take a look at demo code about RAK811:https://github.com/RAKWireless/Products_practice_based_on_RUI/tree/master/based%20on%20RAK811/app_RAK811

demo code must use at Command, if i do not want use at command, what i must do?

Hi,@oleksander
We have fixed weak definition of rui_uart_recv(),you could compile your code again.Also you could define this function empty .

I compile my code again

P2MH6vUjJT

I have a question. RUI commands can be used without uart, the code works independently, as in the example here https://github.com/RAKWireless/RAK811_BreakBoard

@oleksander
Can you email your whole app.c code to me? I can’t understand your question.

yes, write your email and i send my file

@oleksander
[email protected]

I had reply you by email,pls check it.

i see i answered you too, check it out