All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv3 bluetooth-next 0/2] at86rf230: add support for xtal trim register
@ 2015-02-24 10:11 Alexander Aring
  2015-02-24 10:11 ` [PATCHv3 bluetooth-next 1/2] at86rf230: copy pdata to driver allocated space Alexander Aring
  2015-02-24 10:11 ` [PATCHv3 bluetooth-next 2/2] at86rf230: add support for external xtal trim Alexander Aring
  0 siblings, 2 replies; 9+ messages in thread
From: Alexander Aring @ 2015-02-24 10:11 UTC (permalink / raw)
  To: linux-wpan
  Cc: kernel, mkl, Alexander Aring, Werner Almesberger, Thomas Stilwell

Hi,

I want to clarify how xtal_trim value is calculated now.

First of all the xtal_mode set to 0x5 will require a 16 Mhz clock signal at
pin 26. I don't have such at86rf2xx board which can do that, so I don't want
to support it right now.

The xtal_trim is only necesarry for external crystal, when xtal_mode == 0xF.
The xtal_trim value is calculated by:

CL = capacitor of used crystal
CX = connected capacitors at xtal pins
CPAR = in all at86rf2xx datasheets this is a constant value 3 pF,
       but this is different on each board setup. You need to fine
       tuning this value via CTRIM.
CTRIM = variable capacitor setting. Resolution is 0.3 pF range is
        0 pF upto 4.5 pF.

CL = 0.5 * (CX + CTRIM + CPAR)


Examples:

On atben [0]:

CL = 8 pF
CX = 12 pF
CPAR = 3 pF (We assume the magic constant from datasheet)
CTRIM = 0.9 pF

(12+0.9+3)/2 = 7.95 which is nearly at 8 pF

openlabs [1]:

CL = 16 pF
CX = 22 pF
CPAR = 3 pF (We assume the magic constant from datasheet)
CTRIM = 4.5 pF

(22+4.5+3)/2 = 14.75 which is the nearest value to 16 pF

For more information it's the section "Integrated Oscillator Setup" inside
the at86rf2xx datasheets. (In my case 8111C–MCU Wireless–09/09).

For a better calculation of the CPAR value, Werner Almesberger developed some
diagnostic tool [2], which I don't tried out yet.

- Alex

[0] http://projects.qi-hardware.com/index.php/p/ben-wpan/source/tree/master/atben
    (atben.sch, requires kicad tool)
[1] http://openlabs.co/OSHW/Raspberry-Pi-802.15.4-radio-files/rpi802154-r1.pdf
[2] http://projects.qi-hardware.com/index.php/p/ben-wpan/source/tree/master/tools/atrf-xtal

changes since v3:
 - remove setting of xtal_mode. Instead we setting xtal_trim only.

changes since v2:
 - copy platform data to driver allocated space

Cc: Werner Almesberger <werner@almesberger.net>
Cc: Thomas Stilwell <stilwellt@openlabs.co>

Alexander Aring (2):
  at86rf230: copy pdata to driver allocated space
  at86rf230: add support for external xtal trim

 .../bindings/net/ieee802154/at86rf230.txt          |  3 ++
 drivers/net/ieee802154/at86rf230.c                 | 59 +++++++++++++---------
 include/linux/spi/at86rf230.h                      |  1 +
 3 files changed, 38 insertions(+), 25 deletions(-)

-- 
2.3.0


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-02-24 10:55 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-24 10:11 [PATCHv3 bluetooth-next 0/2] at86rf230: add support for xtal trim register Alexander Aring
2015-02-24 10:11 ` [PATCHv3 bluetooth-next 1/2] at86rf230: copy pdata to driver allocated space Alexander Aring
2015-02-24 10:11 ` [PATCHv3 bluetooth-next 2/2] at86rf230: add support for external xtal trim Alexander Aring
2015-02-24 10:21   ` Marc Kleine-Budde
2015-02-24 10:28     ` Alexander Aring
2015-02-24 10:34       ` Marc Kleine-Budde
2015-02-24 10:42         ` Alexander Aring
2015-02-24 10:47           ` Alexander Aring
2015-02-24 10:55           ` Marc Kleine-Budde

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.