stm32duino / STM32LoRaWAN

Arduino library to support LoRaWAN communication using the STM32WL series.
https://stm32duino.github.io/STM32LoRaWAN/
Other
34 stars 7 forks source link

PlatformIO project is not compiling #20

Closed larswd closed 1 year ago

larswd commented 1 year ago

Hello! I am trying to use this module to operate the LoRa device in the board "Wio E5 Mini" from Seeed studio. When including this library, however, I get several error messages relating to undeclared functions, variables and datatypes. This made me think I perhaps forgot to install some dependency, but I can't seem to figure out which dependency this would be or if the problem lies somewhere else.

The error messages I get are listed below, and I will post my code (platformio.ini and main.cpp) in an answer to this issue.

 Compiling .pio\build\nucleo_wl55jc\lib114\STM32duinoLoRaWAN\STM32CubeWL\LoRaWAN\Crypto\lorawan_aes.c.o
.pio\libdeps\nucleo_wl55jc\STM32duinoLoRaWAN\src\BSP\mw_log.cpp: In function 'void MW_LOG(MwLogTimestamp_t, MwLogLevel_t, const char*, ...)':
.pio\libdeps\nucleo_wl55jc\STM32duinoLoRaWAN\src\BSP\mw_log.cpp:45:5: error: 'vcore_debug' was not declared in this scope; did you mean 'core_debug'?
   45 |     vcore_debug(fmt, ap);
      |     ^~~~~~~~~~~
      |     core_debug
Compiling .pio\build\nucleo_wl55jc\lib114\STM32duinoLoRaWAN\STM32CubeWL\LoRaWAN\Crypto\soft-se.c.o
*** [.pio\build\nucleo_wl55jc\lib114\STM32duinoLoRaWAN\BSP\mw_log.cpp.o] Error 1
In file included from .pio\libdeps\nucleo_wl55jc\STM32duinoLoRaWAN\src\BSP\subghz.c:41:
.pio\libdeps\nucleo_wl55jc\STM32duinoLoRaWAN\src\BSP\subghz.h:50:8: error: unknown type name 'SUBGHZ_HandleTypeDef'
   50 | extern SUBGHZ_HandleTypeDef hsubghz;
      |        ^~~~~~~~~~~~~~~~~~~~
.pio\libdeps\nucleo_wl55jc\STM32duinoLoRaWAN\src\BSP\subghz.c:43:1: error: unknown type name 'SUBGHZ_HandleTypeDef'; did you mean 'UART_HandleTypeDef'?
   43 | SUBGHZ_HandleTypeDef hsubghz;
      | ^~~~~~~~~~~~~~~~~~~~
      | UART_HandleTypeDef
.pio\libdeps\nucleo_wl55jc\STM32duinoLoRaWAN\src\BSP\subghz.c: In function 'MX_SUBGHZ_Init':
.pio\libdeps\nucleo_wl55jc\STM32duinoLoRaWAN\src\BSP\subghz.c:47:10: error: request for member 'Init' in something not a structure or union
   47 |   hsubghz.Init.BaudratePrescaler = SUBGHZSPI_BAUDRATEPRESCALER_4;
      |          ^
.pio\libdeps\nucleo_wl55jc\STM32duinoLoRaWAN\src\BSP\subghz.c:47:36: error: 'SUBGHZSPI_BAUDRATEPRESCALER_4' undeclared (first use in this function); did you mean 'SPI_BAUDRATEPRESCALER_4'?
   47 |   hsubghz.Init.BaudratePrescaler = SUBGHZSPI_BAUDRATEPRESCALER_4;
      |                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                    SPI_BAUDRATEPRESCALER_4
.pio\libdeps\nucleo_wl55jc\STM32duinoLoRaWAN\src\BSP\subghz.c:47:36: note: each undeclared identifier is reported only once for each function it appears in
.pio\libdeps\nucleo_wl55jc\STM32duinoLoRaWAN\src\BSP\subghz.c:48:7: warning: implicit declaration of function 'HAL_SUBGHZ_Init'; did you mean 'MX_SUBGHZ_Init'? [-Wimplicit-function-declaration]
   48 |   if (HAL_SUBGHZ_Init(&hsubghz) != HAL_OK) {
      |       ^~~~~~~~~~~~~~~
      |       MX_SUBGHZ_Init
.pio\libdeps\nucleo_wl55jc\STM32duinoLoRaWAN\src\BSP\subghz.c: At top level:
.pio\libdeps\nucleo_wl55jc\STM32duinoLoRaWAN\src\BSP\subghz.c:54:25: error: unknown type name 'SUBGHZ_HandleTypeDef'; did you mean 'UART_HandleTypeDef'?
   54 | void HAL_SUBGHZ_MspInit(SUBGHZ_HandleTypeDef *subghzHandle)
      |                         ^~~~~~~~~~~~~~~~~~~~
      |                         UART_HandleTypeDef
.pio\libdeps\nucleo_wl55jc\STM32duinoLoRaWAN\src\BSP\subghz.c:65:27: error: unknown type name 'SUBGHZ_HandleTypeDef'; did you mean 'UART_HandleTypeDef'?
   65 | void HAL_SUBGHZ_MspDeInit(SUBGHZ_HandleTypeDef *subghzHandle)
      |                           ^~~~~~~~~~~~~~~~~~~~
      |                           UART_HandleTypeDef
.pio\libdeps\nucleo_wl55jc\STM32duinoLoRaWAN\src\BSP\subghz.c: In function 'SUBGHZ_Radio_IRQHandler':
.pio\libdeps\nucleo_wl55jc\STM32duinoLoRaWAN\src\BSP\subghz.c:78:3: warning: implicit declaration of function 'HAL_SUBGHZ_IRQHandler'; did you mean 'HAL_UART_IRQHandler'? [-Wimplicit-function-declaration]
   78 |   HAL_SUBGHZ_IRQHandler(&hsubghz);
      |   ^~~~~~~~~~~~~~~~~~~~~
      |   HAL_UART_IRQHandler
*** [.pio\build\nucleo_wl55jc\lib114\STM32duinoLoRaWAN\BSP\subghz.c.o] Error 1
larswd commented 1 year ago

Platformio.ini file:

; 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:nucleo_wl55jc]
platform = ststm32
board = nucleo_wl55jc
framework = arduino
monitor_speed = 115200
extra_scripts = post:extra_script.py
lib_deps = 
    stevemarple/MicroNMEA@^2.0.6
    stm32duino/STM32duinoLoRaWAN@^0.1.1
larswd commented 1 year ago

And main.cpp:

#include <Arduino.h>
#include "HardwareSerial.h"
#include "MicroNMEA.h"
#include "RadioLib.h"
#include <core_debug.h>
/* Write to Serial*/
HardwareSerial mySerial {PB7, PB6};
unsigned long last_millis {0};
bool state {true};
static constexpr unsigned long blink_duration {1000};

void setup(void)
{
    mySerial.begin(115200);
    delay(100);
    pinMode(PB5, OUTPUT);
    mySerial.println(F("Booted!"));

    last_millis = millis();

}

void loop(void)
{

    if (millis() - last_millis > blink_duration){
        state = !state;
        digitalWrite(PB5, state);
        last_millis += blink_duration;

        mySerial.print(F("Loop B)"));
        mySerial.println(millis());
    }

    while (mySerial.available() > 0){
        mySerial.print(mySerial.read());
    }

}
fpistm commented 1 year ago

This library requires core version 2.5.0. PIO isnot updated.