2149374_en-US

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

2149374_en-US

2149374_en-US

RW612 and Openthread function txpower

Using the u-Blox IRIS-W106-10B (RW612) with MCUXpresso/Zephyr 4.2.0.  Most features work fine with openthread.  The device can get on mesh and ping, etc.  But some features are missing in software.  Using otPlatRadioSetTransmitPower() causes a reset, for example.

Side note: The API should be support a signed int because, for example, -1 dBm is a valid setting.

I noticed there is an example with vendor set tx power, which does not work after I port it in.  I think it should be hooked into the otPlatRadioSetTransmitPower() function.

#define SPINEL_PROP_VENDOR_NXP_GET_SET_TXPOWERLIMIT_CMD (SPINEL_PROP_VENDOR__BEGIN + 0x10B)


Also, perhaps related, getting the eui64 does not work.  I reworked the function to return the lower 8 bytes of the hwinfo address: 
hwinfo_get_device_id.  I suspect that this is probably not correct.

Setting the Tx power from the C app is crucial for our application.

Thanks


Re: RW612 and Openthread function txpower

Hello @joanou.

I can infer that you are porting an OpenThead example to Zephyr, although please correct me if I'm wrong. As I mentioned before, I suggest that you take as reference and/or test the OpenThread Shell example from the Zephyr repository to check for additional porting details related to the transmit power control, which is included in this example.

Please let me know if the example works for you.

Re: RW612 and Openthread function txpower

Hi,

I am using the nxp_ot_cli sample with some of my customizations. Here is main() below.  I also added vendor hook for the SPINEL_PROP_VENDOR_NXP_GET_SET_TXPOWERLIMIT_CMD callback from spinel. 

I added this for modules/openthread/platform/radio_spinel.cpp

+otError otPlatRadioGetVendorMaxTransmitPower(otInstance *aInstance, uint8_t *aPower)
+{
+ otError error;
+
+ OT_UNUSED_VARIABLE(aInstance);
+
+ if (psRadioSpinel == NULL)
+ {
+ otLogWarnPlat("psRadioSpinel for max tx get is null");
+ return OT_ERROR_GENERIC;
+ }
+
+ VerifyOrExit(aPower != NULL, error = OT_ERROR_INVALID_ARGS);
+ error = psRadioSpinel->GetVendorMaxTransmitPower(*aPower);
+
+exit:
+ return error;
+}
+
+otError otPlatRadioSetVendorMaxTransmitPower(otInstance *aInstance, uint8_t aPower)
+{
+ if (psRadioSpinel == NULL)
+ {
+ otLogWarnPlat("psRadioSpinel for set max Tx power is null");
+ return OT_ERROR_GENERIC;
+ }
+
+ OT_UNUSED_VARIABLE(aInstance);
+ return psRadioSpinel->SetVendorMaxTransmitPower(aPower);
+}
+

The openthread module was modified to support hte vendor hook.
modified: include/openthread/platform/radio.h
modified: src/lib/spinel/CMakeLists.txt
modified: src/lib/spinel/radio_spinel.cpp
modified: src/lib/spinel/radio_spinel.hpp
modified: src/lib/spinel/spinel.h
modified: src/lib/spinel/spinel_driver.cpp

This was added to spinel.h.
SPINEL_PROP_VENDOR_NXP_GET_SET_TXPOWERLIMIT_CMD = (SPINEL_PROP_VENDOR__BEGIN + 0x10B),

 
int main(void)
{
   LOG_INF("nxp_ot_cli entry");

   k_sleep(K_MSEC(500));

   ot_context = openthread_get_default_context();
   __ASSERT(ot_context != NULL, "Fatal: OpenThread context not available!");

   ot_instance = openthread_get_default_instance();
   __ASSERT(ot_instance != NULL, "Fatal: OpenThread instance not available!");

   LOG_INF("Setting openthread leader weight");
   otThreadSetLocalLeaderWeight(ot_instance, 2);
   LOG_INF("Done setting leaderweight");

   k_sleep(K_MSEC(500));
   LOG_INF("Setting openthread radio max transmit power to 12/2 dBm ...");
   otError err1 = otPlatRadioSetVendorMaxTransmitPower(ot_instance, 12);
   LOG_INF("Set openthread radio max transmit power: %s (err=%d)", otThreadErrorToString(err1), err1);

   k_sleep(K_MSEC(500));
   uint8_t aPower = 0;
   LOG_INF("Getting openthread radio transmit power ...");
   otError err2 = otPlatRadioGetVendorMaxTransmitPower(ot_instance, &aPower);
   if ((aPower % 2 == 0))
   {
      LOG_INF("Getting openthread radio transmit power is %u or %u.0 dBm, %s (err=%d)", aPower, aPower/2, otThreadErrorToString(err2), err2);
   }
   else
   {
      LOG_INF("Getting openthread radio transmit power is %u or %u.5 dBm, %s (err=%d)", aPower, aPower/2, otThreadErrorToString(err2), err2);
   }

   //LOG_INF("Loop now");
   while (1)
   {
      LOG_INF("Loop now");
      k_sleep(K_MSEC(1000));
   }

   return 0;
}


Re: RW612 and Openthread function txpower

Hello @joanou, hope you are doing well.

Are you doing your testings in a custom application or is it in any existing example? If it is an existing example what changes have you done?

Additionally, could you please test the openthread "shell" example? The example provides an input command to change the transmission power.

Please let me know whether this works for you or if you see a different behavior.

Tags (1)
No ratings
Version history
Last update:
‎11-21-2025 11:43 PM
Updated by: