RUI: How to set RUI_I2C_ST - I2C_REG_MAGIC

Hi @fangfchen
I2c_1.PIN_SDA = I2C_SDA ;
I2c_1.PIN_SCL = I2C_SCL ;
RAK811 support 1 fixed I2C,so this two pin can’t modify.Please use default initalization.
How to use the I2C,please refer to app_5205.c :https://github.com/RAKWireless/Products_practice_based_on_RUI/tree/master/based%20on%20RAK811/app_5205

These two commands are valid in RAK811 now.

Hi Wang,
What is the default pin number for fixed I2C in RAK811? Different diagram shows different pin number for SDA and SCL.

Hi,@fangfchen
Sorry,this is a negligence. The pin number 18 is I2C_SCL and 19 is I2C_SDA At RAK811 module . I’ll fix it to module pin number.This pin number is fixed for I2C,because RAK811 used hardware i2c,so it can’t remap to other pin.

Hi @leopold, do you have BH1750 sample code to share? I can’t read light sensor data.

Hi,@fangfchen
Sorry,we haven’t used the BH1750 sensor.


You’d better refer to its datasheet:https://pdf1.alldatasheet.com/datasheet-pdf/view/350139/ROHM/BH1750FVI.html

help with rui

When I compile and load code into rak811, the module does not work, nothing happens. I use usb-ttl to download the program. I try to use the program with AT command and it works, but rui do not work

Hi,@oleksander
The firmware that you compiled is based bootloader:https://downloads.rakwireless.com/en/LoRa/RAK811/Firmware/RUI_RAK811_BOOT_Version3_0_2.rar.
So you must download RUI_RAK811_BOOT_Version3_0_2.bin and flash it first,then update your firmware by RAK Upgrade Tool.
You can refer to:https://doc.rakwireless.com/rak811-wisnode-lora-module/upgrading-the-firmware.

first i upload the bin file and then do the update RAK LoRaButton Upgrade Tool V1.0, where i find file for RAK LoRaButton Upgrade Tool V1.0??

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?