Multiplatform HCI stack Implementation, to command the IMST's WiMOD iM880B-L LoRaWAN module. Based initialy on the HCI LoRaWAN example code from IMST. Here we list the currently supported platforms and IDEs:
IDE | Compiler | Windows | UX | 8 bit PIC |
---|---|---|---|---|
Code::Blocks | GCC/G++ Compiler | X | X | |
Microchip's MPLAB X IDE | XC8 Compiler | X |
For both platforms, an example code can be found in examples/main_pc.cpp
. Every layer of the HCI stack proposed by IMST has their own buffers and source code (WiMOD_HCI_Layer.c
, SLIP.c
and SerialDevice_pc.c
), so every layer can be debugged individually to understand the inner working concepts of the HCI stack.
-
Windows: In Rework.
-
Linux: Pending Work
The whole source code compiles, but the code to access the Serial Port have to be reviewed (due to the fact that the original code was intended to work in Windows).
Due to the fact that MCUs has limited resources, the whole HCI stack is programmed in a single and compact WMLW_API.c
file.
-
Microchip PIC, 8 bit family: Working.
Currently Supported Targets:
However, the code can be easily ported to another PIC reference with at least a UART module with interrupts by Rx complete.
The file
examples/main_pic.c
includes a basic setup (oscillator and EUSART) to use the internal oscillator at 8 MHz (Some tunning on register values have to be done to work with other crystal/oscillator configurations), intending to be a state machine in which a LED connected to RA0 blinks once the OTA authentication was successful and then blinks every time a data is being sent.
Depending on the purpose of the final application, if it's intended to send many sensor measures with a Cayenne-like protocol, you must #include
the header library "pylatex.h"
at top of your source code. But, if you want to directly send messages over LoRaWAN, as this library does, you have to #include
the header library "WiMOD_LoRaWAN_API.h"
. For details of inner working, see the related source codes:
Header | Source |
---|---|
pylatex.h | pylatex.c |
WiMOD_LoRaWAN_API.h | WMLW_API.c (for MCU) or WiMOD_LoRaWAN_API.c (for PC) |
void initLW (serialTransmitHandler transmitter)
Indicates to pylatex.h
library the external transmitter
function, that the library must use to send an array over a previously configured 115200, 8N1 UART port, connected to the iM88xx modem.
void pylatexRx (char RxByteUART)
Call this on every received byte, RxByteUART
, from your serial port implementation.
bool AppendMeasure (char type,char *ptrMeasure)
For a specific type
of measure (let's say, CO2 with PY_CO2
constant), receives a ptrMeasure
pointer to an array of the spliced measure, depending on the weight of the measure, and appends it at the end of the message to be sent.
void SendMeasures (pyModeType confirmed)
Once appended all measures, SendMeasures()
sends all measures to the iM88xx to be sent through LoRaWAN. The confirmed
variable may be PY_CONFIRMED
for confirmed messages or PY_UNCONFIRMED
for unconfirmed messages. This function can be called safely, only after a first invocation of initLW()
and the calling of the pylatexRx()
on every incoming byte (See the main_pic8.c
example).
- Integrate PIC targets with MCC
- Add channel support (to identify every measure on a message with multiple measures of same type)
The main collaborators of this project, came from GITUD members, sponsored by the CIDC and the IoT Unit from Ashara Studios.