ubb-patgen/README |
| 1 | UBB pattern generator |
| 2 | ===================== |
| 3 | |
| 4 | ubb-patgen uses the MMC controller in the Ben Nanonote to send a |
| 5 | digital pattern on the DATx lines of UBB. All four DATx lines can |
| 6 | be used. The maximum output rate is 56 MHz, the maximum pattern |
| 7 | size is 8128 nibbles. |
| 8 | |
| 9 | ubb-patgen can also output a clock of arbitrary duration on the |
| 10 | CLK signal. |
| 11 | |
| 12 | The frequencies available for the pattern and the clock signal |
| 13 | range from 41 kHz to 56 MHz. A map can be found here: |
| 14 | http://downloads.qi-hardware.com/people/werner/ubb/ben-mmc-clk.png |
| 15 | |
| 16 | |
| 17 | Frequency list |
| 18 | -------------- |
| 19 | |
| 20 | # ubb-patgen |
| 21 | |
| 22 | shows the available frequencies in ascending order and the |
| 23 | corresponding MMC clock divider and bus clock tap settings. |
| 24 | |
| 25 | # ubb-patgen -q |
| 26 | |
| 27 | does the same but shows only the frequencies (in Hz) as |
| 28 | floating-point numbers. |
| 29 | |
| 30 | |
| 31 | Frequency selection |
| 32 | ------------------- |
| 33 | |
| 34 | # ubb-patgen -f 17000000 |
| 35 | # ubb-patgen -f 17M |
| 36 | # ubb-patgen -f 17MHz |
| 37 | |
| 38 | all look for the available frequency closest to 17 MHz and print |
| 39 | its value in Hz. |
| 40 | |
| 41 | Appending a + limits the search to frequencies greater than or |
| 42 | equal to the specified value. Similarly, - searches for |
| 43 | frequencies that don't exceed the specified value. Examples: |
| 44 | |
| 45 | # ubb-patgen -f 10MHz |
| 46 | 9882352.941176 |
| 47 | # ubb-patgen -f 10MHz+ |
| 48 | 10500000.000000 |
| 49 | |
| 50 | # ubb-patgen -f 15M |
| 51 | 15272727.272727 |
| 52 | # ubb-patgen -f 15M- |
| 53 | 14000000.000000 |
| 54 | |
| 55 | Note that this form of invocation only searches the frequency |
| 56 | table but does not produce any output on UBB. |
| 57 | |
| 58 | |
| 59 | Clock output |
| 60 | ------------ |
| 61 | |
| 62 | # ubb-patgen -c |
| 63 | |
| 64 | outputs a clock on CLK. The default is 1 MHz and can be changed |
| 65 | with the option -f. |
| 66 | |
| 67 | ubb-patgen exits and leaves the clock running. To wait for a |
| 68 | while and clean up on exit, add the delay in seconds, e.g.: |
| 69 | |
| 70 | # ubb-patgen -f 500kHz -c 10 |
| 71 | |
| 72 | To stop the MMC bus clock, run |
| 73 | |
| 74 | # ubb-patgen -c 0 |
| 75 | |
| 76 | ubb-patgen warns if the selected frequency does not match the |
| 77 | requested frequency, e.g., |
| 78 | |
| 79 | # ubb-patgen -f 100kHz -c |
| 80 | bus clk = 100.962 kHz (+0.96%) |
| 81 | |
| 82 | This warning can be suppressed with the option -q. |
| 83 | |
| 84 | |
| 85 | Pattern output |
| 86 | -------------- |
| 87 | |
| 88 | # ubb-patgen 0110 |
| 89 | |
| 90 | first sets the DATx lines to 0, then outputs a 1 bit on DAT0 for |
| 91 | two clock cycles, and returns DAT0 to zero. |
| 92 | |
| 93 | Each digit is a nibble representing the four DATx lines, with DAT0 |
| 94 | having the value 1, DAT1 2, DAT2 4, and DAT3 8. |
| 95 | |
| 96 | The repetition of a nibble can also be expressed by following it |
| 97 | with the number of repetitions in curly braces, e.g., |
| 98 | |
| 99 | # ubb-patgen 01{2}0 |
| 100 | |
| 101 | The options -f and -q work as usual. |
| 102 | |
| 103 | The clock is normally not output but can be activated with the |
| 104 | option -C. Note that the clock output is not continuous in this |
| 105 | case. |
| 106 | |
| 107 | The pattern can be read from a file. All whitespace is ignored |
| 108 | and so are comments beginning with #: |
| 109 | |
| 110 | # cat <<EOF >pattern-file |
| 111 | 1 # idle state is high |
| 112 | # send two characters in RS232 format |
| 113 | 0 00010010 1 # "H" |
| 114 | 0 10010110 1 # "i" |
| 115 | 1 # return to idle (high) |
| 116 | EOF |
| 117 | # ubb-patgen -f 115.2k pattern-file |
| 118 | |
| 119 | If a file with the same name as a pattern exists, ubb-patgen will |
| 120 | try to load that file. This can be prevented with the option -p. |
| 121 | |
| 122 | If only some of the DATx lines should be used for pattern output, |
| 123 | the option -m MASK can be used to leave the unused lines in their |
| 124 | previous state. MASK is a value in C syntax. Only lines whose bit |
| 125 | is set are used for pattern output. |
| 126 | |
| 127 | |
| 128 | External trigger |
| 129 | ---------------- |
| 130 | |
| 131 | ubb-patgen normally sends the pattern immediately. This can be |
| 132 | delayed by waiting for an external trigger with the option -t. |
| 133 | |
| 134 | # ubb-patgen -t 0 0f0 |
| 135 | |
| 136 | configures CLK as an input, waits for it to become zero, and then |
| 137 | outputs the 010 pattern. If CLK is already zero, ubb-patgen will |
| 138 | send the pattern immediately. |
| 139 | |
| 140 | Likewise, -t 1 waits for CLK to become 1. -t cannot be used with |
| 141 | the -C option. |
| 142 | |
| 143 | ubb-patgen usually starts the pattern about 2 us after the |
| 144 | trigger, but this can be delayed by other system activity. |