cancel
Showing results for 
Search instead for 
Did you mean: 

NUCLEO G0B1 - TIM4 failure?

RinGO
Associate II

Hi, I'm trying to get addressable diodes (WS2812, ...) working with PWM, TIM4, DMA on the NUCLEO-G0B1RE, but oh well. Something is wrong.
There is nothing on the output!
I tried:
PWM, TIM2_CH1, DMA = code works without errors, WS2812b works
PWM, TIM3_CH1, DMA = code works without errors, WS2812b works
PWM, TIM4_CH1, DMA = failure, nothing on oscilloscope
The code is absolutely identical in all cases.
I have the same problems on a customer board with STM32G0B1CEU
It's a bit of a mystery because TIM2,3,4 belong to General-purpose timers and are basically identical.
Can someone please advise me where the error is?
See the attachment for NUCLEO settings.

4 REPLIES 4

Read out and check/post/compare to working, content of TIM, DMA/DMAMUX and relevant GPIO registers.

JW

RinGO
Associate II

Thanks, an answer from a guru is certainly appreciated by other gurus.
I'm not a guru.
I haven't delved much into the registries yet. For now, I'm moving at the HAL layer level. I know about registries that they exist.
If something doesn't work, the error is in my interpretation of the code, I'm able to fix that. But the CubeMX code generation anomaly is beyond me.

So far I have come to the conclusion that the problem might be in the NVIC settings
TIM2 uses "TIM2 global Interrupt"
TIM3 uses "TIM3, TIM4 global Interrupt"
TIM4 also uses "TIM3, TIM4 global Interrupt"
see Annex.

And that's probably where it gets stuck, because it's using interrupts for two TIMs, and it's the second one, ie TIM4?
Is it a bug in *.ioc generation?
Or does it really require digging through the registers and finding the cause of the failure in the Guru-level code for whom this is fun.
Yes, I want to be a guru too, but that will take years of intense programming…
But I need to clarify the cause of this anomaly sooner than in a few years.

Can someone please give me some more specific advice on this situation?

> So far I have come to the conclusion that the problem might be in the NVIC settings

Maybe, but what's your plan to confirm or reject this hypothesis?

> But the CubeMX code generation anomaly is beyond me.

OK, so what's the plan here, you just wait until this resolves itself magically? That may happen, coincidentally, but I wouldn't hold my breat. Also, I find it unlikely somebody is willing to reproduce your particular setup, and then dig deep.

You also haven' considered one other possible source of failure, namely hardware (or misinterpretation of it). I mean, bad solder joints, incorrect usage of devboard, or you observing a different pin by mistake. These can be generally resolved by setting given pin to General Output and toggling it "manually", blinky-style (or direcly in registers in debugger, yeah, I know, but I promise it *is* fun).

Also, reading out, comparing, and/or posting content of registers involves no levels of guruism, just use the debugger.

JW

P.S. I don't like to be labelled as "Guru", but that's what the current incarnation of this Forum does, despite my complaints to the Admins.

I don't expect miracles.
I expect hints, the types that are digestible for me. I don't think this complication has happened to me, the only one in the whole world, and no one else has ever had to deal with it. I'm hoping someone with this experience can point me in the right direction... and yes, I have a lot to learn. It hurts. So what! I believe I can solve it. But it is wiser to learn from the mistakes of others than from your own, if others share their mistakes.
Otherwise, to describe checking the correctness of the connection.

This anomaly happens on the Nucleo-G0B1RE but also on the G0B1CEU customer board.

On the customer's board, software checked all pins "blinking style" with output through an oscilloscope, all pins soldered in order, they generated approx. 250kHz pulses.

Both the Nucleo and the customer board using TIM4 ch1 without problems generate a PWM signal on pin PB6 but without NVIC. On the oscilloscope I can see how the PWM cycle changes.
So the pin is correct, the soldering is fine.

As soon as I activate the NVIC, the signal at TIM4 CH1 sucks. Both on NUCLEO and on the customer board. Nothing at the output, 0V.
On both NUCLEO boards and customer boards, they work correctly with NVIC:
TIM2 - PWM DMA
TIM3 - PWM DMA
it doesn't work with NVIC
TIM4 - PWM DMA

WELL... my first lesson is to learn how to properly use the debugger in CubeIDE
Do you have any tips on where to find a solid, usable tutorial with the option of online translation into my native language?