2024-08-05 10:12 PM
I am currently using the STM32F103C8 board, in this, I connect the OPTOCOUPLER input to the PA6 PIN of stm32 which is the PWM pin, and at the output side I connect the optocoupler's output to the driver's 10v + pin and optocoupler's output with 10v - pin, and I also generate the PWM signal using timer 3 ,and in this i want to control the led brightness using the pwm dutycycle but this is not proper working . give me suggestions what should i do in this case?
this is the pwm initialization code
2024-08-06 02:53 AM
Please see the posting tips for how to properly post source code, etc:
@kunj_2308 wrote:I am currently using the STM32F103C8 board
What "STM32F103C8 board" ?
@kunj_2308 wrote:I connect the OPTOCOUPLER
What optocoupler?
@kunj_2308 wrote:this is not proper working
What, exactly, does that mean?
So what investigation / testing / debugging have you done to find out what's wrong?
2024-08-06 05:17 AM
If you initialize the pin as a GPIO output and toggle it, does it control the LED as expected? If not, there's a hardware issue.
> TIM_OCInitStruct.TIM_Pulse = 0;
This will not produce a PWM signal, but will produce a DC low signal (or high depending on settings).
2024-08-06 05:45 AM
okay , thanks for your guidance
BLUEPILL board
optocoupler PC817
i find that if i give the voltages according to that i am not getting the voltage difference of 10v
2024-08-06 05:47 AM
yes it is toggled
2024-08-06 05:52 AM
Did you change the TIM_Pulse value to something nonzero? 100 for example.
2024-08-06 06:10 AM
@kunj_2308 wrote:okay , thanks for your guidance
See point #3 - provide a schematic of your setup.
Some good, clear photos may also help ...
@kunj_2308 wrote:if i give the voltages according to that i am not getting the voltage difference of 10v
Sorry, I don't understand that.
What voltages? Where? According to what? Difference relative to what?
Again, this would be a lot clearer on a schematic!
@kunj_2308 wrote:optocoupler PC817
This: https://global.sharp/products/device/lineup/data/pdf/datasheet/PC817XxNSZ1B_e.pdf ?