To test how the device performs when on USB power, I added support for measuring the supply voltage (should stay at 3.3 V when powered from 5 V USB) and also the temperature (since there is a temperature sensor in the chip and it would be a shame not to use it.)
There are still a few bits of weirdness in the ADC code, but after a few tries, it gets plausible results and then continues to do so. With this, I verified that the system voltage does indeed stay at 3.3 V when I ramp up the USB voltage from ~3.3 V to 5.5 V. Then I added activation of the USB module. The chip's reference manual does a good job at steering the reader around finding the last clock gate one has to enable for the USB module to work at all, but I eventually found it. The firmware can now detect: - USB A: USB ID is pulled low by the cable, - USB B: USB ID floats and we receive SOFs, - no USB: USB ID floats and we don't receive SOFs. Here's a screenshot: http://downloads.qi-hardware.com/people/werner/anelok/tmp/brd0-usbdet.jpg The 39.730 MHz clock frequency shown is before switching to the crystal-based RF clock. After, it would be 48.000 MHz, as required for USB. The precision of the temperature is a shameless exaggeration - the theoretical maximum resolution the hardware could possibly achieve is about 0.1 K and in reality I'm lucky if measurements don't vary by more than one degree. The next challenge will be a the USB stack. Freescale actually provide one but it's under a messy license. Well, it's not that I hadn't done this before, and the USB controller actually looks fairly nice, even if the documentation is particularly cryptic. - Werner _______________________________________________ Qi Hardware Discussion List Mail to list (members only): [email protected] Subscribe or Unsubscribe: http://lists.en.qi-hardware.com/mailman/listinfo/discussion

