9 Replies Latest reply on Sep 1, 2020 7:57 PM by NiA_4003596

    How to configure PWM in CYBT-483039

    NiA_4003596

      Hi,

      I am using this module for LED lighting application and configured pins for PWM(P28), relay(P26) and on board led indication(P17). Enclosed my schematic for your understanding.

       

      1. How to configure pin P17 as GPIO to light up indication led LED1 because the following code does not work in WICED6.4

           wiced_hal_gpio_configure_pin(WICED_P17, GPIO_OUTPUT_ENABLE, GPIO_PIN_OUTPUT_HIGH);

           wiced_hal_gpio_set_pin_output(WICED_P17, GPIO_PIN_OUTPUT_HIGH);

       

      2. How to configure pin P28 as PWM because the following code does not work in WICED 6.4

       

          wiced_hal_aclk_enable(PWM_INP_CLK_IN_HZ, ACLK1, ACLK_FREQ_24_MHZ);

          wiced_hal_gpio_select_function(WICED_P28, PWM1);

          // wiced_hal_pwm_configure_pin(WICED_P28, PWM1);

          wiced_hal_pwm_get_params(PWM_INP_CLK_IN_HZ, 0, PWM_FREQ_IN_HZ, &pwm_config);

          wiced_hal_pwm_start(PWM1, PMU_CLK, pwm_config.toggle_count, pwm_config.init_count, 1);

       

          //set pwm duty cycle

          wiced_hal_pwm_get_params(PWM_INP_CLK_IN_HZ, brightness_level, PWM_FREQ_IN_HZ, &pwm_config);

          wiced_hal_pwm_change_values(PWM1, pwm_config.toggle_count, pwm_config.init_count);

       

       

      3. I am getting the following PUART message in the terminal with baudrate 115200, could we get meaningful starting message instead of some junk message?

      Ý_öûöý[KöÛÚûÉÚ?Ýòù½ÛÚû{¶ýÛÉÛéûÉÛÉkééIserver trans start time:0 target:3490 present:0 state:2648a8

      server trans complete:3490

      mesh light srv set level element:0 actual/target:15123/3490 linear/target:15123/3490 remaining_time:0

      ***** Free mem after app_init:142128

       

       

      Best regards,

      NK

        • 1. Re: How to configure PWM in CYBT-483039
          DheerajP_41

          Hi,

           

          All these APIs are available in WICED 6.4, and it has been used in few HAL application (app/snip/hal) like GPIO, PWM , etc. It should work. Could you please go through these application and compare with your code?

           

          I can see some mismatch between your description and the attached schematics. Eg. P26 is not connected to anything in your schematics. If you can share your code, we will try to run it on our side and give feedback.

           

          Thanks,

          -Dheeraj

          • 2. Re: How to configure PWM in CYBT-483039
            NiA_4003596

            Hi,

             

            As requested, Code and Schematic are attached for your reference. Also attached two video of range checking because CYBT-483039-02 range is less than a meter. I don't know where do i make mistake, Please advice.

             

            P26 is taken for relay controlling and mentioned in schematic as RELAY. I have tried supermux tool and made P17 working as GPIO. But still facing issue for PWM.

             

            Please change file "CYBT-483039 Range Checking 1 & 2" properties to .mp4 to open video file.

             

            Best regards,

            NK

            • 3. Re: How to configure PWM in CYBT-483039
              DheerajP_41

              Hi,

               

              Kindle enable external PA to solve range issue. Hope you have already done this.

              WICED Studio: Platform Files for CYBT-483039-EVAL – KBA223747

               

              Also you can try modifying the tx power using wiced_bt_mesh_core_adv_tx_power API. (Eg. wiced_bt_mesh_core_adv_tx_power=4  is for max power).

              You can set this inside mesh_app_init(). Default value is 4. 0 means minimum power and 4 is the max. Actual power table is on the controller.

               

              I could build the program successfully. I just changed the the name of led init function to "void led_control_here_init(uint8_t control_type)", since it is conflicting with the function name in led_control.c/.h. (code attached).

               

              Please let me know if you are still facing any issue.

               

              Thanks,

              -Dheeraj

              • 4. Re: How to configure PWM in CYBT-483039
                NiA_4003596

                Hi,

                Thank you!

                 

                The code is working now and have enabled PA with the following lines in mesh_app_init().

                 

                As you mentioned, wiced_bt_mesh_core_adv_tx_power=4  is for max power, I want to keep the maximum range possible. Do I have to included any code in mesh_app_init() for max power?

                 

                I have checked range in my place where trees are minimal and I could able to achieve around 200 meters at line of sight with the above code to enable PA. Is there any further adjustment to be made in the code to increase the range because I should get at least half range as per claim 1km range in Cypress documents.

                 

                Just confirming with you to not missing anything, as wiced_hal_pwm_configure_pin(led_pin, PWM_CHANNEL) function is deprecated in WICED 6.4, please confirm whether the line wiced_hal_gpio_select_function(WICED_P28, WICED_PWM0) is required to enable PWM0 for CYBT-483039 in WICED 6.4. I have tested even without these function, PWM is working.

                 

                Best regards,

                NK

                • 5. Re: How to configure PWM in CYBT-483039
                  DheerajP_41

                  Hi,

                   

                  How are you testing the range?  Did you measure the RSSI at different distances?

                   

                  As per the module datasheet :-

                  1. Connection range tested module-to-module in full line-of-sight environment, free of obstacles or interference sources with output power of +19 dBm POUT.
                  2. Specified as EZ-BT XT module to module range. Mobile phone connection will decrease based on the PA/LNA performance of the mobile phone used.

                   

                  You have to use the "wiced_hal_gpio_select_function()" to select the custom functionality for a pin.

                  If PWM is working good, then the PWM functionality could be configured by default in the *_platform_pin_config.c (platform files or supermux files).

                   

                  Thanks,

                  -Dheeraj

                  • 6. Re: How to configure PWM in CYBT-483039
                    NiA_4003596

                    Hi,

                     

                    I have taken two CYBT-483039-02 module along with mobile provisioner to test the range and configured to switch ON/OFF an LED in the module from mobile. I have kept a module and mobile at third floor of my office and carrying away the next module, then monitoring activity by sending a group ON/OFF. After 200 meter, the distant module didn't not respond and if I mention less than 200 meter, it respond. Please note the range test is between BLE module, not mobile.

                     

                    Please suggest all the parameter setting in the application code to achieve maximum range.

                     

                     

                    Regards,

                    NK

                    • 7. Re: How to configure PWM in CYBT-483039
                      DheerajP_41

                      Hi,

                       

                      Could you please follow below KBA for using latest patch files for WICED 6.4. And try again your experiments?

                      Platform and New Patch Files For 20719B1 in WICED 6.4.0.61 - KBA228518

                       

                      Please refer Re: Can't set power on CYBT-483039-02 too.

                       

                      Also, please set wiced_bt_mesh_core_adv_tx_power=4; in mesh_app_init(). This will set the Tx power to max for mesh apps.

                      For other apps, you can use wiced_bt_dev_set_adv_tx_power() (refer wiced_bt_dev.h ) for modifying the Tx power.

                       

                      Thanks,

                      -Dheeraj

                      • 8. Re: How to configure PWM in CYBT-483039
                        DheerajP_41

                        Hi,

                         

                        I got few more information from an internal discussion with the module team. Please consider/verify below points while testing the range.

                        Note: 1km is the best test results, with few pre-conditions as said below.

                         

                        • Connection range is tested module-to-module.
                        • Module output power should be maximum. (It should be around +19dBm when measured in a conducted testing setup.)
                        • Line of sight test environment is needed. (no metal around module, the module should be over the ground more than 1.5m)
                        • The data rate should be minimum.
                        • Board direction can also affect results. (antenna gain is different is different direction)
                        • Main board ground can also affect antenna performance, hence the range.

                                Please check: an91445-antenna-design-and-rf-layout-guidelines for antenna design guidelines.

                         

                        Thanks,

                        -Dheeraj

                        • 9. Re: How to configure PWM in CYBT-483039
                          NiA_4003596

                          Hi,

                          Thank you for the valuable information. I will check with the patch files and get back to you.

                           

                          Regards,

                          NK