matthias-bs / BresserWeatherSensorLW

Bresser 868 MHz Weather Sensor Radio Receiver based on ESP32/RP2040 and SX1262/SX1276 - sends data to a LoRaWAN Network
MIT License
10 stars 1 forks source link

failing to join lorawan and other issues! #94

Closed mczakk closed 3 weeks ago

mczakk commented 1 month ago

Hi Matthias, I have been trying to connect my esp32 using this repository as i saw that BresserWeatherSensorTTN was being deprecated. I can complie the code, but it fails to join the lorawan network. Your code calls for a nwk key, but on TTN i cvan only see nwkskey. I also have other questions... this is the serial monitor output at the moment:-

17:47:00.667 -> ets Jun  8 2016 00:22:57
17:47:00.667 -> 
17:47:00.667 -> rst:0x5 (DEEPSLEEP_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
17:47:00.667 -> configsip: 188777542, SPIWP:0xee
17:47:00.667 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
17:47:00.667 -> mode:DIO, clock div:1
17:47:00.667 -> load:0x3fff0030,len:4604
17:47:00.667 -> ho 0 tail 12 room 4
17:47:00.699 -> load:0x40078000,len:15488
17:47:00.699 -> load:0x40080400,len:4
17:47:00.699 -> load:0x40080404,len:3180
17:47:00.699 -> entry 0x400805b8
17:47:00.730 -> [     1][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_RX (2) successfully set to 0x40101c40
17:47:00.730 -> [    13][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_TX (3) successfully set to 0x40101c0c
17:47:00.763 -> [    26][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_CTS (4) successfully set to 0x40101bd8
17:47:00.763 -> [    40][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_RTS (5) successfully set to 0x40101ba4
17:47:00.763 -> [    53][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_RX (2) successfully set to 0x40101c40
17:47:00.796 -> [    66][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_TX (3) successfully set to 0x40101c0c
17:47:00.796 -> [    80][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_CTS (4) successfully set to 0x40101bd8
17:47:00.828 -> [    93][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_RTS (5) successfully set to 0x40101ba4
17:47:00.828 -> [   107][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_RX (2) successfully set to 0x40101c40
17:47:00.859 -> [   120][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_TX (3) successfully set to 0x40101c0c
17:47:00.859 -> [   134][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_CTS (4) successfully set to 0x40101bd8
17:47:00.859 -> [   147][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type UART_RTS (5) successfully set to 0x40101ba4
17:47:00.892 -> E (237) esp_core_dump�xlash: Core dump data check failed:
17:47:00.892 -> Calculated checksum='a1ca788b'
17:47:00.892 -> Image checksum='ffffffff'
17:47:00.892 -> [   184][D][esp32-hal-cpu.c:264] setCpuFrequencyMhz(): PLL: 480 / 2 = 240 Mhz, APB: 80000000 Hz
17:47:00.956 -> [   217][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 3 successfully set to type UART_RX (2) with bus 0x3ffbe008
17:47:00.956 -> [   228][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 1 successfully set to type UART_TX (3) with bus 0x3ffbe008
17:47:00.956 -> =========== Before Setup Start ===========
17:47:00.956 -> Chip Info:
17:47:00.956 -> ------------------------------------------
17:47:00.988 ->   Model             : ESP32
17:47:00.988 ->   Package           : PICO-D4
17:47:00.988 ->   Revision          : 100
17:47:00.988 ->   Cores             : 2
17:47:00.988 ->   CPU Frequency     : 240 MHz
17:47:01.021 ->   XTAL Frequency    : 40 MHz
17:47:01.021 ->   Features Bitfield : 0x00000033
17:47:01.021 ->   Embedded Flash    : Yes
17:47:01.021 ->   Embedded PSRAM    : No
17:47:01.021 ->   2.4GHz WiFi       : Yes
17:47:01.021 ->   Classic BT        : Yes
17:47:01.021 ->   BT Low Energy     : Yes
17:47:01.053 ->   IEEE 802.15.4     : No
17:47:01.053 -> ------------------------------------------
17:47:01.053 -> INTERNAL Memory Info:
17:47:01.053 -> ------------------------------------------
17:47:01.053 ->   Total Size        :   261336 B ( 255.2 KB)
17:47:01.053 ->   Free Bytes        :   230092 B ( 224.7 KB)
17:47:01.085 ->   Allocated Bytes   :    25956 B (  25.3 KB)
17:47:01.085 ->   Minimum Free Bytes:   224908 B ( 219.6 KB)
17:47:01.085 ->   Largest Free Block:   110580 B ( 108.0 KB)
17:47:01.085 -> ------------------------------------------
17:47:01.085 -> Flash Info:
17:47:01.117 -> ------------------------------------------
17:47:01.117 ->   Chip Size         :  4194304 B (4 MB)
17:47:01.117 ->   Block Size        :    65536 B (  64.0 KB)
17:47:01.117 ->   Sector Size       :     4096 B (   4.0 KB)
17:47:01.117 ->   Page Size         :      256 B (   0.2 KB)
17:47:01.117 ->   Bus Speed         : 80 MHz
17:47:01.149 ->   Bus Mode          : DIO
17:47:01.149 -> ------------------------------------------
17:47:01.149 -> Partitions Info:
17:47:01.149 -> ------------------------------------------
17:47:01.149 ->                 nvs : addr: 0x00009000, size:    20.0 KB, type: DATA, subtype: NVS
17:47:01.181 ->             otadata : addr: 0x0000E000, size:     8.0 KB, type: DATA, subtype: OTA
17:47:01.181 ->                app0 : addr: 0x00010000, size:  1280.0 KB, type:  APP, subtype: OTA_0
17:47:01.215 ->                app1 : addr: 0x00150000, size:  1280.0 KB, type:  APP, subtype: OTA_1
17:47:01.215 ->              spiffs : addr: 0x00290000, size:  1408.0 KB, type: DATA, subtype: SPIFFS
17:47:01.249 ->            coredump : addr: 0x003F0000, size:    64.0 KB, type: DATA, subtype: COREDUMP
17:47:01.279 -> ------------------------------------------
17:47:01.279 -> Software Info:
17:47:01.279 -> ------------------------------------------
17:47:01.279 ->   Compile Date/Time : Aug  9 2024 17:20:12
17:47:01.279 ->   Compile Host OS   : linux
17:47:01.279 ->   ESP-IDF Version   : v5.1.4-586-gb6b4727c58-dirty
17:47:01.311 ->   Arduino Version   : 3.0.4
17:47:01.311 -> ------------------------------------------
17:47:01.311 -> Board Info:
17:47:01.311 -> ------------------------------------------
17:47:01.311 ->   Arduino Board     : TTGO_LoRa32_v21new
17:47:01.311 ->   Arduino Variant   : ttgo-lora32-v21new
17:47:01.344 ->   Arduino FQBN      : esp32:esp32:ttgo-lora32:UploadSpeed=115200,FlashFreq=80,DebugLevel=verbose,EraseFlash=none,Revision=TTGO_LoRa32_v21new
17:47:01.344 -> ============ Before Setup End ============
17:47:01.439 -> [   733][V][esp32-hal-uart.c:408] uartBegin(): UART0 baud(115200) Mode(800001c) rxPin(3) txPin(1)
17:47:01.472 -> [   742][V][esp32-hal-uart.c:497] uartBegin(): UART0 not installed. Starting installation
17:47:01.472 -> [   752][V][esp32-hal-uart.c:560] uartBegin(): UART0 initialization done.
17:47:03.501 -> [  2767][I][BresserWeatherSensorLW_Aug_24.ino:490] setup(): Setup
17:47:03.501 -> [  2775][E][vfs_api.cpp:99] open(): /littlefs/node_config.json does not exist, no permits for creation
17:47:03.501 -> [  2784][I][LoadNodeCfg.cpp:74] loadNodeCfg(): File 'node_config.json' not found.
17:47:03.501 -> [  2791][D][LoadNodeCfg.cpp:122] loadNodeCfg(): Timezone: GMT+0BST-1,M3.5.0/01:00:00,M10.5.0/02:00:00
17:47:03.534 -> [  2800][D][LoadNodeCfg.cpp:123] loadNodeCfg(): Battery weak:            3500 mV
17:47:03.534 -> [  2807][D][LoadNodeCfg.cpp:124] loadNodeCfg(): Battery low:             3200 mV
17:47:03.534 -> [  2814][D][LoadNodeCfg.cpp:125] loadNodeCfg(): Battery discharge limit: 3200 mV
17:47:03.534 -> [  2822][D][LoadNodeCfg.cpp:126] loadNodeCfg(): Battery charge limit:    4200 mV
17:47:03.534 -> [  2829][D][LoadNodeCfg.cpp:127] loadNodeCfg(): PowerFeather
17:47:03.567 -> [  2834][D][LoadNodeCfg.cpp:128] loadNodeCfg():   Battery capacity:           0 mAh
17:47:03.567 -> [  2841][D][LoadNodeCfg.cpp:129] loadNodeCfg():   Supply maintain voltage:    0 mV
17:47:03.567 -> [  2849][D][LoadNodeCfg.cpp:130] loadNodeCfg():   Max. charge current:        0 mA
17:47:03.567 -> [  2856][D][LoadNodeCfg.cpp:131] loadNodeCfg():   Temperature measurement: false
17:47:03.567 -> [  2863][D][LoadNodeCfg.cpp:132] loadNodeCfg():   Battery fuel gauge:      false
17:47:03.598 -> [  2870][I][BresserWeatherSensorLW_Aug_24.ino:256] print_wakeup_reason(): Wake from sleep
17:47:03.598 -> [  2878][I][BresserWeatherSensorLW_Aug_24.ino:547] setup(): Boot count: 8
17:47:03.598 -> [  2886][I][BresserWeatherSensorLW_Aug_24.ino:378] printDateTime(): 1970-01-01 00:25:46
17:47:03.598 -> [  2893][W][LittleFS.cpp:67] begin(): LittleFS Already Mounted!
17:47:03.631 -> [  2900][E][vfs_api.cpp:99] open(): /littlefs/secrets.json does not exist, no permits for creation
17:47:03.631 -> [  2909][I][LoadSecrets.cpp:62] loadSecrets(): File 'secrets.json' not found.
17:47:03.631 -> [  2916][V][Preferences.cpp:375] getUChar(): nvs_get_u8 fail: maxsensors NOT_FOUND
17:47:03.631 -> [  2924][V][Preferences.cpp:375] getUChar(): nvs_get_u8 fail: rxflags NOT_FOUND
17:47:03.663 -> [  2931][V][Preferences.cpp:375] getUChar(): nvs_get_u8 fail: endec NOT_FOUND
17:47:03.663 -> [  2938][D][WeatherSensor.cpp:143] begin(): max_sensors: 5
17:47:03.663 -> [  2943][D][WeatherSensor.cpp:144] begin(): rx_flags: 1
17:47:03.663 -> [  2948][D][WeatherSensor.cpp:145] begin(): en_decoders: 255
17:47:03.663 -> [  2953][D][WeatherSensorConfig.cpp:58] initList(): Key exc in preferences? 0
17:47:03.663 -> [  2961][D][WeatherSensorConfig.cpp:84] initList(): Using sensor_ids_exc list from WeatherSensorCfg.h
17:47:03.697 -> [  2970][D][WeatherSensorConfig.cpp:91] initList(): 792882A2
17:47:03.697 -> [  2975][D][WeatherSensorConfig.cpp:58] initList(): Key inc in preferences? 0
17:47:03.697 -> [  2982][D][WeatherSensorConfig.cpp:84] initList(): Using sensor_ids_inc list from WeatherSensorCfg.h
17:47:03.727 -> [  2991][D][WeatherSensor.cpp:161] begin(): [SX1276] Initializing ... 
17:47:03.727 -> [  2998][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type SPI_MASTER_SCK (37) successfully set to 0x40100da0
17:47:03.727 -> [  3010][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type SPI_MASTER_MISO (38) successfully set to 0x40100cc0
17:47:03.759 -> [  3022][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type SPI_MASTER_MOSI (39) successfully set to 0x40100bdc
17:47:03.759 -> [  3034][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type SPI_MASTER_SS (40) successfully set to 0x40100aa8
17:47:03.759 -> [  3046][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type GPIO (1) successfully set to 0x40156a18
17:47:03.791 -> [  3057][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 5 successfully set to type GPIO (1) with bus 0x6
17:47:03.791 -> [  3067][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 5 successfully set to type SPI_MASTER_SCK (37) with bus 0x4
17:47:03.791 -> [  3077][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type GPIO (1) successfully set to 0x40156a18
17:47:03.791 -> [  3088][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 19 successfully set to type GPIO (1) with bus 0x14
17:47:03.823 -> [  3098][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 19 successfully set to type SPI_MASTER_MISO (38) with bus 0x4
17:47:03.823 -> [  3109][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type GPIO (1) successfully set to 0x40156a18
17:47:03.823 -> [  3120][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 27 successfully set to type GPIO (1) with bus 0x1c
17:47:03.855 -> [  3130][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 27 successfully set to type SPI_MASTER_MOSI (39) with bus 0x4
17:47:03.855 -> [  3141][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type GPIO (1) successfully set to 0x40156a18
17:47:03.855 -> [  3152][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 18 successfully set to type GPIO (1) with bus 0x13
17:47:03.887 -> [  3161][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type GPIO (1) successfully set to 0x40156a18
17:47:03.887 -> [  3172][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 26 successfully set to type GPIO (1) with bus 0x1b
17:47:03.887 -> [  3182][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type GPIO (1) successfully set to 0x40156a18
17:47:03.919 -> [  3193][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 33 successfully set to type GPIO (1) with bus 0x22
17:47:03.919 -> [  3203][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type GPIO (1) successfully set to 0x40156a18
17:47:03.955 -> [  3214][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 23 successfully set to type GPIO (1) with bus 0x18
17:47:03.955 -> [  3239][D][WeatherSensor.cpp:177] begin(): success!
17:47:03.955 -> [  3245][D][WeatherSensor.cpp:222] begin(): [SX1276] Setup complete - awaiting incoming messages...
17:47:03.991 -> [  3261][V][Preferences.cpp:375] getUChar(): nvs_get_u8 fail: ws_timeout NOT_FOUND
17:47:03.991 -> [  3269][D][PayloadBresser.cpp:84] begin(): Preferences: weathersensor_timeout: 180 s
17:47:03.991 -> [  3276][I][PayloadBresser.cpp:87] begin(): Waiting for Weather Sensor Data; timeout 180 s
17:47:12.780 -> [ 12068][V][WeatherSensor.cpp:349] getMessage(): [SX1276] Data: D4 17 65 38 05 35 05 18 FF 99 FF 30 08 FE CF D7 FF 01 FD AA 00 00 00 00 00 00 00 
17:47:12.813 -> [ 12081][D][WeatherSensor.cpp:351] getMessage(): [SX1276] R [D4] RSSI: -74.0
17:47:12.813 -> [ 12088][D][WeatherSensorDecoders.cpp:708] decodeBresser7In1Payload(): Data sanity check failed
17:47:12.813 -> [ 12096][D][WeatherSensorDecoders.cpp:723] decodeBresser7In1Payload(): Digest check failed - [BDCF] vs [FDC5] (400A)
17:47:12.813 -> [ 12107][V][WeatherSensorDecoders.cpp:67] findSlot(): find_slot(): ID=38053505
17:47:12.813 -> [ 12114][D][WeatherSensorDecoders.cpp:105] findSlot(): sensor[0]: v=0 id=0x00000000 t=0 c=0
17:47:12.845 -> [ 12122][D][WeatherSensorDecoders.cpp:105] findSlot(): sensor[1]: v=0 id=0x00000000 t=0 c=0
17:47:12.845 -> [ 12130][D][WeatherSensorDecoders.cpp:105] findSlot(): sensor[2]: v=0 id=0x00000000 t=0 c=0
17:47:12.877 -> [ 12138][D][WeatherSensorDecoders.cpp:105] findSlot(): sensor[3]: v=0 id=0x00000000 t=0 c=0
17:47:12.877 -> [ 12146][D][WeatherSensorDecoders.cpp:105] findSlot(): sensor[4]: v=0 id=0x00000000 t=0 c=0
17:47:12.877 -> [ 12154][V][WeatherSensorDecoders.cpp:130] findSlot(): find_slot(): Storing into slot #0
17:47:12.877 -> [ 12162][D][WeatherSensorDecoders.cpp:582] decodeBresser6In1Payload(): Flags: Temp=0  Hum=0  Wind=1  Rain=1  UV=0
17:47:24.800 -> [ 24075][V][WeatherSensor.cpp:349] getMessage(): [SX1276] Data: D4 13 96 38 05 35 05 18 FE FF FE 29 68 20 96 61 FF F0 DE AA 00 00 00 00 00 00 00 
17:47:24.800 -> [ 24087][D][WeatherSensor.cpp:351] getMessage(): [SX1276] R [D4] RSSI: -72.5
17:47:24.800 -> [ 24094][D][WeatherSensorDecoders.cpp:708] decodeBresser7In1Payload(): Data sanity check failed
17:47:24.832 -> [ 24103][D][WeatherSensorDecoders.cpp:723] decodeBresser7In1Payload(): Digest check failed - [B93C] vs [D52B] (6C17)
17:47:24.832 -> [ 24113][V][WeatherSensorDecoders.cpp:67] findSlot(): find_slot(): ID=38053505
17:47:24.832 -> [ 24120][D][WeatherSensorDecoders.cpp:105] findSlot(): sensor[0]: v=1 id=0x38053505 t=1 c=0
17:47:24.832 -> [ 24128][D][WeatherSensorDecoders.cpp:105] findSlot(): sensor[1]: v=0 id=0x00000000 t=0 c=0
17:47:24.865 -> [ 24136][D][WeatherSensorDecoders.cpp:105] findSlot(): sensor[2]: v=0 id=0x00000000 t=0 c=0
17:47:24.865 -> [ 24144][D][WeatherSensorDecoders.cpp:105] findSlot(): sensor[3]: v=0 id=0x00000000 t=0 c=0
17:47:24.865 -> [ 24152][D][WeatherSensorDecoders.cpp:105] findSlot(): sensor[4]: v=0 id=0x00000000 t=0 c=0
17:47:24.865 -> [ 24161][V][WeatherSensorDecoders.cpp:123] findSlot(): find_slot(): Updating slot #0
17:47:24.897 -> [ 24168][D][WeatherSensorDecoders.cpp:582] decodeBresser6In1Payload(): Flags: Temp=1  Hum=1  Wind=1  Rain=0  UV=1
17:47:24.897 -> [ 24178][I][PayloadBresser.cpp:90] begin(): Receiving Weather Sensor Data o.k.
17:47:24.897 -> [ 24186][E][Preferences.cpp:526] getBytesLength(): nvs_get_blob len fail: ble NOT_FOUND
17:47:24.897 -> [ 24193][E][Preferences.cpp:526] getBytesLength(): nvs_get_blob len fail: ble NOT_FOUND
17:47:24.929 -> [ 24201][D][PayloadBLE.cpp:118] bleAddrInit(): Using BLE addresses from BresserWeatherSensorLWCfg.h:
17:47:24.929 -> [ 24210][D][PayloadBLE.cpp:129] bleAddrInit(): a4:c1:38:b8:1f:7f
17:47:24.929 -> [ 24216][V][Preferences.cpp:399] getUShort(): nvs_get_u16 fail: sleep_int NOT_FOUND
17:47:24.929 -> [ 24224][D][BresserWeatherSensorLW_Aug_24.ino:568] setup(): Preferences: sleep_interval:        360 s
17:47:24.960 -> [ 24233][V][Preferences.cpp:399] getUShort(): nvs_get_u16 fail: sleep_int_long NOT_FOUND
17:47:24.960 -> [ 24241][D][BresserWeatherSensorLW_Aug_24.ino:570] setup(): Preferences: sleep_interval_long:   900 s
17:47:24.960 -> [ 24250][V][Preferences.cpp:375] getUChar(): nvs_get_u8 fail: lw_stat_int NOT_FOUND
17:47:24.960 -> [ 24257][D][BresserWeatherSensorLW_Aug_24.ino:572] setup(): Preferences: lw_stat_interval:      60 cycles
17:47:24.994 -> [ 24267][V][esp32-hal-periman.c:235] perimanSetBusDeinit(): Deinit function for type ADC_ONESHOT (7) successfully set to 0x400ff310
17:47:24.994 -> [ 24278][V][esp32-hal-periman.c:160] perimanSetPinBus(): Pin 35 successfully set to type ADC_ONESHOT (7) with bus 0x24
17:47:24.994 -> [ 24289][D][esp32-hal-adc.c:305] __analogReadMilliVolts(): Creating cali handle for ADC_0
17:47:25.025 -> [ 24297][D][adc.cpp:76] getVoltage(): Voltage = 4135mV
17:47:25.025 -> [ 24302][V][AppLayer.cpp:97] getPayloadStage1(): Port: 1
17:47:25.025 -> [ 24307][I][AppLayer.cpp:99] getPayloadStage1(): --- Uplink Data ---
17:47:25.025 -> [ 24314][I][PayloadBresser.cpp:335] encodeWeatherSensor(): Air Temperature:    20.9 °C
17:47:25.025 -> [ 24322][I][PayloadBresser.cpp:347] encodeWeatherSensor(): Humidity:            61   %
17:47:25.057 -> [ 24329][I][PayloadBresser.cpp:360] encodeWeatherSensor(): Rain Gauge:        1302.8 mm
17:47:25.057 -> [ 24337][I][PayloadBresser.cpp:373] encodeWeatherSensor(): Wind Speed (avg.):    1.0 m/s
17:47:25.057 -> [ 24345][I][PayloadBresser.cpp:374] encodeWeatherSensor(): Wind Speed (max.):    1.0 m/s
17:47:25.057 -> [ 24353][I][PayloadBresser.cpp:375] encodeWeatherSensor(): Wind Direction:     296.0 °
17:47:25.089 -> [ 24361][I][PayloadBresser.cpp:394] encodeWeatherSensor(): UV Index:            0.0
17:47:25.089 -> [ 24368][I][PayloadBresser.cpp:462] encodeWeatherSensor(): Current rain gauge statistics not valid.
17:47:25.089 -> [ 24377][I][PayloadBresser.cpp:249] encodeBresser(): Thermo/Hygro Sensor Ch 1
17:47:25.121 -> [ 24389][I][PayloadBresser.cpp:249] encodeBresser(): Soil Sensor Ch 1
17:47:25.121 -> [ 24396][I][PayloadBresser.cpp:253] encodeBresser(): -- Failure
17:47:25.121 -> [ 24401][I][PayloadBresser.cpp:249] encodeBresser(): Lightning Sensor Ch 5
17:47:25.121 -> [ 24408][I][PayloadBresser.cpp:253] encodeBresser(): -- Failure
17:47:25.155 -> [ 24414][D][adc.cpp:76] getVoltage(): Voltage = 4224mV
17:47:25.155 -> [ 24419][I][PayloadAnalog.cpp:63] encodeAnalog(): ch 00: U_batt: 4224 mv
17:47:25.155 -> [ 24426][V][Preferences.cpp:375] getUChar(): nvs_get_u8 fail: ble_active NOT_FOUND
17:47:25.155 -> [ 24433][V][Preferences.cpp:375] getUChar(): nvs_get_u8 fail: ble_scantime NOT_FOUND
17:47:25.155 -> [ 24440][D][PayloadBLE.cpp:150] encodeBLE(): Preferences: ble_active: 1
17:47:25.155 -> [ 24447][D][PayloadBLE.cpp:151] encodeBLE(): Preferences: ble_scantime: 31 s
17:47:25.347 -> I NimBLEDevice: BLE Host Task Started
17:47:25.381 -> I NimBLEDevice: NimBle host synced.
17:47:25.381 -> D NimBLEScan: >> start: duration=31
17:47:25.381 -> D NimBLEScan: << start()
17:47:26.055 -> I NimBLEScan: New advertiser: 49:91:b0:79:6e:5b
17:47:26.055 -> I NimBLEScan: Updated advertiser: 49:91:b0:79:6e:5b
17:47:26.055 -> [ 25343][V][BleSensors.cpp:76] onResult(): Advertised Device: Name: LE-Midnight, Address: 49:91:b0:79:6e:5b, manufacturer data: 0106010eb585985f69, serviceUUID: 0xfebe, txPower: 10
17:47:26.252 -> D NimBLEScan: erase device: 49:91:b0:79:6e:5b
17:47:26.252 -> I NimBLEScan: New advertiser: 38:c9:7f:66:e1:00
17:47:26.252 -> [ 25510][V][BleSensors.cpp:76] onResult(): Advertised Device: Name: , Address: 38:c9:7f:66:e1:00, manufacturer data: 06000109210a03f1e18c4124574e4232303030303731
17:47:26.343 -> D NimBLEScan: erase device: 38:c9:7f:66:e1:00
17:47:26.375 -> I NimBLEScan: New advertiser: 6e:73:74:f3:12:6b
17:47:26.375 -> I NimBLEScan: Updated advertiser: 6e:73:74:f3:12:6b
17:47:26.375 -> [ 25660][V][BleSensors.cpp:76] onResult(): Advertised Device: Name: LE-Moon Boots, Address: 6e:73:74:f3:12:6b, manufacturer data: 010c02064c22361d0d, serviceUUID: 0xfebe, txPower: 10
17:47:26.540 -> D NimBLEScan: erase device: 6e:73:74:f3:12:6b
17:47:26.859 -> I NimBLEScan: New advertiser: 67:9e:69:d6:74:53
17:47:26.859 -> I NimBLEScan: Updated advertiser: 67:9e:69:d6:74:53
17:47:26.859 -> [ 26124][V][BleSensors.cpp:76] onResult(): Advertised Device: Name: LE-OpenRun Pro
17:47:26.987 -> D NimBLEScan: erase device: 67:9e:69:d6:74:53
17:47:56.391 -> D NimBLEScan: discovery complete; reason=0
17:47:56.391 -> [ 55653][I][PayloadBLE.cpp:180] encodeBLE(): Indoor Air Temp.:    --.- °C
17:47:56.391 -> [ 55663][I][PayloadBLE.cpp:181] encodeBLE(): Indoor Humidity:     --   %
17:47:56.391 -> [ 55669][V][BresserWeatherSensorLW_Aug_24.ino:593] setup(): Initalise the radio
17:47:56.450 -> [ 55698][D][BresserWeatherSensorLW_Aug_24.ino:393] lwActivate(): Recalling LoRaWAN nonces & session
17:47:56.450 -> [ 55709][W][config.h:402] debug(): Restoring nonces buffer failed - RADIOLIB_LORAWAN_NONCES_DISCARDED (-1119)
17:47:56.456 -> [ 55719][W][config.h:402] debug(): Restoring session buffer failed - RADIOLIB_ERR_NETWORK_NOT_JOINED (-1101)
17:47:56.456 -> [ 55729][D][BresserWeatherSensorLW_Aug_24.ino:433] lwActivate(): Join ('login') to the LoRaWAN Network
17:48:03.567 -> [ 62845][D][BresserWeatherSensorLW_Aug_24.ino:437] lwActivate(): Saving nonces to flash
17:48:03.567 -> [ 62854][D][BresserWeatherSensorLW_Aug_24.ino:447] lwActivate(): Join failed: -1116
17:48:03.567 -> [ 62861][I][BresserWeatherSensorLW_Aug_24.ino:454] lwActivate(): Boots since unsuccessful join: 8
17:48:03.600 -> [ 62870][I][BresserWeatherSensorLW_Aug_24.ino:455] lwActivate(): Retrying join in 180 seconds
17:48:03.600 -> [ 62878][I][BresserWeatherSensorLW_Aug_24.ino:319] gotoSleep(): Sleeping for 180 s
mczakk commented 1 month ago

OK, i've resolved one issue, the device had to be re registered as a lorawan version 1.1, this now shows me a nwk key, but still wont join 11:56:43.488 -> [183476][V][BresserWeatherSensorLW_Aug_24.ino:593] setup(): Initalise the radio 11:56:43.522 -> [183502][D][BresserWeatherSensorLW_Aug_24.ino:393] lwActivate(): Recalling LoRaWAN nonces & session 11:56:43.522 -> [183513][W][config.h:402] debug(): Restoring nonces buffer failed - RADIOLIB_LORAWAN_NONCES_DISCARDED (-1119) 11:56:43.522 -> [183524][W][config.h:402] debug(): Restoring session buffer failed - RADIOLIB_ERR_NETWORK_NOT_JOINED (-1101) 11:56:43.522 -> [183533][D][BresserWeatherSensorLW_Aug_24.ino:433] lwActivate(): Join ('login') to the LoRaWAN Network 11:56:50.642 -> [190646][D][BresserWeatherSensorLW_Aug_24.ino:437] lwActivate(): Saving nonces to flash 11:56:50.754 -> [190655][D][BresserWeatherSensorLW_Aug_24.ino:447] lwActivate(): Join failed: -1116

is there a setting i'm missing?

matthias-bs commented 1 month ago

Did you look up the error code in RadioLib?

mczakk commented 1 month ago

the only error code listed is -1116 'no downlink after uplink', heres the serial monitor lines: 09:36:42.375 -> [183471][V][BresserWeatherSensorLW_Aug_24.ino:593] setup(): Initalise the radio 09:36:42.407 -> [183497][D][BresserWeatherSensorLW_Aug_24.ino:393] lwActivate(): Recalling LoRaWAN nonces & session 09:36:42.407 -> [183508][W][config.h:402] debug(): Restoring nonces buffer failed - RADIOLIB_LORAWAN_NONCES_DISCARDED (-1119) 09:36:42.439 -> [183519][W][config.h:402] debug(): Restoring session buffer failed - RADIOLIB_ERR_NETWORK_NOT_JOINED (-1101) 09:36:42.439 -> [183528][D][BresserWeatherSensorLW_Aug_24.ino:433] lwActivate(): Join ('login') to the LoRaWAN Network 09:36:49.563 -> [190641][D][BresserWeatherSensorLW_Aug_24.ino:437] lwActivate(): Saving nonces to flash 09:36:49.563 -> [190650][D][BresserWeatherSensorLW_Aug_24.ino:447] lwActivate(): Join failed: -1116 09:36:49.563 -> [190657][I][BresserWeatherSensorLW_Aug_24.ino:454] lwActivate(): Boots since unsuccessful join: 354 09:36:49.563 -> [190666][I][BresserWeatherSensorLW_Aug_24.ino:455] lwActivate(): Retrying join in 180 seconds

more fundamentally the code now won't compile, give the error : /home/matt/Arduino/Sketches/BresserWeatherSensorLW_Ll1/BresserWeatherSensorLW_Aug_24/BresserWeatherSensorLW_Aug_24.ino: In function 'int16_t lwActivate()': /home/matt/Arduino/Sketches/BresserWeatherSensorLW_Ll1/BresserWeatherSensorLW_Aug_24/BresserWeatherSensorLW_Aug_24.ino:391:3: error: 'node' was not declared in this scope 391 | node.beginOTAA(joinEUI, devEUI, nwkKey, appKey); | ^~~~ i tried compiling the bare code with no modifications and it doesn't like that either, won't find 'logging.h', even though it's in the correct place!

mczakk commented 1 month ago

OK, so i discovered that i was missing a config.h file and the 'node not declared' error is now gone. Now i get the error:

/home/matt/Arduino/Sketches/BresserWeatherSensorLW_Aug_24/secrets.h:3:42: error: expected unqualified-id before numeric constant
    3 | #define RADIOLIB_LORAWAN_JOIN_EUI  0xB7, 0xC8, 0x56, 0x80, 0x23, 0x74, 0xA1, 0x69
      |                                          ^~~~
/home/matt/Arduino/Sketches/BresserWeatherSensorLW_Aug_24/secrets.h:3:42: note: in definition of macro 'RADIOLIB_LORAWAN_JOIN_EUI'
    3 | #define RADIOLIB_LORAWAN_JOIN_EUI  0xB7, 0xC8, 0x56, 0x80, 0x23, 0x74, 0xA1, 0x69
      |                                          ^~~~
/home/matt/Arduino/Sketches/BresserWeatherSensorLW_Aug_24/secrets.h:9:42: error: expected unqualified-id before numeric constant
    9 | #define RADIOLIB_LORAWAN_DEV_EUI   0x70, 0xB3, 0xD5, 0x7E, 0xD0, 0x06, 0x9B, 0x1C
      |                                          ^~~~
/home/matt/Arduino/Sketches/BresserWeatherSensorLW_Aug_24/secrets.h:9:42: note: in definition of macro 'RADIOLIB_LORAWAN_DEV_EUI'
    9 | #define RADIOLIB_LORAWAN_DEV_EUI   0x70, 0xB3, 0xD5, 0x7E, 0xD0, 0x06, 0x9B, 0x1C
      |                                          ^~~~

chatgpt suggests that his is because the array is declared incorrectly, and that i should define the values in an array in the 'secrets.h' file, buty tyrying to do this just causes loads more problems

mczakk commented 1 month ago

Next update:- had to amend the config.h file

// Copy over the EUI's & keys in to the something that will not compile if incorrectly formatted
uint64_t joinEUI[8] =   {RADIOLIB_LORAWAN_JOIN_EUI};
uint64_t devEUI[8]  =   {RADIOLIB_LORAWAN_DEV_EUI};
uint8_t appKey[16] = { RADIOLIB_LORAWAN_APP_KEY };
uint8_t nwkKey[16] = { RADIOLIB_LORAWAN_NWK_KEY };

and the call to node.beginOTAA:

 // setup the OTAA session information
  node.beginOTAA((uint64_t)joinEUI, (uint64_t)devEUI, nwkKey, appKey);

but it now compiles correctly, but still wont connect to ttn. I've tried entering the nwk and app keys in reverse too, still no luck!

matthias-bs commented 4 weeks ago

Did you read this? README.md#required-configuration The preferred way is to add your credentials in secrets.h (just follow the example for formatting) or - if you have multiple nodes - see README.md#loading-lorawan-network-service-credentials-from-file (again with a template which shows the formatting).

If you are still not able to join, you might have a look at the RadioLib documentation / wiki / discussion pages. I think this is a common problem. BresserWeatherSensorLW is identical to the RadioLib examples (or https://github.com/radiolib-org/radiolib-persistence to be precise) as far as this part is concerned, so you might also try those first.

Do you get any hints on the TTN console?

mczakk commented 4 weeks ago

i've tried a completeley fresh install of BresserWeatherSensorLW-0.9.1 and i get the error

    3 | #define RADIOLIB_LORAWAN_JOIN_EUI  0xB7, 0xC8, 0x56, 0x80, 0x23, 0x74, 0xA1, 0x69

line 391 0f BresserWeatherSensorLW.ino shows that the variable 'joinEUI' is a single value, not the join eui listed in 'secrets.h' (screenshot shows this) bwsss and will not compile at all. adding the changes to config.h and BresserWeatherSensorLW that i mentioned in my comment yesterday does make it compile ok, if you also comment out line 561 in BresserWeatherSensorLW (I'm not using LittleFS antway),. this screenshot shows that line 391 now seems to have a correct value for joinEUI: bwsss2

now i'm just trying to determine what is being sent to TTN to join the network how do i get log_d to print the variable joinEUI?

mczakk commented 4 weeks ago

Also, its now throwing the error

home/matt/Arduino/libraries/BresserWeatherSensorLW-0.9.1/BresserWeatherSensorLW/src/PayloadBresser.cpp: In member function 'void PayloadBresser::encodeWeatherSensor(int, uint8_t, LoraEncoder&)':
/home/matt/Arduino/libraries/BresserWeatherSensorLW-0.9.1/BresserWeatherSensorLW/src/PayloadBresser.cpp:376:65: error: 'struct WeatherSensor::Weather' has no member named 'wind_avg_meter_sec_fp1'; did you mean 'wind_avg_meter_sec'?
  376 |                 encoder.writeUint16(weatherSensor.sensor[idx].w.wind_avg_meter_sec_fp1);
      |                                                                 ^~~~~~~~~~~~~~~~~~~~~~

which is a totally new on!!

matthias-bs commented 4 weeks ago

The JoinEUI and the DevEUI must be specified as uint64_t values, just as in https://github.com/matthias-bs/BresserWeatherSensorLW/blob/main/secrets.h. Just a single hex value with 16 digits. Not a comma separated array of bytes.

See https://github.com/matthias-bs/BresserWeatherSensorLW/blob/4facfd28ac5cfa705bd8d7287bd82943e6bc8fd2/src/LoadSecrets.cpp#L94 for printing the JoinEUI. It's already in the code!

It seems you have commented out the define WIND_DATA_FIXEDPOINT in WeatherSensorCfg.h

matthias-bs commented 4 weeks ago

Next update:- had to amend the config.h file

// Copy over the EUI's & keys in to the something that will not compile if incorrectly formatted
uint64_t joinEUI[8] =   {RADIOLIB_LORAWAN_JOIN_EUI};
uint64_t devEUI[8]  =   {RADIOLIB_LORAWAN_DEV_EUI};
uint8_t appKey[16] = { RADIOLIB_LORAWAN_APP_KEY };
uint8_t nwkKey[16] = { RADIOLIB_LORAWAN_NWK_KEY };

Well, you mixed things up in the first two lines. Please revert your changes and check the original code.

mczakk commented 4 weeks ago

don't know how that happened, but i now have connection to ttn :)

trying to sort out the uplink formatter now, i get values sent to ttn, but they're not being translated by the formatter correctly

matthias-bs commented 3 weeks ago

Problems solved or given up?

mczakk commented 3 weeks ago

Connection solved, 😁 Opened another issue for message accessibility!