RAK5010 DFU over USB

We have Mehere RAK5010. No RAK5010 allows a FW update.

at+version
Firmware Version: RUI v3.0.0.15

at+get_config=device:boot
ERROR:RUI_AT_UNSUPPORT 1

The RAK Device Firmware Upgrade Tool V1.4 shows timeout.

Can you help us?

Welcome to RAK forum @dieter ,

You cannot use RAK DFU Tool for RAK5010. You can either use Jlink or wireless DFU via BLE. The complete guide is here RAK5010-M Quick Start Guide | RAKwireless Documentation Center.

Thanks, DFU works via BLE.
With which API (RUI_UART1, RUI_UART2, RUI_UART3) I can use the serial port on J12 (IO3, IO4)? Ext_vref is 3.3 V.
It does not succeed in sending me with Rui_UART_SEND (…) to this port.

I don’t find any of the Struct RUI_GPS_DATA. Which parameters is RUI_GPS_DATA?

Hi
uart is for AT part now, we suggest you to use usb print log. Here is an example.
#include “rui.h”
#include “lis3dh.h”
#include “opt3001.h”
#include “shtc3.h”
#include “lps22hb.h”
#include <stdarg.h>

extern void usbd_send(uint8_t *pdata, uint16_t len);

void usb_log_printf(const char *fmt, …)
{
char print_buf[512];
va_list aptr;
int ret;

va_start (aptr, fmt);
ret = vsprintf (print_buf, fmt, aptr);
va_end (aptr);

usbd_send(print_buf, strlen(print_buf));

}

RUI_I2C_ST st = {0};

void sensor_on(void)
{

st.PIN_SDA = 14;
st.PIN_SCL = 13;
st.FREQUENCY = RUI_I2C_FREQ_400K;
rui_i2c_init(&st);

//lis3dh init
lis3dh_init();
//opt3001 init
opt3001_init();
//shtc3 init
SHTC3_Wakeup();
//lps22hb init 1 wake up
lps22hb_mode(1);

}

void sensor_off(void)
{
lis3dh_sleep_init();
sensorOpt3001Enable(0);
SHTC3_Sleep();
lps22hb_mode(0);
}

//timer task to print log
RUI_TIMER_ST rui_timer;
uint8_t timer_flag=0;
void timer_callback(void)
{
timer_flag = 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);
}

void main(void)
{
//system init
rui_sensor_register_callback(sensor_on,sensor_off);
rui_init();
timer_init();
uint8_t a = 1;
float b =2.34;
while(1)
{
//do your work here, then call rui_device_sleep(1) to sleep
//here run system work and do not modify
if (timer_flag == 1)
{
usb_log_printf(“This is from USB!!”);
//usb_log_printf(“This is %d”,a);
//usb_log_printf(“This is %f”,b);
timer_flag = 0;
}
rui_running();

}

}

1 Like

GPS is defined in rui.h. Howeveer, 5010 just provide the longitude and latitude. You can get it from AT or api.
typedef struct RUI_GPS_DATA

{

uint8_t UTC[4];

uint8_t Date[3];

bool LatitudeNS;        //0:N   1:S

uint8_t LatitudeDegree;

uint32_t LatitudeMinute;

double Latitude;

bool LongitudaEW;       //0:E   1:W

uint8_t LongitudaDegree;

double Longitude;

uint32_t LongitudaMinute;

int Quality;

int NumSatellities;

int16_t HDOP;

int16_t Altitude;

int16_t GeoidHeight;

} RUI_GPS_DATA;

1 Like

Thank you, that was the information I was looking for.

Hi, unfortunately I have to report again with a problem.

If I use “at+get_config=device:status”, I get:
“at+get_config=device:statusAcc:-449.00,341.00,763.00; Tem:0.00;Hum:0.00; Lat(0-N,1-S):0,52xx.229470,Lon(0-E,1-W):0,13xx.909721; Battery:4.10;
OK”

If I use the code below and want to receive the GPS data in the timer in the main () with build_data(), I get:
"Lat (0-N, 1-S): 0.0.000000, Lon (0-E, 1-W): 0.0.000000; lat (0-n, 1-s): 0.0.000000, LON (0- E, 1-w): 0.0.000000; "

Where is the problem here?

user_app.c:

.
.
.

extern void usbd_send(uint8_t *pdata, uint16_t len);

void usb_log_printf(const char *fmt, ...)
{
	char print_buf[512];
	va_list aptr;
	int ret;

	va_start (aptr, fmt);
	ret = vsprintf (print_buf, fmt, aptr);
	va_end (aptr);

	usbd_send(print_buf, strlen(print_buf));
}

void build_data(void)
{
	RUI_GPS_DATA g_gps_data = {0};
    uint8_t lat_data[20] = {0};
    uint8_t lon_data[20] = {0}; 
    uint8_t send_data[256] = {0}; 

	memset(lat_data,0,20);        
    rui_gps_get(&g_gps_data);
    sprintf(lat_data,"%lf",g_gps_data.Latitude);
    memset(lon_data,0,20);
    sprintf(lon_data,"%lf",g_gps_data.Longitude);

    memset(send_data,0,256); 
    sprintf(send_data, "Lat(0-N,1-S):%d,%s,Lon(0-E,1-W):%d,%s; ",g_gps_data.LatitudeNS,lat_data,g_gps_data.LongitudaEW,lon_data); 
	usb_log_printf((char*)send_data);
}

//timer task to print log
RUI_TIMER_ST rui_timer;
uint8_t timer_flag=0;
void timer_callback(void)
{
	timer_flag = 1;
}

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

void main(void)
{
    //system init 
    rui_sensor_register_callback(sensor_on,sensor_off);
    rui_init();
	timer_init();
	
    while(1)
    {
        //do your work here, then call rui_device_sleep(1) to sleep

        //here run system work and do not modify
		if (timer_flag == 1)
		{
			build_data();
			timer_flag = 0;
		}

        rui_running();
    }
}

Additional question:
Are only a Latitude, Latitude, LongitudaEW, Longitude filled by rui_gps_get(RUI GPS DATA *data)?

Can’t anyone tell me why the GPS data remain zero in a timer method in main (void)?

Hi
This is actully a bug. Still checking. RUIv2 is not updating now, we are integrating RUIV3 now. However, for this case, could you try this, use BG96 AT directly to get gps data. It can avoid gps API bug and communicate with BG96 :
#include “rui.h”

#include “lis3dh.h”

#include “opt3001.h”

#include “shtc3.h”

#include “lps22hb.h”

#include <stdarg.h>

RUI_I2C_ST st = {0};

void sensor_on(void)

{

st.PIN_SDA = 14;

st.PIN_SCL = 13;

st.FREQUENCY = RUI_I2C_FREQ_400K;

rui_i2c_init(&st);

//lis3dh init

lis3dh_init();

//opt3001 init

opt3001_init();

//shtc3 init

SHTC3_Wakeup();

//lps22hb init 1 wake up

lps22hb_mode(1);

}

void sensor_off(void)

{

lis3dh_sleep_init();

sensorOpt3001Enable(0);

SHTC3_Sleep();

lps22hb_mode(0);

}

extern void usbd_send(uint8_t *pdata, uint16_t len);

void usb_log_printf(const char *fmt, …)

{

char print_buf[512];

va_list aptr;

int ret;

va_start (aptr, fmt);

ret = vsprintf (print_buf, fmt, aptr);

va_end (aptr);

usbd_send(print_buf, strlen(print_buf));

}

void build_data(void)

{

#if 0

RUI_GPS_DATA g_gps_data = {0};

uint8_t lat_data[20] = {0};

uint8_t lon_data[20] = {0};

uint8_t send_data[256] = {0};

memset(lat_data,0,20);        

rui_gps_get(&g_gps_data);

sprintf(lat_data,"%lf",g_gps_data.Latitude);

memset(lon_data,0,20);

sprintf(lon_data,"%lf",g_gps_data.Longitude);

memset(send_data,0,256);

sprintf(send_data, "Lat(0-N,1-S):%d,%s,Lon(0-E,1-W):%d,%s; ",g_gps_data.LatitudeNS,lat_data,g_gps_data.LongitudaEW,lon_data);

usb_log_printf((char*)send_data);

#endif

uint8_t gsm_cmd[100] = {0};

uint8_t gsm_rsp[256] = {0};

rui_cellular_send("AT+QGPSGNMEA=\"GGA\"");

rui_cellular_response(gsm_rsp, 256, 500 * 2);

usb_log_printf((char*)gsm_rsp);  

}

//timer task to print log

RUI_TIMER_ST rui_timer;

uint8_t timer_flag=0;

void timer_callback(void)

{

//timer_flag = 1;

build_data();

}

void timer_init()

{

rui_timer.timer_mode = RUI_TIMER_MODE_REPEATED;

rui_timer_init(&rui_timer, timer_callback);

rui_timer_setvalue(&rui_timer, 5000);

rui_timer_start(&rui_timer);

}

void main(void)

{

//system init

rui_sensor_register_callback(sensor_on,sensor_off);

rui_init();

timer_init();



while(1)

{

    //do your work here, then call rui_device_sleep(1) to sleep

    //here run system work and do not modify

    // if (timer_flag == 1)

    // {

    //  //build_data();

    //  timer_flag = 0;

    // }

    rui_running();

}

}

I have already tried the GPS data directly. But it doesn’t work reliably. There are always gaps where the GPS data is empty. At the same time, the status query works with valid data. The GPS antenna is outdoors.

+QGPSGNMEA: $GPGGA,072308.00,5253.225994,N,01344.914501,E,1,07,0.7,62.0,M,43.0,M,,*54 
 
OK 
 
+QGPSGNMEA: $GPGGA,072313.00,5253.225983,N,01344.914476,E,1,07,0.7,62.0,M,43.0,M,,*59 
 
OK 
 
+QGPSGNMEA: $GPGGA,072318.00,5253.225985,N,01344.914466,E,1,07,0.7,62.0,M,43.0,M,,*55 
 
OK 
 
+QGPSGNMEA: $GPGGA,072323.00,5253.225981,N,01344.914475,E,1,07,0.7,62.0,M,43.0,M,,*5B 
 
OK 
 
+QGPSGNMEA: $GPGGA,072328.00,5253.225981,N,01344.914459,E,1,07,0.6,61.9,M,43.0,M,,*55 
 
OK 
 
+QGPSGNMEA: $GPGGA,072333.00,5253.225986,N,01344.914446,E,1,07,0.6,61.9,M,43.0,M,,*56 
 
OK 
 
+QGPSGNMEA: $GPGGA,,,,,,0,,,,,,,,*66 
 
OK 
 
+QGPSGNMEA: $GPGGA,,,,,,0,,,,,,,,*66 
 
OK 
 
+QGPSGNMEA: $GPGGA,,,,,,0,,,,,,,,*66 
 
OK 
 
+QGPSGNMEA: $GPGGA,,,,,,0,,,,,,,,*66 
 
OK 
 
+QGPSGNMEA: $GPGGA,,,,,,0,,,,,,,,*66 
 
OK 
 
+QGPSGNMEA: $GPGGA,,,,,,0,,,,,,,,*66 
 
OK 
 
+QGPSGNMEA: $GPGGA,,,,,,0,,,,,,,,*66 
 
OK 
 
+QGPSGNMEA: $GPGGA,,,,,,0,,,,,,,,*66 
 
OK 
 
+QGPSGNMEA: $GPGGA,,,,,,0,,,,,,,,*66 
 
OK 
 
+QGPSGNMEA: $GPGGA,,,,,,0,,,,,,,,*66 
 
OK 
 
+QGPSGNMEA: $GPGGA,,,,,,0,,,,,,,,*66 
 
OK 
 
+QGPSGNMEA: $GPGGA,,,,,,0,,,,,,,,*66 
 
OK 
 
+QGPSGNMEA: $GPGGA,,,,,,0,,,,,,,,*66 
 
OK 
 
+QGPSGNMEA: $GPGGA,,,,,,0,,,,,,,,*66 
 
OK 
 
+QGPSGNMEA: $GPGGA,,,,,,0,,,,,,,,*66 
 
OK 
 
+QGPSGNMEA: $GPGGA,072454.00,5253.225988,N,01344.914114,E,1,08,0.6,61.7,M,43.0,M,,*5D 
 
OK 
 
+QGPSGNMEA: $GPGGA,072459.00,5253.225995,N,01344.914101,E,1,08,0.6,61.7,M,43.0,M,,*58 
 
OK 
 
+QGPSGNMEA: $GPGGA,072504.00,5253.226004,N,01344.914097,E,1,08,0.6,61.7,M,43.0,M,,*5D 
 
OK 
 
+QGPSGNMEA: $GPGGA,072509.00,5253.226019,N,01344.914096,E,1,08,0.6,61.8,M,43.0,M,,*52 
 
OK 
 
+QGPSGNMEA: $GPGGA,072514.00,5253.226069,N,01344.914134,E,1,08,0.6,61.9,M,43.0,M,,*51 
 
OK 
 
+QGPSGNMEA: $GPGGA,072519.00,5253.226092,N,01344.914086,E,1,09,0.5,61.9,M,43.0,M,,*52 
 
OK 
 
+QGPSGNMEA: $GPGGA,072524.00,5253.226092,N,01344.914005,E,1,08,0.6,61.9,M,43.0,M,,*55 
 
OK 
 
+QGPSGNMEA: $GPGGA,072529.00,5253.226072,N,01344.913930,E,1,09,0.5,61.8,M,43.0,M,,*5D 
 
OK 
 
+QGPSGNMEA: $GPGGA,072534.00,5253.226070,N,01344.913866,E,1,09,0.5,61.3,M,43.0,M,,*5A 
 
OK 
 
+QGPSGNMEA: $GPGGA,072539.00,5253.226090,N,01344.913883,E,1,09,0.5,61.7,M,43.0,M,,*56 
 
OK 
 
+QGPSGNMEA: $GPGGA,072544.00,5253.226069,N,01344.913846,E,1,09,0.5,61.6,M,43.0,M,,*52 
 
OK 
 
+QGPSGNMEA: $GPGGA,072549.00,5253.226079,N,01344.913842,E,1,09,0.5,61.7,M,43.0,M,,*5B 
 
OK 
 
+QGPSGNMEA: $GPGGA,072554.00,5253.226096,N,01344.913845,E,1,09,0.5,61.7,M,43.0,M,,*51 
 
OK 
 
+QGPSGNMEA: $GPGGA,072559.00,5253.226118,N,01344.913858,E,1,09,0.5,61.5,M,43.0,M,,*55 
 
OK 
 
+QGPSGNMEA: $GPGGA,,,,,,0,,,,,,,,*66 
 
OK 
 
+QGPSGNMEA: $GPGGA,,,,,,0,,,,,,,,*66 
 
OK 
 
+QGPSGNMEA: $GPGGA,,,,,,0,,,,,,,,*66 
 
OK 
 
+QGPSGNMEA: $GPGGA,,,,,,0,,,,,,,,*66 
 
OKat+get_config=device:statusat+get_config=device:statusAcc:-433.00,182.00,824.00; Tem:0.00;Hum:0.00; Lat(0-N,1-S):0,5253.226104,Lon(0-E,1-W):0,1338.913732; Battery:4.10; 
OK
 
+QGPSGNMEA: $GPGGA,072627.00,5253.226104,N,01344.913732,E,1,09,0.5,61.6,M,43.0,M,,*52 
 
OK 
 
+QGPSGNMEA: $GPGGA,,,,,,0,,,,,,,,*66 
 
OK 
 
+QGPSGNMEA: $GPGGA,,,,,,0,,,,,,,,*66 
 
OK 
 
+QGPSGNMEA: $GPGGA,,,,,,0,,,,,,,,*66 
 
OKat+get_config=device:statusat+get_config=device:statusAcc:-433.00,181.00,832.00; Tem:0.00;Hum:0.00; Lat(0-N,1-S):0,5253.226104,Lon(0-E,1-W):0,1338.913633; Battery:4.10; 
OK
 
+QGPSGNMEA: $GPGGA,,,,,,0,,,,,,,,*66 
 
OK 
 
+QGPSGNMEA: $GPGGA,,,,,,0,,,,,,,,*66 
 
OK 
 
+QGPSGNMEA: $GPGGA,,,,,,0,,,,,,,,*66 
 
OK 
 
+QGPSGNMEA: $GPGGA,,,,,,0,,,,,,,,*66 
 
OKat+get_config=device:statusat+get_config=device:statusAcc:-435.00,184.00,835.00; Tem:0.00;Hum:0.00; Lat(0-N,1-S):0,5253.226041,Lon(0-E,1-W):0,1338.913428; Battery:4.10; 
OK
 
+QGPSGNMEA: $GPGGA,072706.00,5253.226041,N,01344.913428,E,1,09,0.5,61.3,M,43.0,M,,*5D 
 
OK 
 
+QGPSGNMEA: $GPGGA,,,,,,0,,,,,,,,*66 
 
OK 
 
+QGPSGNMEA: $GPGGA,,,,,,0,,,,,,,,*66 
 
OK 
 
+QGPSGNMEA: $GPGGA,,,,,,0,,,,,,,,*66 
 
OK 
 
+QGPSGNMEA: $GPGGA,,,,,,0,,,,,,,,*66 
 
OK 
 
+QGPSGNMEA: $GPGGA,,,,,,0,,,,,,,,*66 
 
OK 
 
+QGPSGNMEA: $GPGGA,,,,,,0,,,,,,,,*66 
 
OK 
 
+QGPSGNMEA: $GPGGA,,,,,,0,,,,,,,,*66 
 
OK 
 
+QGPSGNMEA: $GPGGA,,,,,,0,,,,,,,,*66 
 
OK 
 
+QGPSGNMEA: $GPGGA,,,,,,0,,,,,,,,*66 
 
OK 
 
+QGPSGNMEA: $GPGGA,,,,,,0,,,,,,,,*66 
 
OK 
 
+QGPSGNMEA: $GPGGA,,,,,,0,,,,,,,,*66 
 
OK 
 
+QGPSGNMEA: $GPGGA,,,,,,0,,,,,,,,*66 
 
OK 
 
+QGPSGNMEA: $GPGGA,072810.00,5253.226137,N,01344.913116,E,1,09,0.6,61.4,M,43.0,M,,*59 
 
OK 
 
+QGPSGNMEA: $GPGGA,072815.00,5253.226150,N,01344.913127,E,1,09,0.5,61.5,M,43.0,M,,*5D 
 
OK 
 
+QGPSGNMEA: $GPGGA,072820.00,5253.226160,N,01344.913132,E,1,09,0.5,61.5,M,43.0,M,,*5C 
 
OK 
 
+QGPSGNMEA: $GPGGA,072825.00,5253.226191,N,01344.913152,E,1,09,0.5,61.6,M,43.0,M,,*52 
 
OK 
 
+QGPSGNMEA: $GPGGA,072830.00,5253.226218,N,01344.913191,E,1,09,0.5,61.6,M,43.0,M,,*5B 
 
OK 
 
+QGPSGNMEA: $GPGGA,,,,,,0,,,,,,,,*66 
 
OK 
 
+QGPSGNMEA: $GPGGA,,,,,,0,,,,,,,,*66 
 
OK 
 
+QGPSGNMEA: $GPGGA,,,,,,0,,,,,,,,*66 
 
OK