anelok: clocks and MMC

Werner Almesberger werner at almesberger.net
Sun Oct 20 04:23:46 EDT 2013


And the hardware testing continued:

- memory card: ported the MMC-SPI driver from antorcha/tornado and
  added retrieval and partial decoding of the card identification
  (CID)

- memory card again: also the card detection switch works

- then I added measurement of the MCU's internal clock. Turns out it
  ran slower than I had thought, only ~21 MHz instead of 48 MHz. So
  I set it now to ~40 MHz. For some reason, the internal oscillator
  doesn't want to do 48 MHz, but that's not a big issue.

- also added operation off the external clock provided by the
  transceiver. There were two unpleasant surprises. One, the default
  clock (1 MHz) is slower than the minimum input clock for the PLL.
  The PLL doesn't seem to mind running from a 1 MHz clock, but then
  its output would be too slow for USB :-(

  The second unpleasant surprise was that the AT86RF232, unlike the
  231, 233, and even the ancient 230, does't output more than 1 MHz.
  At least that's what the manual says. In practice, setting the
  clock output register to 2 MHz does produce a nice 2 MHz signal,
  which then also makes the PLL happy.

  Not sure what to do with this. Could be that we're lucky and the
  232 will be fine. Or maybe we have to switch to 231 or 233, which
  are a bit more expensive, or - the least pleasant
  alternative - give the MCU its own crystal.

- I had a quick look at running with USB power. So far, this seems
  to work, though I haven't tried with VBUS larger than 4.0 V yet.

  One problem is that there's no nice way to detect whether VBUS has
  been connected. Not so nice ways would include firing up bandgap,
  DAC, and comparator, and checking whether Vsys is well above the
  battery voltage.

  Another possibility would be to connect VBUS to a voltage divider
  and then a GPIO, but that's somewhat hairy since VBUS is very
  tightly routed and we don't have any GPIOs with good interrupt
  capabilities left. I could of course poll it, which would be less
  elegant.

Here's what the status screen now looks like:

http://downloads.qi-hardware.com/people/werner/anelok/tmp/brd0-clk-mmc.jpg

The first line shows the chip family (KL25), chip revision (2.9),
and the CPU clock frequency. The second and third lines show
firmware build data and transceiver information, as before.

The fourth line shows the memory card status. You can see the card
poke out from under the PCB in the upper left corner. And yes, it's
really a 128 MB card :)

The fifth line is reserved for USB.

- Werner



More information about the discussion mailing list


interactive