Page 1 of 1

STM32L152 PWM Channel not available!?!

Posted: 29 Sep 2021 10:36
by corado
If I write...then I got
"26 303 Identifier "_GPIO_MODULE_TIM9_CH2_PB14" was not declared STM32L_Discovery.mpas"

[code}program STM32L_Discovery;

{ Declarations section }
// LCD module connections
VAR LCD_RS : sbit at GPIOB_ODR.B13;
VAR LCD_EN : sbit at GPIOB_ODR.B11;
VAR LCD_D4 : sbit at GPIOB_ODR.B10;
VAR LCD_D5 : sbit at GPIOB_ODR.B2;
VAR LCD_D6 : sbit at GPIOA_ODR.B5;
VAR LCD_D7 : sbit at GPIOA_ODR.B4;
// End LCD module connections
// rw PB12
// 0 PB14 Contrast
//Backlight PA2 & PA3

begin
{ Main program }
PWM_TIM9_Init(2500);
GPIO_Digital_Output(@GPIOA_BASE, _GPIO_PINMASK_ALL);
GPIO_Digital_Output(@GPIOB_BASE, _GPIO_PINMASK_ALL);
GPIOB_ODR.12 :=0; //LCD_RW = GND
GPIOB_ODR.14 :=0; //LCD_Contrast
GPIOA_ODR.3 :=1; //LCD_Backlight VCC
GPIOA_ODR.4 :=0; //LCD_BAcklight GND


PWM_TIM9_Set_Duty(25531,_PWM_NON_INVERTED,_PWM_CHANNEL2);
PWM_TIM9_Start(_PWM_CHANNEL2, @_GPIO_MODULE_TIM9_CH2_PB14);


end.[/code]

Re: STM32L152 PWM Channel not available!?!

Posted: 01 Oct 2021 08:47
by filip
Hi,

You can open the GPIO definition file for this MCU (press Ctrl + Alt + M and search for the __Lib_GPIO_XYZ file and the go to Uses folder and find it), and add the definition that is missing.

Regards,
Filip.