![](/media/cache/profiles/f0fcf351df4eb6786e9bb6fc4e2dee02.jpg.50x50_q85.jpg)
Check System frequency of Nucleo F411RE board. Also F401RE.
<May 12th, 2015>
I have confirmed that both mbed lib. and mbed-src lib. have updated to change F411RE mbed System clock and USB clock as below.
fVCO = fPLL-in x (PLLN/PLLM), fPLL-out = fVCO/PLLP, fUSB-out = fVCO/PLLQ Use PLL with PLLN=192, PLLM=4 Use HSE(not Xtal but External Clock)=8000000Hz PLL/Base freq= 384000000Hz Use PLL with PLLP=4, PLLQ=8 PLL/System freq= 96000000Hz PLL/USB freq= 48000000Hz SYSCLK clock freq. = 96000000Hz HCLK clock freq. = 96000000Hz PCLK1 clock freq. = 48000000Hz PCLK2 clock freq. = 96000000Hz
mbed lib. Rev. -> 98 & mbed-src lib. Rev. ->539
We can use USB with proper colok!.
If you would like to use 100MHz System clock, please refer updated "Nucleo_F411RE_SysClk".
--------
I made a clock checking program for Nucleo F411RE and F401 mbed board.
Picture shows F411RE example.
System frequency is 100MHz. Looks okay for me.
USB frequency is 44.4MHz? -> USB clock needs accurate frequency 48MHz.
Once keeping 100MHz system clock freq., we can select PLLQ value only 9 or 8.
If PLLQ=9, USB Freq. is 44.4MHz (current setting).
If PLLQ=8, USB Freq. is 50.0MHz.
Best selection looks follows.
PLL clock -> HSE = 8MHz
PLLN= 192, PLLM = 4
PLL Freq. = (PLL Clock)*(PLLN/PLLM) = 8MHz * 192 / 4 = 384MHz
System clock = (PLL Freq.)/PLLP = 384MHz/4 = 96MHz
USB clock = (PLL Freq.)/PLLQ = 384MHz/8 = 48MHz
Is this result okay?
or
Is my program wrong?
main.cpp@0:0766e37fd3d6, 2014-11-02 (annotated)
- Committer:
- kenjiArai
- Date:
- Sun Nov 02 04:58:59 2014 +0000
- Revision:
- 0:0766e37fd3d6
- Child:
- 1:2d6d2ccd87f8
System clock frequency checking program only for STM32F411
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kenjiArai | 0:0766e37fd3d6 | 1 | /* |
kenjiArai | 0:0766e37fd3d6 | 2 | * mbed Application program / Frequency Counter with GPS 1PPS Compensation |
kenjiArai | 0:0766e37fd3d6 | 3 | * |
kenjiArai | 0:0766e37fd3d6 | 4 | * Copyright (c) 2014 Kenji Arai / JH1PJL |
kenjiArai | 0:0766e37fd3d6 | 5 | * http://www.page.sannet.ne.jp/kenjia/index.html |
kenjiArai | 0:0766e37fd3d6 | 6 | * http://mbed.org/users/kenjiArai/ |
kenjiArai | 0:0766e37fd3d6 | 7 | * Created: Nobember 2nd, 2014 |
kenjiArai | 0:0766e37fd3d6 | 8 | * Revised: Nobember 2nd, 2014 |
kenjiArai | 0:0766e37fd3d6 | 9 | * |
kenjiArai | 0:0766e37fd3d6 | 10 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, |
kenjiArai | 0:0766e37fd3d6 | 11 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE |
kenjiArai | 0:0766e37fd3d6 | 12 | * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
kenjiArai | 0:0766e37fd3d6 | 13 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
kenjiArai | 0:0766e37fd3d6 | 14 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
kenjiArai | 0:0766e37fd3d6 | 15 | */ |
kenjiArai | 0:0766e37fd3d6 | 16 | |
kenjiArai | 0:0766e37fd3d6 | 17 | #include "mbed.h" |
kenjiArai | 0:0766e37fd3d6 | 18 | |
kenjiArai | 0:0766e37fd3d6 | 19 | // Object ---------------------------------------------------------------------------------------- |
kenjiArai | 0:0766e37fd3d6 | 20 | Serial pc(USBTX, USBRX); |
kenjiArai | 0:0766e37fd3d6 | 21 | DigitalOut myled(LED1); |
kenjiArai | 0:0766e37fd3d6 | 22 | |
kenjiArai | 0:0766e37fd3d6 | 23 | // Definition ------------------------------------------------------------------------------------ |
kenjiArai | 0:0766e37fd3d6 | 24 | #define BAUD(x) pc.baud(x) |
kenjiArai | 0:0766e37fd3d6 | 25 | #define GETC(x) pc.getc(x) |
kenjiArai | 0:0766e37fd3d6 | 26 | #define PUTC(x) pc.putc(x) |
kenjiArai | 0:0766e37fd3d6 | 27 | #define PRINTF(...) pc.printf(__VA_ARGS__) |
kenjiArai | 0:0766e37fd3d6 | 28 | #define READABLE(x) pc.readable(x) |
kenjiArai | 0:0766e37fd3d6 | 29 | |
kenjiArai | 0:0766e37fd3d6 | 30 | // USB Frequency |
kenjiArai | 0:0766e37fd3d6 | 31 | #define USB_FREQ_H 48100000 |
kenjiArai | 0:0766e37fd3d6 | 32 | #define USB_FREQ_L 47900000 |
kenjiArai | 0:0766e37fd3d6 | 33 | |
kenjiArai | 0:0766e37fd3d6 | 34 | // RAM ------------------------------------------------------------------------------------------- |
kenjiArai | 0:0766e37fd3d6 | 35 | |
kenjiArai | 0:0766e37fd3d6 | 36 | // ROM / Constant data --------------------------------------------------------------------------- |
kenjiArai | 0:0766e37fd3d6 | 37 | char *const cmsg1 = "freq="; |
kenjiArai | 0:0766e37fd3d6 | 38 | char *const cmsg2 = "Use HSI(internal RC/High speed)"; |
kenjiArai | 0:0766e37fd3d6 | 39 | char *const cmsg3 = "Use HSE(External Xtal)"; |
kenjiArai | 0:0766e37fd3d6 | 40 | char *const cmsg4 = "Use PLL with"; |
kenjiArai | 0:0766e37fd3d6 | 41 | char *const cmsg5 = "??? following infromation is not valid !"; |
kenjiArai | 0:0766e37fd3d6 | 42 | char *const cmsg6 = "clock freq. ="; |
kenjiArai | 0:0766e37fd3d6 | 43 | char *const cmsg7 = "No clock"; |
kenjiArai | 0:0766e37fd3d6 | 44 | char *const cmsg8 = "Use LSE(external Xtal)=32768Hz"; |
kenjiArai | 0:0766e37fd3d6 | 45 | char *const cmsg9 = "Use LSI(internal RC/Low speed), RC="; |
kenjiArai | 0:0766e37fd3d6 | 46 | char *const cmsg10= "Use HSE(external Xtal & prescaler)"; |
kenjiArai | 0:0766e37fd3d6 | 47 | |
kenjiArai | 0:0766e37fd3d6 | 48 | // Function prototypes --------------------------------------------------------------------------- |
kenjiArai | 0:0766e37fd3d6 | 49 | |
kenjiArai | 0:0766e37fd3d6 | 50 | // Function prototypes --------------------------------------------------------------------------- |
kenjiArai | 0:0766e37fd3d6 | 51 | |
kenjiArai | 0:0766e37fd3d6 | 52 | //------------------------------------------------------------------------------------------------- |
kenjiArai | 0:0766e37fd3d6 | 53 | // Control Program |
kenjiArai | 0:0766e37fd3d6 | 54 | //------------------------------------------------------------------------------------------------- |
kenjiArai | 0:0766e37fd3d6 | 55 | void put_rn ( void ) |
kenjiArai | 0:0766e37fd3d6 | 56 | { |
kenjiArai | 0:0766e37fd3d6 | 57 | PUTC('\r'); |
kenjiArai | 0:0766e37fd3d6 | 58 | PUTC('\n'); |
kenjiArai | 0:0766e37fd3d6 | 59 | } |
kenjiArai | 0:0766e37fd3d6 | 60 | |
kenjiArai | 0:0766e37fd3d6 | 61 | void cpu_freq(void) |
kenjiArai | 0:0766e37fd3d6 | 62 | { |
kenjiArai | 0:0766e37fd3d6 | 63 | uint32_t m1 = 0, m2 = 0, m3 = 0, m4 = 0, m5 = 0; |
kenjiArai | 0:0766e37fd3d6 | 64 | |
kenjiArai | 0:0766e37fd3d6 | 65 | PRINTF("--- Power Control ---"); |
kenjiArai | 0:0766e37fd3d6 | 66 | put_rn(); |
kenjiArai | 0:0766e37fd3d6 | 67 | m1 = PWR->CR; |
kenjiArai | 0:0766e37fd3d6 | 68 | PRINTF( "CR = 0x%08x", m1 ); |
kenjiArai | 0:0766e37fd3d6 | 69 | put_rn(); |
kenjiArai | 0:0766e37fd3d6 | 70 | m1 = PWR->CSR; |
kenjiArai | 0:0766e37fd3d6 | 71 | PRINTF( "CSR = 0x%08x", m1 ); |
kenjiArai | 0:0766e37fd3d6 | 72 | put_rn(); |
kenjiArai | 0:0766e37fd3d6 | 73 | PRINTF("--- Clocks related Reg. ---"); |
kenjiArai | 0:0766e37fd3d6 | 74 | put_rn(); |
kenjiArai | 0:0766e37fd3d6 | 75 | m1 = RCC->CR; |
kenjiArai | 0:0766e37fd3d6 | 76 | PRINTF( "CR = 0x%08x", m1 ); |
kenjiArai | 0:0766e37fd3d6 | 77 | put_rn(); |
kenjiArai | 0:0766e37fd3d6 | 78 | m1 = RCC->PLLCFGR; |
kenjiArai | 0:0766e37fd3d6 | 79 | PRINTF( "PLLCFGR = 0x%08x", m1 ); |
kenjiArai | 0:0766e37fd3d6 | 80 | put_rn(); |
kenjiArai | 0:0766e37fd3d6 | 81 | m1 = RCC->CFGR; |
kenjiArai | 0:0766e37fd3d6 | 82 | PRINTF( "CFGR = 0x%08x", m1 ); |
kenjiArai | 0:0766e37fd3d6 | 83 | put_rn(); |
kenjiArai | 0:0766e37fd3d6 | 84 | m1 = RCC->CIR; |
kenjiArai | 0:0766e37fd3d6 | 85 | PRINTF( "CIR = 0x%08x", m1 ); |
kenjiArai | 0:0766e37fd3d6 | 86 | put_rn(); |
kenjiArai | 0:0766e37fd3d6 | 87 | m1 = RCC->AHB1RSTR; |
kenjiArai | 0:0766e37fd3d6 | 88 | PRINTF( "AHB1RSTR = 0x%08x", m1 ); |
kenjiArai | 0:0766e37fd3d6 | 89 | put_rn(); |
kenjiArai | 0:0766e37fd3d6 | 90 | m1 = RCC->APB2RSTR; |
kenjiArai | 0:0766e37fd3d6 | 91 | PRINTF( "APB2RSTR = 0x%08x", m1 ); |
kenjiArai | 0:0766e37fd3d6 | 92 | put_rn(); |
kenjiArai | 0:0766e37fd3d6 | 93 | m1 = RCC->APB1RSTR; |
kenjiArai | 0:0766e37fd3d6 | 94 | PRINTF( "APB1RSTR = 0x%08x", m1 ); |
kenjiArai | 0:0766e37fd3d6 | 95 | put_rn(); |
kenjiArai | 0:0766e37fd3d6 | 96 | m1 = RCC->AHB1ENR; |
kenjiArai | 0:0766e37fd3d6 | 97 | PRINTF( "AHB1ENR = 0x%08x", m1 ); |
kenjiArai | 0:0766e37fd3d6 | 98 | put_rn(); |
kenjiArai | 0:0766e37fd3d6 | 99 | m1 = RCC->APB2ENR; |
kenjiArai | 0:0766e37fd3d6 | 100 | PRINTF( "APB2ENR = 0x%08x", m1 ); |
kenjiArai | 0:0766e37fd3d6 | 101 | put_rn(); |
kenjiArai | 0:0766e37fd3d6 | 102 | m1 = RCC->APB2LPENR; |
kenjiArai | 0:0766e37fd3d6 | 103 | PRINTF( "APB2LPENR= 0x%08x", m1 ); |
kenjiArai | 0:0766e37fd3d6 | 104 | put_rn(); |
kenjiArai | 0:0766e37fd3d6 | 105 | m1 = RCC->APB1LPENR; |
kenjiArai | 0:0766e37fd3d6 | 106 | PRINTF( "APB1LPENR= 0x%08x", m1 ); |
kenjiArai | 0:0766e37fd3d6 | 107 | put_rn(); |
kenjiArai | 0:0766e37fd3d6 | 108 | m1 = RCC->CSR; |
kenjiArai | 0:0766e37fd3d6 | 109 | PRINTF( "CSR = 0x%08x", m1 ); |
kenjiArai | 0:0766e37fd3d6 | 110 | put_rn(); |
kenjiArai | 0:0766e37fd3d6 | 111 | put_rn(); |
kenjiArai | 0:0766e37fd3d6 | 112 | m1 = RCC->CFGR & RCC_CFGR_SWS; /* Get SYSCLK source */ |
kenjiArai | 0:0766e37fd3d6 | 113 | switch (m1) { |
kenjiArai | 0:0766e37fd3d6 | 114 | case 0x00: // HSI used as system clock |
kenjiArai | 0:0766e37fd3d6 | 115 | PRINTF( "%s, %s%dHz", cmsg2, cmsg1,HSI_VALUE ); |
kenjiArai | 0:0766e37fd3d6 | 116 | m2 = HSI_VALUE; |
kenjiArai | 0:0766e37fd3d6 | 117 | break; |
kenjiArai | 0:0766e37fd3d6 | 118 | case 0x04: // HSE used as system clock |
kenjiArai | 0:0766e37fd3d6 | 119 | PRINTF( "%s, %s%dHz", cmsg3, cmsg1, HSE_VALUE ); |
kenjiArai | 0:0766e37fd3d6 | 120 | m2 = HSE_VALUE; |
kenjiArai | 0:0766e37fd3d6 | 121 | break; |
kenjiArai | 0:0766e37fd3d6 | 122 | case 0x08: // PLL used as system clock |
kenjiArai | 0:0766e37fd3d6 | 123 | PRINTF("fVCO = fPLL-in x (PLLN/PLLM), fPLL-out = fVCO/PLLP, fUSB-out = fVCO/PLLQ"); |
kenjiArai | 0:0766e37fd3d6 | 124 | put_rn(); |
kenjiArai | 0:0766e37fd3d6 | 125 | m5 = (RCC->PLLCFGR >> 6) & 0x1ff; // PLLN |
kenjiArai | 0:0766e37fd3d6 | 126 | m1 = RCC->PLLCFGR & 0x3f; // PLLM |
kenjiArai | 0:0766e37fd3d6 | 127 | PRINTF( "%s PLLN=%d, PLLM=%d", cmsg4, m5, m1 ); |
kenjiArai | 0:0766e37fd3d6 | 128 | put_rn(); |
kenjiArai | 0:0766e37fd3d6 | 129 | m3 = (RCC->PLLCFGR >> 22) & 0x1; // Clock source |
kenjiArai | 0:0766e37fd3d6 | 130 | if (m3 == 0) { |
kenjiArai | 0:0766e37fd3d6 | 131 | // HSI oscillator clock selected as PLL clock source |
kenjiArai | 0:0766e37fd3d6 | 132 | m2 = (HSI_VALUE * (m5 / m1)); |
kenjiArai | 0:0766e37fd3d6 | 133 | PRINTF( "%s, RC=%dHz", cmsg2, HSI_VALUE ); |
kenjiArai | 0:0766e37fd3d6 | 134 | } else { |
kenjiArai | 0:0766e37fd3d6 | 135 | // HSE selected |
kenjiArai | 0:0766e37fd3d6 | 136 | m2 = (((HSE_VALUE) * m5) / m1); |
kenjiArai | 0:0766e37fd3d6 | 137 | if ((RCC->CR >> 18) & 0x01) { // check HSEBYP bit |
kenjiArai | 0:0766e37fd3d6 | 138 | // HSE(not Xtal) selected as PLL clock source |
kenjiArai | 0:0766e37fd3d6 | 139 | PRINTF( "Use HSE(not Xtal but External Clock)=%dHz", HSE_VALUE ); |
kenjiArai | 0:0766e37fd3d6 | 140 | } else { |
kenjiArai | 0:0766e37fd3d6 | 141 | // HSE(Xtal) selected as PLL clock source |
kenjiArai | 0:0766e37fd3d6 | 142 | PRINTF( "%s, Xtal=%dHz", cmsg3, HSE_VALUE ); |
kenjiArai | 0:0766e37fd3d6 | 143 | } |
kenjiArai | 0:0766e37fd3d6 | 144 | } |
kenjiArai | 0:0766e37fd3d6 | 145 | put_rn(); |
kenjiArai | 0:0766e37fd3d6 | 146 | PRINTF("PLL/Base %s%10dHz", cmsg1, m2); |
kenjiArai | 0:0766e37fd3d6 | 147 | put_rn(); |
kenjiArai | 0:0766e37fd3d6 | 148 | m3 = (RCC->PLLCFGR >> 16) & 0x03; // PLLP |
kenjiArai | 0:0766e37fd3d6 | 149 | switch (m3) { |
kenjiArai | 0:0766e37fd3d6 | 150 | case 0: |
kenjiArai | 0:0766e37fd3d6 | 151 | m3 = 2; |
kenjiArai | 0:0766e37fd3d6 | 152 | break; |
kenjiArai | 0:0766e37fd3d6 | 153 | case 1: |
kenjiArai | 0:0766e37fd3d6 | 154 | m3 = 4; |
kenjiArai | 0:0766e37fd3d6 | 155 | break; |
kenjiArai | 0:0766e37fd3d6 | 156 | case 2: |
kenjiArai | 0:0766e37fd3d6 | 157 | m3 = 6; |
kenjiArai | 0:0766e37fd3d6 | 158 | break; |
kenjiArai | 0:0766e37fd3d6 | 159 | case 3: |
kenjiArai | 0:0766e37fd3d6 | 160 | m3 = 8; |
kenjiArai | 0:0766e37fd3d6 | 161 | break; |
kenjiArai | 0:0766e37fd3d6 | 162 | } |
kenjiArai | 0:0766e37fd3d6 | 163 | m4 = (RCC->PLLCFGR >> 24) & 0x0f; // PLLQ |
kenjiArai | 0:0766e37fd3d6 | 164 | PRINTF("%s PLLP=%d, PLLQ=%d", cmsg4, m3, m4); |
kenjiArai | 0:0766e37fd3d6 | 165 | put_rn(); |
kenjiArai | 0:0766e37fd3d6 | 166 | PRINTF("PLL/System %s%10dHz", cmsg1, m2/m3); |
kenjiArai | 0:0766e37fd3d6 | 167 | put_rn(); |
kenjiArai | 0:0766e37fd3d6 | 168 | PRINTF("PLL/USB %s%10dHz", cmsg1, m2/m4); |
kenjiArai | 0:0766e37fd3d6 | 169 | m2 = m2/m4; |
kenjiArai | 0:0766e37fd3d6 | 170 | if ((m2 > USB_FREQ_H) || (m2 <USB_FREQ_L)){ |
kenjiArai | 0:0766e37fd3d6 | 171 | PRINTF(" -> USB Freq. is out of range!"); |
kenjiArai | 0:0766e37fd3d6 | 172 | } |
kenjiArai | 0:0766e37fd3d6 | 173 | put_rn(); |
kenjiArai | 0:0766e37fd3d6 | 174 | break; |
kenjiArai | 0:0766e37fd3d6 | 175 | default: // Not come here |
kenjiArai | 0:0766e37fd3d6 | 176 | PRINTF( cmsg5 ); |
kenjiArai | 0:0766e37fd3d6 | 177 | break; |
kenjiArai | 0:0766e37fd3d6 | 178 | } |
kenjiArai | 0:0766e37fd3d6 | 179 | put_rn(); |
kenjiArai | 0:0766e37fd3d6 | 180 | PRINTF( "SYSCLK %s%10dHz", cmsg6, HAL_RCC_GetSysClockFreq()); |
kenjiArai | 0:0766e37fd3d6 | 181 | put_rn(); |
kenjiArai | 0:0766e37fd3d6 | 182 | PRINTF( "HCLK %s%10dHz", cmsg6, HAL_RCC_GetHCLKFreq()); |
kenjiArai | 0:0766e37fd3d6 | 183 | put_rn(); |
kenjiArai | 0:0766e37fd3d6 | 184 | PRINTF( "PCLK1 %s%10dHz", cmsg6, HAL_RCC_GetPCLK1Freq()); |
kenjiArai | 0:0766e37fd3d6 | 185 | put_rn(); |
kenjiArai | 0:0766e37fd3d6 | 186 | PRINTF( "PCLK2 %s%10dHz", cmsg6, HAL_RCC_GetPCLK2Freq()); |
kenjiArai | 0:0766e37fd3d6 | 187 | put_rn(); |
kenjiArai | 0:0766e37fd3d6 | 188 | put_rn(); |
kenjiArai | 0:0766e37fd3d6 | 189 | // Check RTC Clock |
kenjiArai | 0:0766e37fd3d6 | 190 | PRINTF("--- RTC Clock ---"); |
kenjiArai | 0:0766e37fd3d6 | 191 | put_rn(); |
kenjiArai | 0:0766e37fd3d6 | 192 | m1 = (RCC->BDCR >> 8) & 0x03; |
kenjiArai | 0:0766e37fd3d6 | 193 | switch (m1) { |
kenjiArai | 0:0766e37fd3d6 | 194 | case 0: // no clock |
kenjiArai | 0:0766e37fd3d6 | 195 | PRINTF(cmsg7); |
kenjiArai | 0:0766e37fd3d6 | 196 | break; |
kenjiArai | 0:0766e37fd3d6 | 197 | case 1: // LSE |
kenjiArai | 0:0766e37fd3d6 | 198 | PRINTF(cmsg8); |
kenjiArai | 0:0766e37fd3d6 | 199 | break; |
kenjiArai | 0:0766e37fd3d6 | 200 | case 2: // LSI |
kenjiArai | 0:0766e37fd3d6 | 201 | PRINTF("%s 17 to 47, typ.32KHz", cmsg9); |
kenjiArai | 0:0766e37fd3d6 | 202 | break; |
kenjiArai | 0:0766e37fd3d6 | 203 | case 3: // HSE |
kenjiArai | 0:0766e37fd3d6 | 204 | PRINTF( cmsg10 ); |
kenjiArai | 0:0766e37fd3d6 | 205 | m2 = (RCC->PLLCFGR >> 16) & 0x1f; // RTCPRE |
kenjiArai | 0:0766e37fd3d6 | 206 | m3 = HSE_VALUE / m2; |
kenjiArai | 0:0766e37fd3d6 | 207 | PRINTF("%s%10dHz", cmsg6, m3); |
kenjiArai | 0:0766e37fd3d6 | 208 | put_rn(); |
kenjiArai | 0:0766e37fd3d6 | 209 | break; |
kenjiArai | 0:0766e37fd3d6 | 210 | default: // Not come here |
kenjiArai | 0:0766e37fd3d6 | 211 | PRINTF(cmsg5); |
kenjiArai | 0:0766e37fd3d6 | 212 | break; |
kenjiArai | 0:0766e37fd3d6 | 213 | } |
kenjiArai | 0:0766e37fd3d6 | 214 | put_rn(); |
kenjiArai | 0:0766e37fd3d6 | 215 | } |
kenjiArai | 0:0766e37fd3d6 | 216 | |
kenjiArai | 0:0766e37fd3d6 | 217 | int main() { |
kenjiArai | 0:0766e37fd3d6 | 218 | char c; |
kenjiArai | 0:0766e37fd3d6 | 219 | |
kenjiArai | 0:0766e37fd3d6 | 220 | put_rn(); |
kenjiArai | 0:0766e37fd3d6 | 221 | put_rn(); |
kenjiArai | 0:0766e37fd3d6 | 222 | PRINTF("Are you ready? (Hit any key)"); |
kenjiArai | 0:0766e37fd3d6 | 223 | put_rn(); |
kenjiArai | 0:0766e37fd3d6 | 224 | c = GETC(); |
kenjiArai | 0:0766e37fd3d6 | 225 | PUTC(c); |
kenjiArai | 0:0766e37fd3d6 | 226 | cpu_freq(); |
kenjiArai | 0:0766e37fd3d6 | 227 | while(1) { |
kenjiArai | 0:0766e37fd3d6 | 228 | myled = 1; // LED is ON |
kenjiArai | 0:0766e37fd3d6 | 229 | wait(0.2); // 200 ms |
kenjiArai | 0:0766e37fd3d6 | 230 | myled = 0; // LED is OFF |
kenjiArai | 0:0766e37fd3d6 | 231 | wait(1.0); // 1 sec |
kenjiArai | 0:0766e37fd3d6 | 232 | } |
kenjiArai | 0:0766e37fd3d6 | 233 | } |