RUI: How to set RUI_I2C_ST - I2C_REG_MAGIC

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

if i use app Rak811.i must send AT+Command. If i do not want send AT+command, what i must change in my code?

Hi, have you find any solution to this?

rui_uart_recv(RUI_UART1, 2, 1)

here what is 2 ?

char b[3] = {0};
const char Buffer;
uint8_t BufferSize;
const char a[3]={0x11,0x22,0x33};
int i;

while(1)
{
	
	
      const char a[3]={0x11,0x22,0x33};
     rui_uart_mode_config(RUI_UART1, RUI_UART_UNVARNISHED);
    rui_uart_init( RUI_UART1, BAUDRATE_115200);
    rui_uart_send(RUI_UART1, a, 3);
   rui_uart_recv(RUI_UART1, Buffer, 1 );
	for(i=0;i<;i++);
	{
		sprintf(b, "%02x",Buffer[i]);
		RUI_LOG_PRINTF("%c",Buffer[i]);
		RUI_LOG_PRINTF("%s", b); 
		RUI_LOG_PRINTF("%s", Buffer);
	}
	RUI_LOG_PRINTF("\r\n");  
	
	DelayMs(2000);

How rui_uart_recv function i can Used? i did not get data which i send?

It is the pointer of the data. The documentation of rui_uart_recv function is here https://docs.rakwireless.com/RUI/rui-interface-general-format/#rui-uart-receive