I've attached a project targeted at exploring how to adjust the PSoC5 IMO and ILO clocks by modifying the trim value at run-time. The original goal with to provide a replacement for the Cypress component ILO_trim and the now depreciated (retired) IMO_trim.
It was intended to be a learning exercise and boy it WAS! Adjusting the IMO clock more than just a few trim values can result in CPU misclocking and UART baudrate clock errors without the proper precautions. This exercise helped me to appreciate all the care Cypress put in defining the clock control registers.
The project allows the user to select the base internal IMO frequency and it allows the user to adjust the IMO clocks in real-time from 1MHz to 80MHz.
The project will also allow the user to trim the ILO clock to a "more" accurate 1KHz.
- This project was targeted for the inexpensive CY8CKIT-059 board. It is possible that these projects can be converted to run on other boards that build under PSoC Creator.
- To successfully run this project, you must solder a standard low-cost watch crystal across pins P15 and P15. This is the accuracy reference fot he internal RC IMO and ILO clocks.
- PsoC Creator 4.2 or higher.
- To access the needed String_Funcs Component and MenuCmds Component for the build. Refer to this link to access these component libraries: Terminal Support Component Library
I hope this aids in your understanding of the low-level control of the IMO and ILO clocks and the related subsystems.
"Engineering is an Art. The Art of Compromise."
Thanks for the effort you have taken in developing the project and sharing it with the community. We appreciate this.