PWM Demo Exercise creates error

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
alorc_4110946
Level 1
Level 1
First like received

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);

}

}

0 Likes
1 Solution
WinstonF_61
Moderator
Moderator
Moderator
100 likes received 100 sign-ins 50 solutions authored

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.

Regards
Winston

View solution in original post

0 Likes
2 Replies
Yeshwanth_KT
Employee
Employee
50 replies posted 25 replies posted 10 likes received

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

0 Likes
WinstonF_61
Moderator
Moderator
Moderator
100 likes received 100 sign-ins 50 solutions authored

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.

Regards
Winston
0 Likes