2 Replies Latest reply on Apr 3, 2019 11:31 PM by WinstonF_61

    PWM Demo Exercise creates error

    alorc_4110946

      I build pwm from 101 tutorial. All other programs worked, event PuTTY up to this point. Attached is error, .mk and .c.

      Error

      10:24:51 **** Build of configuration Default for project 43xxx_Wi-Fi ****

      "C:\\Users\\Al\\Documents\\WICED-Studio-6.2\\43xxx_Wi-Fi\\make.exe" ww101.02.09_pwm-CYW94343WWCD1_EVB download

      MAKEFILE MAKECMDGOALS=ww101.02.09_pwm-CYW94343WWCD1_EVB download OTA2_SUPPORT is disabled

      Building Bootloader

      Building Serial Flash Loader App

      MAKEFILE MAKECMDGOALS=waf.sflash_write-NoOS-CYW94343WWCD1_EVB-SDIO OTA2_SUPPORT is disabled

      Finished Building Bootloader

      1. waf.sflash_write-NoOS-CYW94343WWCD1_EVB-SDIO

      ----------------------------------|---------|

                                        |  Static |

                    Module              |   RAM |

      ----------------------------------+---------|

      App                               |   21130 |

      Host MCU-family library           | 11604 |

      Interrupt Vectors                 |     388 |

      libc                              |     556 |

      platform                          |    1104 |

      Ring_Buffer                       |      40 |

      SPI_Flash_Library_CYW94343WWCD1_EV|     936 |

      Startup Stack & Link Script fill  |     486 |

      WWD                               |     188 |

      ----------------------------------+---------|

      TOTAL (bytes)                     |   36432 |

      ----------------------------------|---------|

       

       

      Compiling apps_ww101_02_09_pwm

      Build complete

      Finished Building Serial Flash Loader App

       

      apps/ww101/02/09_pwm/09_pwm.c: In function 'application_start':

      apps/ww101/02/09_pwm/09_pwm.c:11:27: error: 'PWM_PIN' undeclared (first use in this function)

                  wiced_pwm_init(PWM_PIN, 1000, duty_cycle);

                                 ^~~~~~~

      apps/ww101/02/09_pwm/09_pwm.c:11:27: note: each undeclared identifier is reported only once for each function it appears in

      tools/makefiles/wiced_elf.mk:232: recipe for target 'build/ww101.02.09_pwm-CYW94343WWCD1_EVB/Modules/apps/ww101/02/09_pwm/09_pwm.o' failed

      1. make.exe[1]: *** [build/ww101.02.09_pwm-CYW94343WWCD1_EVB/Modules/apps/ww101/02/09_pwm/09_pwm.o] Error 1

      Makefile:351: recipe for target 'main_app' failed

      make: *** [main_app] Error 2

       

      10:24:53 Build Finished (took 2s.184ms)

       

      09_pwm.mk

      NAME := apps_ww101_02_09_pwm

       

      $(NAME)_SOURCES := 09_pwm.c

       

      09_pwm.c

      #include "wiced.h"

       

      void application_start( )

      {

      float duty_cycle = 50.0;

      wiced_init( );

      wiced_gpio_deinit( WICED_LED1 );

       

      while(1)

      {

                 wiced_pwm_init(PWM_PIN, 1000, duty_cycle);

                 wiced_pwm_start(PWM_PIN);

                 duty_cycle += 1.0;

       

                 if(duty_cycle > 100.0)

                 {

                     duty_cycle = 0.0;

                 }

                 wiced_rtos_delay_milliseconds( 10);

      }

      }

        • 1. Re: PWM Demo Exercise creates error
          YeshwanthK_56

          Hi,

           

          PWM_PIN is not a predefined macro. Please place the below line after #include "wiced.h",

           

          #define PWM_PIN WICED_PWM_n

           

          Replace 'n' with the PWM number you want to use.

          Ex: WICED_PWM_4

           

          Regards,

          Yeshwanth

          • 2. Re: PWM Demo Exercise creates error
            WinstonF_61

            In the code attached I don't see the #define for PWM_PIN, not sure if you missed pasting it here.

             

            Another point you need to take care of is the difference in the Platforms. The training is based on the CYW943907EVAL1F and you are using the CYW94343WWCD1_EVB.

             

            The LED's are connected to WICED_GPIO_11 & WICED_GPIO_26. Both these pins have support for PWM and can be initialized as WICED_PWM_1 & WICED_PWM_2.

             

            Instead of using PWM_PIN, you could directly use WICED_PWM_1 or WICED_PWM_2.