Electronic – Increase Microcontroller frequency and Speed

clock-speedmicrocontroller

I am in process of upgrading the micro-controller of our project from Renesas M16C to RX63N. In our current M16C project we use 16HMz crystal. If in the new micro-controller Rx63N if I use the frequency to 196MHz using PLL, what are the points I need to consider specially in the code.

One thing I understand is the delay function used in the code may need to change according to our new instruction execution time.

Do I required to change or need focus on any other thing i.e. do I need to change anything in the serial communication between my new micro-controller and the external IC.

Do I need to change in my ADC logic? DO I need to change in my logic where I communicate to PC through RS232 chip?

Please guide me which area in my code, I need to give attention when I increase frequency and speed of the micro-controller.

Best Answer

A microcontroller isn't aware of a thing like time; it only knows clock ticks. So the controller's logic can't tell the difference between running at 16 MHz and 192 MHz: a clock tick is a clock tick, and it will do exactly the same in 10 clock ticks for both frequencies.

That means that when actual time is relevant it's up to you to make sure the number of clock ticks gets properly translated to time. Suppose you have a 1 ms timer for the 16 MHz controller. It will give you an interrupt every 16 000 clock ticks, that's once every ms. Run that same code on a 192 MHz controller and you'll still get the interrupt every 16 000 clock ticks, but now that will be 83 µs. So change the timer's value to 192 000. Do this for everything to which real time is relevant. If you don't the 9600 bps UART will run 12 times too fast, so set the prescaler to a 12 times higher value.

The ADC is a bit different. That one does know about time: the measurement capacitor will droop at the same rate whether you run at 16 MHz or at 192 MHz. Or at 1 Hz. While the controller will run (or rather: "stroll") happily at 1 Hz, for the ADC that's too slow. The datasheet will tell you the minimum frequency it needs.