STM32F103 math package

OP #7114844
calculation time fixcomma for si5351


I have a project with Arduino UNO where the execution time for the line 
below is 5,78 ms. The line is part of a Wobbler, which is running with 
64 steps only. I awaited 1.28 ms with BluePill. After porting to 
STM32F103 see yourself.
1
si5351.set_freq_manual((fnow) * 100ULL, pll_freq, SI5351_CLK0); //4,5 ms
2
//bin von BluePill enttäuscht

My expectation was, using BluePill, 5,78 / (72/16) MHz = 1,28 ms. Result 
see above.
Only 22% quicker.
I'm using only fixcomma variables.

Any proposals?

Codes available if wanted.
Guest
Rudi D. wrote:
> Any proposals?

It looks as if there is no proper setup for the clock. Therefore the 
chip runs from only a slow internal RC-oscillator. Another idea is, that 
the function "si5351.set_freq_manual" does it's calculations in a very 
clumsy way. Or both, slow clock and clumsy algorithm.

W.S.
Guest
Independent on I2C speed 100k or 400k nothing changes.
Still 4,4 ms for the si5351 Command.

Also the time needed for encoder interrupt is very short. If  I set the 
interrupt to 5 ms -missing some encoder steps- does not change the 4,4 
ms.

I'm familiar with fixcomma in assembler with tiny4313 and wobble 
frequencies at max. 70 HZ. DDS Project in RMorg 2014-2015 with AD9850 up 
to 30 MHz.

I think this would be a solution, but the si5351 is much more complex 
comp. to AD9850. I want to use the si5351 up to  120 MHz. With some 
phase mod. to have some sound.
Will see if I have enough drive to step into the si53551 deteils 
registers and communication.
Guest
ruilxa wrote:
> I think this would be a solution, but the si5351 is much more complex
> comp. to AD9850.

The SI5351 is a clock-generator based on PLL - it gives only a digital 
output. The AD9850 is a DDS - it gives an analog output and needs a low 
pass filter on the output.

While the AD9850 is very agile (it only needs to set the phase-offset to 
switch it from one frequency to another) the SI5351 needs some time to 
settle the VCO and its phase-loops.

Both chips are complex in their own way, but the use of the SI5351 ist 
much more complicated compared to the AD9850, because the SI needs a 
combination of 2 integer numbers, which give the best approximation to 
the desired frequency - while the AD needs only the best value for the 
phase increment.

W.S.
Guest
Rudi D. wrote:
> si5351.set_freq_manual

is this from some public library? When it was designed for Arduino with 
AVR, a common problem is the superfluous usage of type double. With 8 
Bit AVR, the calculations were performed as float, but when used with 
Cortex-M, expensive double math is used.
Guest
Obviously, FP math is not an issue in this lib.
The development of this lib looks stale, there was as issue:
https://github.com/etherkit/Si5351Arduino/issues/22
I don't use this chip and cannot help further. It may be a problem of 
the pll setting to a new frequency. Or a problem of the I2C transfer, 
there was a comment of using a bulk transfer and speeding it up.
Guest
> the function "si5351.set_freq_manual" does it's calculations in a very
> clumsy way.

Indeed.

> si5351.set_freq_manual((fnow) * 100ULL,

Da kraeuseln sich einem ja die Nasenhaare.
OP
>
>> si5351.set_freq_manual((fnow) * 100ULL,
>
> Da kraeuseln sich einem ja die Nasenhaare.

der si will ja 1/100 Hz Angaben.
Besser wäre eine Erklärung, warum sich die Haare kräuseln

I guess by using HAL the differences should be minor as it's a deep abstraction layer over the CMSIS. Usually the StdPeripheral library (or LL - low level) libraries -which also wrap the CMSIS- have significant differences between different families.

Reply

A question of your own? This thread is over 4 years old. Ask it in a thread of its own – more people read along there, and it gets answered more often and sooner.

Start a new thread

A fix, an addition or feedback on this thread? Then reply here.

Formatting
  • [c]C-Code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.