Author Topic: CH32V003 TIM2 doesn't respond  (Read 800 times)

0 Members and 1 Guest are viewing this topic.

Offline rudyrockTopic starter

  • Newbie
  • Posts: 2
  • Country: ca
CH32V003 TIM2 doesn't respond
« on: June 16, 2023, 12:01:49 pm »
Hi, I have played with many microcontroller and recently try the CH32V003. It seem an awesome microcontroller for the price, but I have a weird issue for one particular case. I try to use the TIM2, but what ever I do, registers of TIM2 stay always to 0. No idea why and it is driving me nut!   |O

I am able to use the usart, tim1 as pwm on 3 led (RGB) and I was expecting to use TIM2 in is simplest form, but nothing that I do seem to work. I try to debug as well and change value in peripheral registers directly and they still stay always to zero for TIM2. I can change value for TIM1 easily.  :o

Is there somebody that can explain it to me what going on?
 

Offline rhodges

  • Frequent Contributor
  • **
  • Posts: 358
  • Country: us
  • Available for embedded projects.
    • My public libraries, code samples, and projects for STM8.
Re: CH32V003 TIM2 doesn't respond
« Reply #1 on: June 16, 2023, 12:18:10 pm »
Check that the peripheral clock enable is set.
Going from the datasheet:
RCC_APB1PCENR |= TIM2EN;
Currently developing embedded RISC-V. Recently STM32 and STM8. All are excellent choices. Past includes 6809, Z80, 8086, PIC, MIPS, PNX1302, and some 8748 and 6805. Check out my public code on github. https://github.com/unfrozen
 
The following users thanked this post: paf, wek, rudyrock

Offline rudyrockTopic starter

  • Newbie
  • Posts: 2
  • Country: ca
Re: CH32V003 TIM2 doesn't respond
« Reply #2 on: June 16, 2023, 12:26:19 pm »
Thanks rhodges! Never tough that was so simple.  :-+
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf