File tree Expand file tree Collapse file tree 2 files changed +5
-37
lines changed Expand file tree Collapse file tree 2 files changed +5
-37
lines changed Original file line number Diff line number Diff line change @@ -162,28 +162,10 @@ void printTime()
162
162
int main (void )
163
163
{
164
164
int rtcTrim ;
165
- volatile int i ;
166
-
167
- /* Delay to prevent bricks */
168
- for (i = 0 ; i < 0xFFFFFF ; i ++ ) {}
169
-
170
- /* Set the system clock to the 32 MHz clock for the RTC trim */
171
- /* Enable 32 MHz clock if not already enabled */
172
- if (!(MXC_GCR -> clkctrl & MXC_F_GCR_CLKCTRL_ERFO_RDY )) {
173
- /* Power VREGO_D */
174
- MXC_SIMO -> vrego_d = (0x3c << MXC_F_SIMO_VREGO_D_VSETD_POS );
175
- while (!(MXC_SIMO -> buck_out_ready & MXC_F_SIMO_BUCK_OUT_READY_BUCKOUTRDYD )) {}
176
-
177
- /* Restore btleldoctrl setting */
178
- MXC_GCR -> btleldoctrl = 0x3055 ;
179
- while (!(MXC_SIMO -> buck_out_ready & MXC_F_SIMO_BUCK_OUT_READY_BUCKOUTRDYD )) {}
180
-
181
- /* Enable 32Mhz oscillator */
182
- MXC_GCR -> clkctrl |= MXC_F_GCR_CLKCTRL_ERFO_EN ;
183
- while (!(MXC_GCR -> clkctrl & MXC_F_GCR_CLKCTRL_ERFO_RDY )) {}
184
- }
165
+ MXC_Delay (MXC_DELAY_SEC (2 )); // Delay to give debugger a window to connect
185
166
186
167
/* Switch the system clock to the 32 MHz oscillator */
168
+ MXC_SYS_ClockSourceEnable (MXC_SYS_CLOCK_ERFO );
187
169
MXC_SYS_Clock_Select (MXC_SYS_CLOCK_ERFO );
188
170
MXC_SYS_SetClockDiv (MXC_SYS_CLOCK_DIV_1 );
189
171
SystemCoreClockUpdate ();
Original file line number Diff line number Diff line change @@ -125,24 +125,10 @@ void printTime()
125
125
int configureRTC ()
126
126
{
127
127
int rtcTrim ;
128
- volatile int i ;
128
+ MXC_Delay ( MXC_DELAY_SEC ( 2 )); // Delay to give debugger a window to connect
129
129
130
- for (i = 0 ; i < 0xFFFFFF ; i ++ ) {}
131
- // Prevent bricks
132
-
133
- if (!(MXC_GCR -> clkctrl &
134
- MXC_F_GCR_CLKCTRL_ERFO_RDY )) { // Enable 32Mhz clock if not already enabled
135
- MXC_SIMO -> vrego_d = (0x3c << MXC_F_SIMO_VREGO_D_VSETD_POS ); // Power VREGO_D
136
- while (!(MXC_SIMO -> buck_out_ready & MXC_F_SIMO_BUCK_OUT_READY_BUCKOUTRDYD )) {}
137
-
138
- MXC_GCR -> btleldoctrl = 0x3055 ; // Restore btleldoctrl setting
139
- while (!(MXC_SIMO -> buck_out_ready & MXC_F_SIMO_BUCK_OUT_READY_BUCKOUTRDYD )) {}
140
-
141
- MXC_GCR -> clkctrl |= MXC_F_GCR_CLKCTRL_ERFO_EN ; // Enable 32Mhz oscillator
142
- while (!(MXC_GCR -> clkctrl & MXC_F_GCR_CLKCTRL_ERFO_RDY )) {}
143
- }
144
-
145
- MXC_SYS_Clock_Select (MXC_SYS_CLOCK_ERFO ); // Set 32MHz clock as system clock
130
+ /* Switch the system clock to the 32 MHz oscillator */
131
+ MXC_SYS_ClockSourceEnable (MXC_SYS_CLOCK_ERFO );
146
132
MXC_SYS_SetClockDiv (MXC_SYS_CLOCK_DIV_1 );
147
133
SystemCoreClockUpdate ();
148
134
You can’t perform that action at this time.
0 commit comments