Closed Edzelf closed 1 year ago
Hi @Edzelf seems already point on the GitHub STM32CubeWL repo: https://github.com/STMicroelectronics/STM32CubeWL/issues/46 unfortunately not reproduced by our team.
I'm unable to test as I'm waiting an access to LoRa network but will have a look when available.
I'm pretty sure that random numbers did work when I was working on this library (I remember it did not work because I messed up the code and it worked when I fixed the code - fix is in this repo already since the first publish).
Looking at the report linked by @fpistm this might be related to an incorrect timeout, but that probably only surfaces in specific timings when the radio is busy when requesting a random number, which could explain why this only happens in some cases and is not very reproducible.
@Edzelf, could you try changing the value of the SUBGHZ_DEFAULT_TIMEOUT
constant to 1000U
and see if that helps? That file can be found in ~/.arduino15/packages/STMicroelectronics/hardware/stm32/2.4.0/system/Drivers/STM32WLxx_HAL_Driver/Src/stm32wlxx_hal_subghz.c
(on Linux, on Windows it is in a similar place in your AppData).
This is not a proper fix, but at least helps confirm the timeout is indeed the issue.
Changing the time-out does not make any difference. The result is always zero. I made a simple testprogram to read the RNG registers, also in this case the result was always zero. Now I found out the enabling the TCXO did the trick! I will try this in radio.c.
FYI, I've added the LoRa-E5 mini to the core: https://github.com/stm32duino/Arduino_Core_STM32/pull/1997
I've tested and had no issue to join after several reset. I've enable the TCXO in the variant like this:
// LoRaWAN definitions
#define LORAWAN_BOARD_HAS_TCXO 1U
#define LORAWAN_BOARD_HAS_DCDC 1U
#define LORAWAN_TX_CONFIG RBI_CONF_RFO_HP
#define LORAWAN_RFSWITCH_PINS PA4,PA5
#define LORAWAN_RFSWITCH_PIN_COUNT 2
#define LORAWAN_RFSWITCH_OFF_VALUES LOW,LOW
#define LORAWAN_RFSWITCH_RX_VALUES HIGH,LOW
#define LORAWAN_RFSWITCH_RFO_LP_VALUES HIGH,HIGH
#define LORAWAN_RFSWITCH_RFO_HP_VALUES LOW,HIGH
So, I close this issue as it seems linked to the configuration.
Thanks, I will test it.
I tried to install the new version. In my platformio.ini:
platform = https://github.com/stm32duino/Arduino_Core_STM32
board = LoRa-E5 mini
Error message:
Error: Could not find one of 'platform.json' manifest files in the package
Pio is not updated. The ne variant for the LoRa E5 mini is available in the main branch of the stm32 core. You can use it with Arduino IDE. Wiki explained how to use git repo.
I use this library for a "Seeed Lora-E5 mini" board. I had to make some changes for the 3 pins for the RF switches. I also had to fix the definition of "LORAWAN_TX_CONFIG", which should be "RBI_COF_RFO_HP" for this board.
The module works well: the OTAA JOIN was successful and several packets were sent.
After a reset, a new JOIN was not possible. The TTN error was “DevNonce has already been used”.
I found out that the devnonce was always "0000", so not very random. The problem is the function "SUBGRF_GetRandom()" in radio_driver.c. This function always returns a 32-bit zero value.