Skip to main content
Visitor II
March 17, 2011
Question

[solved] STM8AF6166 TIM2 CC3 output compare (PWM out) nothing happend !

  • March 17, 2011
  • 2 replies
  • 766 views
Posted on March 17, 2011 at 11:12

[solved] STM8AF6166 TIM2 CC3 output compare (PWM out) nothing happend !

    This topic has been closed for replies.

    2 replies

    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 15:12

    I found by myself !

    You need to set the option byte OPT2 = 0x02 (NOPT2 = 0xFD) to enable TIM2 CC3 and disable TIM3 CC1, following is the asm file to add in your project :

    ;This file contains the values to program in the option bytes.

    ;You can change the values below according to the device datasheet.

    ;Be careful to respect the complement bytes,

    ; or the default values of the option bytes will be used.

    ;See the device datasheet for more information on the meaning of each bit.

    cseg at 04800h

    db 000h ;LOCKBYTE

    db 000h ;OPT1

    db 0FFh ;NOPT1

    db 002h ;OPT2   //0x02 will enable TIM2 CC3 and disable TIM3 CC1

    db 0FDh ;NOPT2

    db 000h ;OPT3

    db 0FFh ;NOPT3

    db 000h ;OPT4

    db 0FFh ;NOPT4

    db 000h ;OPT5

    db 0FFh ;NOPT5

    db 000h ;OPT6

    db 0FFh ;NOPT6

    db 000h ;OPT7

    db 0FFh ;NOPT7

    end

    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 15:12

    An easy way can be to set OPT2 which is AFR option through STVP.

    brazov2