I lifted up the first code you posted (that uses input capture) and tried it on 72MHz F103. I could not get it to work anywhere near 100kHz. At 20kHz it was producing output, but looking like this:
Frequency = 0.0000 Dutycycle = 0.0000
I then changed it to produce the pwm output on pin PA1 ...
Search found 180 matches
- Mon Feb 26, 2024 8:54 pm
- Forum: General discussion
- Topic: STM32 hangs when >100khz signal applied to input
- Replies: 19
- Views: 15285
- Mon Nov 20, 2023 9:06 pm
- Forum: General discussion
- Topic: Convert Arduino cod from stm
- Replies: 2
- Views: 10606
Re: Convert Arduino cod from stm
I lifted up you code (which would have been easier if you had made proper use of code tags) and tried to compile it using the "official" STM32DUINO core, and yes, there are several references to AVR registers like SPDR that will need attention, and also definition of an ISR routine.
However, I see ...
However, I see ...
- Fri Sep 29, 2023 3:51 am
- Forum: General discussion
- Topic: Problem with mils not working with max6675 library.
- Replies: 11
- Views: 8979
Re: Problem with mils not working with max6675 library.
in setup() add
timer = millis();
you forgot to initialize the variable. And use \[code\] blocks to enclose the code in posts here, that makes it much more readable.
(global) variables that are uninitialised takes an undefined value, not necessary 0 (zero). imagine that it is 0xffffff, then ...
- Thu Sep 28, 2023 2:14 am
- Forum: General discussion
- Topic: Problem with mils not working with max6675 library.
- Replies: 11
- Views: 8979
Re: Problem with mils not working with max6675 library.
Not having all your hardware, I can’t lift up your whole program and try it. However I can pretend that I have a MAX6675 attached, and when I include this in the loop()
if ((millis()-timer ) >= 500)
{
temp1 = thermocouple.readCelsius();
Serial.println(temp1);
timer = millis();
}
delay(1000 ...
if ((millis()-timer ) >= 500)
{
temp1 = thermocouple.readCelsius();
Serial.println(temp1);
timer = millis();
}
delay(1000 ...
- Wed Sep 27, 2023 9:25 pm
- Forum: General discussion
- Topic: Problem with mils not working with max6675 library.
- Replies: 11
- Views: 8979
Re: Problem with mils not working with max6675 library.
When using classic milis processing
if ((millis()-timer ) >= 500)
{
temp1 = thermocouple.readCelsius();
Serial.println(thermocouple.readCelsius());
timer = millis();
}
Maybe you need to explain more as to what the problem actually is. Does the code as you showed work OK, but stops ...
- Thu Aug 24, 2023 10:33 pm
- Forum: Projects
- Topic: Voltage divider on Nucleo STM32L452RE bad accuracy
- Replies: 8
- Views: 23104
Re: Voltage divider on Nucleo STM32L452RE bad accuracy
With less than 500nA through the resistors, have you checked the input leakage current specifications?
- Mon Jul 31, 2023 2:57 am
- Forum: Libraries & Hardware
- Topic: PWM pin in STM32F103C8 blue pill
- Replies: 8
- Views: 27332
Re: PWM pin in STM32F103C8 blue pill
This is the basic code:-
...
I checked the PWM pins according to the following pin diagram:-
https://how2electronics.com/wp-content/uploads/2019/02/STM32-Pin-Details.jpg
Your link also does not work for me, so I'm not sure what you were working from.
From what you said before, I got the ...
- Sun Jul 30, 2023 2:18 am
- Forum: Libraries & Hardware
- Topic: PWM pin in STM32F103C8 blue pill
- Replies: 8
- Views: 27332
Re: PWM pin in STM32F103C8 blue pill
All the meters I have give a sort-of reasonable reading for DC volts on a PWM pin without any filtering. Some meters may be able to measure the frequency, and even duty cycle too. But in any event, there must be some explanation why different pins show different results.
In STM32DUINO, analogWrite ...
In STM32DUINO, analogWrite ...
- Sat Jul 29, 2023 11:59 am
- Forum: General discussion
- Topic: Bluepill: 2 different timers to read 2 different FREQS
- Replies: 17
- Views: 7430
Re: Bluepill: 2 different timers to read 2 different FREQS
Well the first thing that confused me was the whole channel thing (cause there are no "channel" in atmega328 world)
Now I'm starting to think about a channel, and the starting point is that all the frequencies should be "related" or "not too different" to share the same timer... I'll have to read ...
- Thu Jul 27, 2023 5:51 am
- Forum: General discussion
- Topic: Bluepill: 2 different timers to read 2 different FREQS
- Replies: 17
- Views: 7430
Re: Bluepill: 2 different timers to read 2 different FREQS
I've 2 digital signals to read/measure:
A: car tachometer data (typically 2pulses/Revolution in 4 cylinder engines)
B: car speedometer data (lets say 1000pulses/KM)
Both of them are not strictly releated each other...
I want the average cpu cycles lenght of each pulses, to calculate its freqs ...