Ik heb nagevraagd bij de leverancier waar ik mijn Dragino Arduino One + Lora Shield heb besteld ("LoRa IoT Development Kit V2 Based on the LG01-N IOT Gateway"). De leverancier kwam met een site die ik zelf ook al tegengekomen was:
https://github.com/lnlp/LMIC-node en daarmee zou ik mijn Arduino Uno moeten kunnen programmeren voor LoRa. Die site wordt wel vaker naar verwezen op internet en schijnt de startplek te zijn als je een soort code-template wil hebben voor als je LoRa wil gaan gebruiken.
Er wordt vanuit gegaan dat je
platform.io gebruikt. Binnen Visual Studio kun je die plugin inderdaad vinden, waardoor je een geintegreerde Arduino-IDE hebt. In je project moet je een
platform.ini zetten en daar heb ik mijn apparaat opgegeven:
code:
1
2
3
4
5
| [env:uno]
platform = atmelavr
board = uno
framework = arduino
upload_port = /dev/ttyUSB0 |
Daarnaast heb ik een
main.cpp met daarin een stukje standaardcode om het geintegreerde LED-lampje op het Arduino-bord te kunnen laten knipperen:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
| #include <Arduino.h>
void setup()
{
// initialize LED digital pin as an output.
pinMode(LED_BUILTIN, OUTPUT);
}
void loop()
{
// turn the LED on (HIGH is the voltage level)
digitalWrite(LED_BUILTIN, HIGH);
// wait for a second
delay(250);
// turn the LED off by making the voltage LOW
digitalWrite(LED_BUILTIN, LOW);
// wait for a second
delay(250);
} |
Dat kan ik compileren en versturen naar mijn Arduino en werkt allemaal prima.
Maar, nu probeer ik het LoRa-gedeelte er in te hangen, maar als ik kijk bij de README van de LMIC-node code op GitHub naar de
ondersteunde borden kan ik niet de Arduino Uno terug vinden. Ik heb wel geprobeerd de "mcci-catena/MCCI LoRaWAN LMIC library" afhankelijkheid toe te voegen in
platform.ini en wat bouwvlaggen ingesteld, afgekeken van de LMIC-node code op Github voor de
platform.ini. Maar nu begin ik echt al vast te lopen en heb ik geen idee meer wat ik aan het doen ben:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
| ; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[env:uno]
platform = atmelavr
board = uno
framework = arduino
upload_port = /dev/ttyUSB0
lib_deps = mcci-catena/MCCI LoRaWAN LMIC library@^4.1.1
; --------------------------------------------------
; | MCCI LoRaWAN LMIC library specific settings |
; --------------------------------------------------
[mcci_lmic]
; LMIC-node was tested with MCCI LoRaWAN LMIC library v3.3.0 and v4.0.0.
; Some changes have been announced for future versions of the MCCI library
; which may be incompatible with LMIC-node. In case of problems just
; use mcci-catena/MCCI LoRaWAN LMIC library@4.0.0 below which will
; explicitly use v4.0.0 of the library.
; Perform 'PlatformIO: Clean' after changing library version and
; in case of issues remove the old version from .pio/libdeps/*.
; Note: LMIC_PRINTF_TO is defined for each board separately
; in the board specific sections. Don't define it in this section.
lib_deps =
; Only ONE of below LMIC libraries should be enabled.
mcci-catena/MCCI LoRaWAN LMIC library ; MCCI LMIC library (latest release)
; mcci-catena/MCCI LoRaWAN LMIC library@4.0.0 ; MCCI LMIC library v4.0.0
build_flags =
; Use platformio.ini for settings instead lmic_project_config.h.
-D ARDUINO_LMIC_PROJECT_CONFIG_H_SUPPRESS
; Ping and beacons not supported for class A, disable to save memory.
-D DISABLE_PING
-D DISABLE_BEACONS
; -D LMIC_DEBUG_LEVEL=1 ; 0, 1 or 2
; -D CFG_sx1272_radio=1 ; Use for SX1272 radio
-D CFG_sx1276_radio=1 ; Use for SX1276 radio
-D USE_ORIGINAL_AES ; Faster but larger, see docs
; -D LMIC_USE_INTERRUPTS ; Not tested or supported on many platforms
; -D LMIC_ENABLE_DeviceTimeReq=1 ; Network time support
; --- Regional settings -----
; Enable only one of the following regions:
; -D CFG_as923=1
; -D CFG_as923jp=1
; -D CFG_au915=1
; -D CFG_cn490=1 ; Not yet supported
; -D CFG_cn783=1 ; Not yet supported
; -D CFG_eu433=1 ; Not yet supported
-D CFG_eu868=1
; -D CFG_in866=1
; -D CFG_kr920=1
; -D CFG_us915=1 |
Als ik dan ga bouwen krijg ik de volgende foutmeldingen:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
| rocessing uno (platform: atmelavr; board: uno; framework: arduino)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/uno.html
PLATFORM: Atmel AVR (4.0.1) > Arduino Uno
HARDWARE: ATMEGA328P 16MHz, 2KB RAM, 31.50KB Flash
DEBUG: Current (avr-stub) External (avr-stub, simavr)
PACKAGES:
- framework-arduino-avr @ 5.1.0
- toolchain-atmelavr @ 1.70300.191015 (7.3.0)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 6 compatible libraries
Scanning dependencies...
Dependency Graph
|-- MCCI LoRaWAN LMIC library @ 4.1.1
Building in release mode
Compiling .pio/build/uno/lib161/MCCI LoRaWAN LMIC library/hal/hal.cpp.o
Compiling .pio/build/uno/lib161/MCCI LoRaWAN LMIC library/lmic/lmic_us_like.c.o
Compiling .pio/build/uno/lib161/MCCI LoRaWAN LMIC library/lmic/lmic_util.c.o
.pio/libdeps/uno/MCCI LoRaWAN LMIC library/src/hal/hal.cpp:14:10: fatal error: SPI.h: No such file or directory
*************************************************************
* Looking for SPI.h dependency? Check our library registry!
*
* CLI > platformio lib search "header:SPI.h"
* Web > https://registry.platformio.org/search?q=header:SPI.h
*
*************************************************************
#include <SPI.h>
^~~~~~~
compilation terminated.
Compiling .pio/build/uno/lib161/MCCI LoRaWAN LMIC library/lmic/oslmic.c.o
Compiling .pio/build/uno/lib161/MCCI LoRaWAN LMIC library/lmic/radio.c.o
Archiving .pio/build/uno/libFrameworkArduinoVariant.a
Indexing .pio/build/uno/libFrameworkArduinoVariant.a
Compiling .pio/build/uno/FrameworkArduino/CDC.cpp.o
Compiling .pio/build/uno/FrameworkArduino/HardwareSerial.cpp.o
Compiling .pio/build/uno/FrameworkArduino/HardwareSerial0.cpp.o
Compiling .pio/build/uno/FrameworkArduino/HardwareSerial1.cpp.o
Compiling .pio/build/uno/FrameworkArduino/HardwareSerial2.cpp.o
Compiling .pio/build/uno/FrameworkArduino/HardwareSerial3.cpp.o
Compiling .pio/build/uno/FrameworkArduino/IPAddress.cpp.o
Compiling .pio/build/uno/FrameworkArduino/PluggableUSB.cpp.o
Compiling .pio/build/uno/FrameworkArduino/Print.cpp.o
*** [.pio/build/uno/lib161/MCCI LoRaWAN LMIC library/hal/hal.cpp.o] Error 1
Compiling .pio/build/uno/FrameworkArduino/Stream.cpp.o
================================================================================================ [FAILED] Took 0.38 seconds ================================================================================================
* The terminal process "platformio 'run'" terminated with exit code: 1.
* Terminal will be reused by tasks, press any key to close it. |
De SPI (Serial Peripheral Interface) header heb ik
opgezocht, maar daar word ik niet wijs van welke ik zou moeten gebruiken. Op The Things Network forums/draadjes word ik niet wijzer, behalve wederom een
verwijzing naar het al om verlossende LMIC-node op GitHub. Ik gebruik denk ik de verkeerde zoektermen, of ik wil iets dat niet kan of begrijp het gewoon niet.
Mijn vraag: iemand die wel een idee heeft en/of ervaring hiermee?
[
Voor 22% gewijzigd door
Tjeerd op 14-01-2023 22:22
]