Search found 228 matches

by dannyf
Fri Feb 16, 2018 8:41 pm
Forum: STM Nucleo boards
Topic: How to generate 100khz pwm frequency on STM32L476 Nucleo board
Replies: 5
Views: 192

Re: How to generate 100khz pwm frequency on STM32L476 Nucleo board

easy: 1) set the timebase, with a top/prescaler pair set to deliver your frequency; 2) put the output compare / pwm mode to your desired duty cycle. 3) sit back and enjoy. my code would look something like this: pwm1_init(TMR_PS8x, F_CPU / F_PWM / 8); //set pwm to generate F_PWM pwm1_setdc2(pwm_dc);...
by dannyf
Tue Feb 13, 2018 12:00 pm
Forum: General discussion
Topic: Access the PC register through ST-Link V2?
Replies: 11
Views: 205

Re: Access the PC register through ST-Link V2?

Getting your debugger to work, or ro use uart or a display is much more efficient.

The chip has extensive built in debug capabilities.
by dannyf
Mon Feb 12, 2018 11:08 pm
Forum: General discussion
Topic: Access the PC register through ST-Link V2?
Replies: 11
Views: 205

Re: Access the PC register through ST-Link V2?

Why couldn't you just step through the code?
by dannyf
Mon Feb 12, 2018 1:25 am
Forum: General discussion
Topic: Timer "One-Pulse" mode
Replies: 14
Views: 266

Re: Timer "One-Pulse" mode

Would not be better to regulate the power by switching on/off at zero crossing? I mean by counting sine periods (like 100 periods = 1kW, 1 period = 10W)..
an interesting concept. I haven't seen people trying it however. I can see it being quite useful when emi is of paramount concern.
by dannyf
Sun Feb 11, 2018 2:18 pm
Forum: General discussion
Topic: Timer "One-Pulse" mode
Replies: 14
Views: 266

Re: Timer "One-Pulse" mode

btw, the reason to set the compare value to 1 (or 0 if possible) is so the OC fires right away.
by dannyf
Sun Feb 11, 2018 2:16 pm
Forum: General discussion
Topic: Timer "One-Pulse" mode
Replies: 14
Views: 266

Re: Timer "One-Pulse" mode

it probably doesn't need to be that elaborate. I would do it this way, assuming you want pam: 1) initialize the timer into one pulse mode, and interrupt at the top. 2) set up the compare to be 1 (or 0 if it works), and the top to be a value designed for the right amount of power; 3) in the isr, zero...
by dannyf
Sun Feb 11, 2018 12:47 am
Forum: STM32F103 Boards
Topic: Driving LED dim/glow using PWM pins and MOSFET
Replies: 15
Views: 785

Re: Driving LED dim/glow using PWM pins and MOSFET

As there are only 4 timers on he F103C, you will only be able to output 4 unique PWM values The chip itself is much more powerful than that. I don't have a datasheet handy but tim1..5 eagh has 4 channels. And others with 1 to 2 channels as well. Tim6 and 7 no channels. So take a look at the datashe...
by dannyf
Sun Feb 11, 2018 12:42 am
Forum: Code snipplets
Topic: Example for MCP4921 (or MCP4922) 12-bit DAC chips
Replies: 2
Views: 149

Re: Example for MCP4921 (or MCP4922) 12-bit DAC chips

Teo suggestions.

1. See if you can put the code in a module so it is easier for others to incorporate it into their project.

2. Google dds. It offers more ability to fine tune the output.
by dannyf
Sun Feb 11, 2018 12:39 am
Forum: General discussion
Topic: AC Dimmer
Replies: 49
Views: 945

Re: AC Dimmer

With the water heaters time constant be so large, you may not find much benefits in going PID/pwm/Pam.

I did PID + pwm on a solder iron build and minimum benefits between that and the simple on/off control.

But if you just want to play with it, that's another story.
by dannyf
Sun Feb 11, 2018 12:35 am
Forum: General discussion
Topic: Timer "One-Pulse" mode
Replies: 14
Views: 266

Re: Timer "One-Pulse" mode

It might be easier to just poke the registers. The timer needs to be in output compare mode, not own mode.

I still don't see much benefits in going one pulse here. A good old timeout will do.