Sijmen has joined ##stm32-rs
Sijmen has quit [Changing host]
Sijmen has joined ##stm32-rs
Sijmen has joined ##stm32-rs
<Sijmen> Heya, I'm trying to configure TIM1 for an STM32F042 but it doesn't seem to be doing much
<Sijmen> it's technically for RTIC, and I'm using stm32f0xx_hal, but I figured this place would be the best to ask (excuse me if it's not)
<Sijmen> (considering it's not directly related to RTIC)
<henrik_alser[m]> What is your use case?
<henrik_alser[m]> * What is your use case? Sijmen
<Sijmen> Oh sorry, I want to generate a 25kHz PWM signal with a configurable duty cycle
<Sijmen> it's for controlling a PC fan
<Sijmen> I did push-pull for now, because I'm using a devboard with a logic analyzer hooked up to it
<henrik_alser[m]> Ahh i see, and the f0xx hal has no pwm functionality in the timer module yet i suppose?
<henrik_alser[m]> Did you enable the peripheral clock? (APB2)
<henrik_alser[m]> (In RCC `apb2enr` and reset via `apb2rstr`)
<Sijmen> <henrik_alser[m] "Ahh i see, and the f0xx hal has "> Correct
<Sijmen> wait that should be it
<Sijmen> (it wasn't, but I got distracted)
<Sijmen> might have done something wrong though - is it okay to stick that initialisation above the `device.RCC.configure()....freeze()` thing?
<Sijmen> can't have it after it due to the borrow checker
<henrik_alser[m]> Hmm, i don't know of the top of my head what this particular hal does to the apb2 register in the rcc module, maybe it's resetting it? (I would guess not)
<henrik_alser[m]> I don't think you can publicly access the RCC register on your "frozen" Rcc struct via the `regs` field either right? It's probably private to the hal crate...
<henrik_alser[m]> I don't have an f0 at hand to try stuff atm unfortunately...
<Sijmen> Yeah, it's private to the hal crate
<Sijmen> Think I'll fork the hal and hack in the initialisation
<Sijmen> clone*
<henrik_alser[m]> Maybe look at what the other hals' pwm modules are doing?
<Sijmen> Oh hey, looks like there's an (abandoned) feature/pwm branch
<Sijmen> Guess I'll see if I can get that to wokrk
<henrik_alser[m]> Cool, good luck!
<Sijmen> Thanks, and thanks for the help!
pyfisch has joined ##stm32-rs
pyfisch has quit [Client Quit]
<Sijmen> Oh, I had to do `gpioa.pa8.into_alternate_af2(cs).internal_pull_up(cs, true),` to make it work
<Sijmen> perhaps the rcc stuff helped too though
<Sijmen> yes
<henrik_alser[m]> 🚀
<Sijmen> Also for accessing the RCC registers, I just made `.regs` public
<Sijmen> * As for accessing the RCC registers, I just made `.regs` public
<Sijmen> works for now, until we get official PWM support
Mr_Electronico has joined ##stm32-rs
Mr_Electronico has quit [Remote host closed the connection]
<firefrommoonligh> What do you think the timeline for that will be?