How to configure sidework RF switch and hardware frequency offset?

Hi

   I am a new sidework developer,I want to use our designed board to develop sidework, but there are some differents between 52840 + sx1262 Development board(52840dk, sx1262 evaluation board)with our board. 

Can you give me some suggestions to modify the code to adapt to our board? Thanks.

1. Is it feasible for us to use the interrupt monitoring method to control the RF switch in the sidework project?

Semtech RF switch control(in sidework use semtech_sx1262_antenna_enable_gpios to control ANT_SW )

ANT_SW is always 1 so when DIO2 is 1 RF1 on RF2 off, when DIO2 is 0, RF1 off RF2 on

Below is our circuit diagram.

When DIO2 is 1 we can through P1.04 to know DIO2 statu so we should control ANT_SW2(P1.02) = 0

at this time ANT_SW1=1, ANT_SW2=0  RF1 on, RF2 off.

When DIO2 is 0 we can through P1.04 to know DIO2 statu so we should control ANT_SW2(P1.02) = 1

at this time ANT_SW1=0, ANT_SW2=1  RF1 off, RF2 on.

We use P1.04 in the sidework project to monitor and control P1.02. Is this method defective or do you have any recommended methods? I look forward to your suggestions.

2. How to set the RF crystal calibration value of sx1262 in the sidework project?

Our module has a slight frequency offset in the lora radio frequency part and needs software to adjust.

In the LoRawan project we can use the following code to adjust the frequency offset when sending.

In the sidework project I found in semtech_radio_ifc.h have emtech_radio_set_trim_cap_val interface.

How can I use this interface in my project?

Thank you

Parents
  • Hello,

    2. How to set the RF crystal calibration value of sx1262 in the sidework project?

    You can fill the configuration for the SX1662 here (we do not fill all the possible fields). See the function point trim_cap_val_callback which is declared in here and you have to provide a function that returns the trim value via the passed argument, and return status code (0 for success). You might also need to modify this line by changing the value of the GPIO_UNUSED_PIN to 128.

     So, add the callback, say,

    .trim_cap_val_callback = radio_sx1262_trim_val,

    in here: https://github.com/nrfconnect/sdk-sidewalk/blob/714d2267e8dafd8dfc68d3e1932926e141850517/subsys/config/common/src/app_subGHz_config.c#L104-L134

     

    and define the function as something like below:

     

    static int32_t radio_sx1262_trim_val (uint16_t trim_val)

    {

    (pass the value in argument trim_val and return 0 if success)

    }

     

    Also change the value of unused pin as follows:

     #define GPIO_UNUSED_PIN (uint32_t)(128)

    . Is it feasible for us to use the interrupt monitoring method to control the RF switch in the sidework project?

    Semtech RF switch control(in sidework use semtech_sx1262_antenna_enable_gpios to control ANT_SW )

    In this suggestion are you planning to use an another gpio that is connected to the ANT_SW controlled by semtech driver, and in zephyr you want to add an interrupt to monitor when the semtech driver changes its state, and in that interrupt you are setting the second ANT_SW to the opposite state? Is this correct? If inversion of the signal is the case then can't you do it in hardware by adding a negation in the ANT_SW line?

    Kind Regards,

    Abhijith

  • Hello,

    Here in the sidewalk, there is no function to set the trim value. The semtech driver set the default value to SX126X_DEFAULT_TRIM_CAP_VAL = 0x12

    Menon said:
    In this suggestion are you planning to use an another gpio that is connected to the ANT_SW controlled by semtech driver, and in zephyr you want to add an interrupt to monitor when the semtech driver changes its state, and in that interrupt you are setting the second ANT_SW to the opposite state? Is this correct?

    Is this correct? Please explain if there is any misunderstanding on my side.

    Kind Regards,

    Abhijith

  • Sorry for replying so late, because we are celebrating the New Year here

    Yes it's as you understand.

    Can I change SX126X_DEFAULT_TRIM_CAP_VAL  value in config file?

  • Hello,


    Август said:
    Sorry for replying so late, because we are celebrating the New Year here

    No worries, I wish you a great year ahead.

    Август said:
    Can I change SX126X_DEFAULT_TRIM_CAP_VAL  value in config file?

    When you take the example of the current sample, here, within sidewalk.c, there is function called state_sidewalk_entry. Here you can read the radio configuration and pass it to the sid_platform_init. If you overwrite this callback before calling the sid_platform_init, the new value will be applied. So this can be one way to modify the default value without interfering with the default configuration. 

    You can either modify the callback, switch the define to a Kconfig, or swap the callback in the application. 

     

    I have discussed with experts and they mentioned that they will consider changing the define into Kconfig in the default callback, but for now the easiest solution is to overwrite the callback 

    .platform_init_parameters.radio_cfg.pa_cfg_callback before calling the sid_platform_init().

    Kind Regards,

    Abhijith

  • Hello,

       Thank you for your reply, it is very helpful to me.

    As I see, sid_platform_inif is included in state_sidewalk_entry and getting parameters is in front of sid_platform_inif, so we only need to modify the macro definition RADIO_SX1262_DEFAULT_TRIM_CAP_VAL in app_subGHz_config.c and it will take effect, is that right?

    ...

Reply Children
No Data
Related