Search found 19 matches

by GVisser
Fri Jun 19, 2020 6:01 pm
Forum: Let us know a bit about you and your projects
Topic: Belated hello
Replies: 1
Views: 1899

Belated hello

Hi all, This is a belated helloooo as I have already posted to the board and received assistance :D Thank you! My name is Grant, I am 52 and from Hatfield in the UK. I have been an electronics enthusiast most of my life but have had very little actual experience as everything always got in the way. ...
by GVisser
Fri Jun 19, 2020 9:55 am
Forum: General discussion
Topic: I2C and timers?
Replies: 5
Views: 4611

I2C and timers?

Hi all, Another NOOB question :-) I am trying to plan my pin usage for my project with future additions in mind so am trying to understand what resources I2C requires. I am using my STM32F401CCU6 Black Pill which seems to have 3 I2C ports. As I am using a number of encoders and have a PWM output, I ...
by GVisser
Mon Jun 15, 2020 9:00 am
Forum: General discussion
Topic: PWM + Encoder = Please Help :-)
Replies: 13
Views: 13012

Re: PWM + Encoder = Please Help :-)

Morning all :-) fredbox ag123 ABOSTM THANK YOU all for your help :D The code is now running as I had originally intended and is included below in case it helps someone else in the future. Note: I did have to move the 'setPWM' out of the main loop as it was 'resetting' the output on every tick even i...
by GVisser
Sat Jun 13, 2020 8:26 pm
Forum: General discussion
Topic: PWM + Encoder = Please Help :-)
Replies: 13
Views: 13012

Re: PWM + Encoder = Please Help :-)

my guess is you can try something like this void setPeriod(uint32 microseconds) { CYCLES_PER_MICROSECOND = 72; //i.e. stm32f103 72mhz uint32 period_cyc = microseconds * CYCLES_PER_MICROSECOND; uint16 prescaler = (uint16)(period_cyc / MAX_RELOAD + 1); uint16 overflow = (uint16)((period_cyc + (presca...
by GVisser
Sat Jun 13, 2020 5:28 pm
Forum: General discussion
Topic: PWM + Encoder = Please Help :-)
Replies: 13
Views: 13012

Re: PWM + Encoder = Please Help :-)

Hi fredbox , Thanks for your reply. Yes, the example and most of my code runs perfectly, I just cannot figure out how to get a value in the main loop to change the settings of the running PWM output! As for the interrupt, I added that in before I knew anything about interrupts, so yes, I have alread...
by GVisser
Sat Jun 13, 2020 5:23 pm
Forum: General discussion
Topic: PWM + Encoder = Please Help :-)
Replies: 13
Views: 13012

Re: PWM + Encoder = Please Help :-)

Hi ag123 , Thank you for your reply and yes I will look further into the setPWM function. As for the rest, the PWM is working properly and the reading of the decoder is working properly, the issue is that I cannot find a way to alter the PWM signal with values from the main loop. Once setup is done,...
by GVisser
Fri Jun 12, 2020 2:19 pm
Forum: General discussion
Topic: PWM + Encoder = Please Help :-)
Replies: 13
Views: 13012

Re: PWM + Encoder = Please Help :-)

STM32 Cube HAL is the StMicroelectronics official drivers. ok thanks :-) In you jroject you really need to distinguish 2 things: * PWM outuput. In your sketch it is done thanks to HardwareTimer library. This is very good. My proposal, in order to simply you things, is to use also use following func...
by GVisser
Fri Jun 12, 2020 1:10 pm
Forum: General discussion
Topic: PWM + Encoder = Please Help :-)
Replies: 13
Views: 13012

Re: PWM + Encoder = Please Help :-)

Hi ABOSTM , Many thanks for your response! Unfortunately, the only part that I understood was that the HarwareTimer library does not support encoders :D The rest went completely over my head, so it seems I may be out of my depth :oops: (I have no idea what the STM32 cube HAL API is) All I wanted to ...
by GVisser
Fri Jun 12, 2020 11:18 am
Forum: General discussion
Topic: PWM + Encoder = Please Help :-)
Replies: 13
Views: 13012

PWM + Encoder = Please Help :-)

Hi there, I am brand new to this world so am struggling with the basics :oops: I am trying to set up a PWM output from my STM32F401CC Black Pill which will have 2 encoders to vary the frequency and the duty cycle. I have the PWM output working and I have 1 encoder working but cannot figure out how t...

Go to advanced search