stm32duino / STM32LoRaWAN

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

Complie fails #43

Closed fabltd closed 3 weeks ago

fabltd commented 3 weeks ago

Lib fails to compile when using an STM32WL55JC.

define LORAWAN_RFSWITCH_PINS PC3,PC4,PC5

src/BSP/radio_board_if.c:75:33: error: 'PC3' undeclared here (not in a function); did you mean 'PC_3'?
   75 |   #define LORAWAN_RFSWITCH_PINS PC3,PC4,PC5

Is there a recommend overide for the pin definition. I don't see it documented?

fabltd commented 3 weeks ago

Assume I need to override this section:

#if !defined(LORAWAN_RFSWITCH_PINS)
  #define LORAWAN_RFSWITCH_PINS PC3,PC4,PC5
  #define LORAWAN_RFSWITCH_PIN_COUNT 3
  #define LORAWAN_RFSWITCH_OFF_VALUES LOW,LOW,LOW
  #define LORAWAN_RFSWITCH_RX_VALUES HIGH,HIGH,LOW
  #define LORAWAN_RFSWITCH_RFO_LP_VALUES HIGH,HIGH,HIGH
  #define LORAWAN_RFSWITCH_RFO_HP_VALUES HIGH,LOW,HIGH
#endif

The datasheet for the board I am using STM32WL5MOC Dev board Page 18

Has a truth table that gives the pin - SW_RF, PC5, PC3

Not sure what order these should be in?

Updated my code block as follows:

#define LORAWAN_RFSWITCH_PINS SW_RF, PC5, PC3
#define LORAWAN_RFSWITCH_PIN_COUNT 3
#define LORAWAN_RFSWITCH_OFF_VALUES LOW, LOW, LOW
#define LORAWAN_RFSWITCH_RFO_HP_VALUES LOW, HIGH, HIGH
#define LORAWAN_RFSWITCH_RFO_LP_VALUES HIGH, LOW, HIGH
#define LORAWAN_RFSWITCH_RX_VALUES HIGH, HIGH, HIGH

In my main INO file but it seems the lib is still initalised with the default values? What am I missing

fpistm commented 3 weeks ago

Hi @fabltd This is not a bug. Could you be more precise about what you do?

Board selected, sketch used and modification,....

fabltd commented 3 weeks ago

Please see the second message i posted. I describe the board and issue in detail.

I am trying to get the lib to work with a STM32WL55JC.

There is no discussion in the docs as to how to re allocate the RF_SWITCH pins. I would consider this a bug as it has lead to me needing to post this issue.

fpistm commented 3 weeks ago

You didn't answer the question. Which sketch you used? Where are the modification? Which board you select? Nucleo? Generic?.... I can't help with the information you gave....

fabltd commented 3 weeks ago

Sorry I thought I did I gave a link to the board:

Its a B-WL5M-SUBG1 its configured in the Ardunio IDE as

I have also tried GENERIC WL5MOCHx

I need to overide the default pins specified for the RF switching but not sure where to add the code.

The data sheet has a pin named SW_RF but this seems to be SW_CTL.

Neither definition seems to work so maybe missing from the board specficaiton?

fabltd commented 3 weeks ago

Found the following repo B-ML5W this has the required changes to the board package to now get the lib to complie and print out the device EUI.

However connection fails. No Idea why?

Is there any debugging to find out the source of the failure. I am in range of the GW and the device EUI is registered with the network.

I still think the RF power settings are wrong though as they don't match the datasheet.

fpistm commented 3 weeks ago

@fabltd don't know how you get a compilation failed, probably you try to define the LORAWAN_RFSWITCH_PINS in a wrong place. To properly define those definition you can follow one of those wiki:

I have also tried GENERIC WL5MOCHx

As stated on the forum this one is not available. So except if you add it I don't understand how you have tried it. Maybe using the files provided by the repo you gave above?

About the connection fails hard to tell. If the RF power settings if wrong then you have to update it as stated above. To debug you can use Arduino IDE 2.x by enabling the "Optimize for Debugging" in the Sketch menu then after Upload your sketch launch the debug using the "Start Debugging" button.

Looking quickly at the user manual it seems the default RF config is not correct for this board, I would set it as:

  #define LORAWAN_RFSWITCH_PINS PC3,PC4,PC5
  #define LORAWAN_RFSWITCH_PIN_COUNT 3
  #define LORAWAN_RFSWITCH_OFF_VALUES LOW,LOW,LOW
  #define LORAWAN_RFSWITCH_RX_VALUES HIGH,HIGH,HIGH
  #define LORAWAN_RFSWITCH_RFO_LP_VALUES LOW,LOW,HIGH
  #define LORAWAN_RFSWITCH_RFO_HP_VALUES LOW,HIGH,LOW

I close this issue like there is no compilation failure. Open a discussion on GitHub or on the forum.