mitxela.com forum
Welcome. Please log in or register.

using timers on the stm32f103c8t6
DAVID Posted: 25 Jan 2019, 05:12 PM
Avatar
I love mcus

Member
Posts: 237
Joined: 10-September 17
hi, i am recently digging around with PCM on the atmega2560 mcu (the one found on the arduino mega) but i run into performance issues when playing multiple samples at a high pitch at the same time since it is quite slow for this task. So then how do you use timers on the stm32f103c8t6.

-------------
[top]
mit Posted: 1 Feb 2019, 10:16 PM
Avatar
yeah whatever

Admin
Posts: 566
Joined: 4-May 16
Hi, you'll have to give me more information if you want help. How are you running code on the stm32f103 ? I always did it with makefile, arm-gcc and the standard peripheral libraries provided by ST. These are a bit more complicated than the single registers you get on AVR chips. Annoyingly there isn't a single datasheet for the chip, it's split into a part datasheet, reference manual, and processor manual. Took me ages of reading through these documents before I was able to blink an LED...

-------------
[top]
DAVID Posted: 2 Feb 2019, 03:22 AM
Avatar
I love mcus

Member
Posts: 237
Joined: 10-September 17
ok so i will use arm-gcc, and i will want to use 5 timers, so that 4 timers produce a interrupt between 1000 hz to 48000 hz (something similar to CTC mode on the avr so that i can controlled the interrupt with something similar to the OCRxA) and the fifth i want it to make a 1 khz interrupt

-------------
[top]
mit Posted: 2 Feb 2019, 01:17 PM
Avatar
yeah whatever

Admin
Posts: 566
Joined: 4-May 16
So take a look at the reference manual: https://www.st.com/resource/en/reference_manual/cd00171190.pdf

And the datasheet: https://www.st.com/resource/en/datasheet/cd00161566.pdf

The reference manual is for several similar chips, but on the datasheet, section 2.1, you can see that the stm32f103C series has 3 general purpose timers and 1 "advanced control" timer. I don't know if there's a similar mode to CTC on these chips, you'll have to read through the reference manual.

But using CTC to make waveforms is a kind-of unusual tactic that I only started doing because it was available. The "proper" way to do audio output is to have an audio buffer, and use DMA to pipe it to a DAC.

-------------
[top]

Sign in to post a reply.