Reading [the True] Sample Rate (and AC-1 FAQ)
Russ has been improving some of the code in AC1. Got new code to read the sample rate and I modified it to read Hz instead of KHz. (This sort of tells you that the code is easy to modify)
The sample rate displayed is the sample rate as determined by the Sabre32 DAC in the Buffalo II board. This rate is the true measure of the sample rate as it enters the DAC because it is derived from the DAC’s DPLL register values. This the the best way to check the sample rate especially If you don’t trust what the application or operating system tells you.
According to Russ in this post at diyaudio, monitoring the value of the DPLL registers would give you an indication of the quality of the incoming signal. (You can also modify the code to show you the DPLL register values rather than the sample rate)
Notice that sometimes it adjusts by 1Hz. That is the DPLL adjusting to maintain a lock in the incoming signal.
Note on the value of the sample rate: The variation from ideal (e.g. from 44,100 hz) can be mostly attributed to the accuracy or the crystal and clocks. With the musiland crystal at 100 ppm (typical value) and the Crystek oscillator at 20 ppm one can account for most if not all the variation from ideal. I did some quick calculation with worse case values for the crystal and clock for deriving and detecting a frequency of 192KHz. The Musiland crystal contributed 19.2 hz to the variation and the Buffalo clock 3.8 hz to the variation.
Here is a video showing the sample rate as I changed the sample rate output in the Musiland device driver control panel. (there is some loss of accuracy of a few Hz due to the use of integer operations).
Musiland control panel:
USEFUL TIPS FOR AC1/AC2
FOR LOADING NEW FIRMWARE INTO FEMTO
- Loading/burning firmware into FEMTO
- Download and Install FLIP
- Copy libusb0.dll from usb directory to bin directory: copy the file C:\Program Files\Atmel\Flip 3.4.1\usb\libusb0.dll to C:\Program Files\Atmel\Flip 3.4.1\bin (Make sure you copy the file because it is needed on both directories)
Insert FEMTO into USB port and do the following sequence:
- Push HWD button
- Push RST button
- Release RST button
- Release HWD button
At this point Windows will recognize the device and will guide you though the driver installation. Select manual installation and you point the path to: C:\Program Files\Atmel\Flip 3.4.1\usb
Start the software and download firmware
- Start FLIP
- Start USB communication: Settings->Communication->USB
- Select device: Device-Select->AT90USB162
- Select hex file: File->Load Hex File->filename.hex
- Click Run
Download and Install
- AVR Studio
- WinAVR (I think this is for the gcc compiler)
Create a new project
- Start AVR Studio
- Create new project
Select AVRGCC type
Select debug platform (I think anything will do)
Select target device (the Femto device)
Import existing files (the file you want to modify)
- On the left side there are a series of folders right click on each and import existing files
Make your changes and compile
- Edit source code
- Save file
- Build->build all
The hex file is created in a folder called “default” inside your project file. The project file is in the My Documents folder. Then use Flip to burn new code.