Microchip WLR089 ASF LoRaWAN library initialization
I'm trying to implement to minimal LoRaWAN setup for my WLR089 xplained pro. I've set up a simple project using the ASF wizard in Microchip studio 7. I have all the necessary libraries included for my current main program. I've used the lorawan.h
library found in the ASF Wizard listings for the WLR089.
My program compiles, but I'm confused about the parameters for LORAWAN_Init();
function. In the other examples provided by the default WLR089 ASF projects, this function isn't given any arguments, but the documentation gives two parameters for function pointers: a downlink callback and a join response callback.
Here is my main.c:
#include <asf.h>#include "lorawan.h"#define EU_BAND 1static uint8_t DeviceEUI[8] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };static uint8_t ApplicationEUI[8] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };static uint8_t ApplicationKey[16] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };static void init_system(void){ system_init(); delay_init();}static void init_lorawan(void){ LORAWAN_Init(NULL,NULL);//THIS HERE// LORAWAN_SetAttr(DEV_EUI, DeviceEUI); LORAWAN_SetAttr(JOIN_EUI,ApplicationEUI); LORAWAN_SetAttr(APP_KEY, ApplicationKey); LORAWAN_SetAttr(EDCLASS,0); LORAWAN_SetAttr(ADR,1);}static void join_network(void){ bool joined = false; while (!joined) { joined = LORAWAN_Join(LORAWAN_OTAA) == LORAWAN_SUCCESS; if (!joined) { delay_ms(5000); } }}static void send_message(void){ uint8_t payload[] = "TESTING"; struct _LorawanSendReq req = {LORAWAN_CNF, 1, (char*)payload, sizeof(payload)-1}; if(LORAWAN_Send(&req) == LORAWAN_SUCCESS){ delay_ms(100); }}int main(void){ init_system(); init_lorawan(); join_network(); while (1) { send_message(); delay_ms(300000); }}
Is it necessary to give function callbacks for the initialization? Will my program work without them?
All Replies
-
The Microchip WLR089 LoRaWAN library initialization involves a series of steps within the ASF (Atmel Software Framework) environment, including driver initialization, stack initialization, and application/LoRaWAN initialization. These steps are crucial for setting up the hardware and software components needed for LoRaWAN communication on the WLR089 module.
0
Categories
- All Categories
- 435 Beta Program
- 2.7K Nebula
- 175 Nebula Ideas
- 117 Nebula Status and Incidents
- 6.1K Security
- 422 USG FLEX H Series
- 297 Security Ideas
- 1.6K Switch
- 78 Switch Ideas
- 1.2K Wireless
- 44 Wireless Ideas
- 6.7K Consumer Product
- 272 Service & License
- 418 News and Release
- 88 Security Advisories
- 31 Education Center
- 10 [Campaign] Zyxel Network Detective
- 4.2K FAQ
- 34 Documents
- 34 Nebula Monthly Express
- 83 About Community
- 89 Security Highlight