Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
LoRaWAN benchmark
RIOT - IM880B
Commits
549433c4
Commit
549433c4
authored
Apr 29, 2019
by
Guillaume Gonnet
Browse files
Fix DR parameter in LoRaMac-node.
parent
6e7ad31f
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
29 additions
and
20 deletions
+29
-20
src/app/benchmark/benchmark.h
src/app/benchmark/benchmark.h
+2
-2
src/app/benchmark/payload.c
src/app/benchmark/payload.c
+5
-3
src/app/main.c
src/app/main.c
+5
-10
src/loramac/mac/LoRaMac.c
src/loramac/mac/LoRaMac.c
+1
-1
src/lorariot/controller/contoller.c
src/lorariot/controller/contoller.c
+12
-0
src/lorariot/controller/controller.h
src/lorariot/controller/controller.h
+3
-3
src/lorariot/controller/send.c
src/lorariot/controller/send.c
+1
-1
No files found.
src/app/benchmark/benchmark.h
View file @
549433c4
...
...
@@ -21,7 +21,7 @@ extern lorariot_mcps_t bm_payload;
// Transmission powers to test.
extern
uint8_t
bm_power
s
[];
extern
uint8_t
bm_power
[];
// Datarates to test.
extern
uint8_t
bm_dr
[];
...
...
@@ -35,7 +35,7 @@ extern const provider_t *bm_pvd[];
/**
* @brief Encode message data to the payload.
* @param power_i Transmission power (index in `bm_power
s
`).
* @param power_i Transmission power (index in `bm_power`).
* @param dr_i Datarate (index in `bm_dr`).
* @param cr_i Coding rate (index in `bm_cr`).
*/
...
...
src/app/benchmark/payload.c
View file @
549433c4
...
...
@@ -48,10 +48,12 @@ void bm_encode_payload(uint8_t power_i, uint8_t dr_i, uint8_t cr_i)
// Retreive GPS data.
int32_t
lat
,
lon
;
int16_t
alt
;
gps_get_binary
(
&
lat
,
&
lon
,
&
alt
);
//gps_get_binary(&lat, &lon, &alt);
lat
=
lon
=
alt
=
0
;
// Retreive temperature.
uint16_t
temp
=
bm_get_temperature
();
(
void
)
bm_get_temperature
;
uint16_t
temp
=
0
;
// bm_get_temperature();
// Encode LoRa settings (on 8 bits).
...
...
@@ -81,6 +83,6 @@ void bm_encode_payload(uint8_t power_i, uint8_t dr_i, uint8_t cr_i)
// Change MCPS parameters for the next frame.
bm_payload
.
code_rate
=
bm_cr
[
cr_i
];
bm_payload
.
power
=
bm_power
s
[
power_i
];
bm_payload
.
power
=
bm_power
[
power_i
];
bm_payload
.
dr
=
bm_dr
[
dr_i
];
}
src/app/main.c
View file @
549433c4
...
...
@@ -11,6 +11,7 @@ This project is under the MIT license
#include "drivers/ds75lx.h"
#include "providers/providers.h"
#include "commands/commands.h"
#include "benchmark/benchmark.h"
#include <xtimer.h>
...
...
@@ -20,15 +21,10 @@ This project is under the MIT license
// TMP: send a ping message.
static
void
send_message
(
void
)
{
lorariot_mcps_t
mcps
=
LORARIOT_UNCONFIRMED
(
DR_0
);
mcps
.
power
=
19
;
mcps
.
buffer
=
(
uint8_t
*
)
"Ballon!"
;
mcps
.
len
=
7
;
mcps
.
code_rate
=
4
;
bm_encode_payload
(
9
,
5
,
0
);
puts
(
"Sending message ..."
);
pvd_send
(
&
pvd_orange_cmd
,
&
mcps
);
pvd_send
(
&
pvd_orange_cmd
,
&
bm_payload
);
puts
(
"Message sent!"
);
}
...
...
@@ -51,9 +47,8 @@ int main(void)
// xtimer_sleep(10);
while
(
true
)
{
for
(
int
i
=
0
;
i
<
3
;
i
++
)
{
send_message
();
return
0
;
xtimer_sleep
(
90
);
//xtimer_usleep(50 * 1000); // 50 ms
}
}
src/loramac/mac/LoRaMac.c
View file @
549433c4
...
...
@@ -3331,7 +3331,7 @@ LoRaMacStatus_t LoRaMacMcpsRequest( McpsReq_t *mcpsRequest )
phyParam
=
RegionGetPhyParam
(
LoRaMacRegion
,
&
getPhy
);
// Apply the minimum possible datarate.
// Some regions have limitations for the minimum datarate.
datarate
=
MAX
(
datarate
,
phyParam
.
Value
);
datarate
=
MAX
(
datarate
,
(
int8_t
)
phyParam
.
Value
);
if
(
readyToSend
==
true
)
{
...
...
src/lorariot/controller/contoller.c
View file @
549433c4
...
...
@@ -153,5 +153,17 @@ int lorariot_init(void)
&
lorariot_primitives
,
&
lorariot_callbacks
,
LORAMAC_REGION_IMAG
);
lorariot_debug_status
(
"init"
,
status
);
// Set some LoRaWAN parameters.
MibRequestConfirm_t
mibReq
;
mibReq
.
Type
=
MIB_ADR
;
mibReq
.
Param
.
AdrEnable
=
false
;
// Disable ADR so the server won't change our DR.
LoRaMacMibSetRequestConfirm
(
&
mibReq
);
mibReq
.
Type
=
MIB_PUBLIC_NETWORK
;
mibReq
.
Param
.
EnablePublicNetwork
=
true
;
LoRaMacMibSetRequestConfirm
(
&
mibReq
);
return
0
;
}
src/lorariot/controller/controller.h
View file @
549433c4
...
...
@@ -52,7 +52,7 @@ void lorariot_event_cb(netdev_t *dev, netdev_event_t event);
void
lorariot_debug_status_ev
(
const
char
*
name
,
LoRaMacEventInfoStatus_t
status
);
void
lorariot_debug_mcps
(
Mcps_t
code
);
#else
#define lorariot_debug_status(name, status) ((void)
0
)
#define lorariot_debug_status_ev(name, status) ((void)
0
)
#define lorariot_debug_mcps(code) ((void)
0
)
#define lorariot_debug_status(name, status) ((void)
status
)
#define lorariot_debug_status_ev(name, status) ((void)
status
)
#define lorariot_debug_mcps(code) ((void)
code
)
#endif
src/lorariot/controller/send.c
View file @
549433c4
...
...
@@ -79,8 +79,8 @@ static void _send_mcps(const lorariot_mcps_t *mcps)
req
.
Req
.
Confirmed
.
fPort
=
mcps
->
port
;
req
.
Req
.
Confirmed
.
fBuffer
=
(
uint8_t
*
)
mcps
->
buffer
;
req
.
Req
.
Confirmed
.
fBufferSize
=
mcps
->
len
;
req
.
Req
.
Confirmed
.
NbTrials
=
mcps
->
nb_trials
;
req
.
Req
.
Confirmed
.
Datarate
=
mcps
->
dr
;
req
.
Req
.
Confirmed
.
NbTrials
=
mcps
->
nb_trials
;
// If we use a port >= 32, we skip reception windows.
LoRaMacTestRxWindowsOn
(
mcps
->
port
<
32
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment