Hi,
I'm working on a python library to interface with CC1101.
Following the baud rate calculation in the cc1101 spec sheet (p 35), I came up with the following function.
# python
import numpy
def baud_rate(osc, rate):
drate_e = int( numpy.log2(rate * numpy.power(2, 20) / osc) )
drate_m = int( (rate * numpy.power(2, 28) / osc * numpy.power(2, drate_e)) ) - 256
return (drate_e, drate_m)
My DRATE_E calculation seems perfect. The values I get match the test values in Smart RF Studio 7, but my DRATE_M value is way out...
I've gone over the formulas a dozen times at least. Anyone experience this problem before?
Is the formula in the spec-sheet not accurate? or (most likely) do I have a glaring error that I'm missing?
Thanks!
>>> baud_rate(26000000, 2400)
(6, 1585536) # should be (6, 131)
>>> baud_rate(26000000, 4800)
(7, 6343040)
>>>
.