cnlohr / rv003usb

CH32V003 RISC-V Pure Software USB Controller
MIT License
436 stars 43 forks source link

Change "go nowhere" location for debug timer when disabled #33

Closed david-sawatzke closed 8 months ago

david-sawatzke commented 8 months ago

0x44 is the BDTR register, which incidentally contains the output enable bit (and breaks PWM output). 0x58 at least doesn't contain anything according to the data sheet and doesn't break anything for me

cnlohr commented 8 months ago

Can you elaborate more? This was geared to allow one to monitor precise times by seeing single-cycle blips of the timer.

I was testing this, can you confirm that you are able to see the single-cycle blips as well?

david-sawatzke commented 8 months ago

I don't want to use the debug features, so RV003USB_DEBUG_TIMING isn't set. According to the comment, TIM1_BASE+0x44 should go nowhere, but as it turns out it's the BDTR register.

The two calls of DEBUG_TICK_SETUP together with SAVE_DEBUG_MARKER are only called with 0x04 and 0x84 as parameters, so MOE at bit 15 is always unset and thus you won't see anything on the pwm outputs as far as I can tell. I'm not seeing anything on the output for my own timer usage (initialized here ).

cnlohr commented 8 months ago

AH!!! I understand now. Thanks. PR Accepted!