System clock driver support for hardware abstraction layer.
This driver manage all clock providers.
// init sysclock
sysclock_setClock(120000000); // set clock to 120MHz
uint32_t timer_freq = sysclock_periphFreq();int sysclock_setClock(uint32_t fosc);Sets the system clock of the CPU, the system clock may be different of CPU
uint32_t sysclock_periphFreq(SYSCLOCK_CLOCK busClock);Gets the actual frequency on a particular peripheral bus clock
int sysclock_setClockDiv(SYSCLOCK_CLOCK busClock, uint16_t div);Change the divisor of the busClock given as argument
int32_t sysclock_sourceFreq(SYSCLOCK_SOURCE source);Return the actual frequency of the clock source
int sysclock_setSourceFreq(SYSCLOCK_SOURCE source, uint32_t freq);Change a frequency of a source if it can be modified
SYSCLOCK_SOURCE sysclock_source();Return the actual clock source for system clock
int sysclock_switchSourceTo(SYSCLOCK_SOURCE source);Switch the source clock of sysclock to another one and wait for the change effective
- Works well on all dsPICEP
- Clarify API
Header file : sysclock.h
- dsPIC33EPxxxGS20X/50X/70X/80X : 7.37 +/- 0.047%
- dsPIC33EPxxxGM00X/10X : 7.3728 +/- 0.048%
- dsPIC33EPxxxGM30X/60X/70X : 7.3728 +/- 0.047%
- PIC24EP/dsPIC33EP GP/MC20X/50X : 7.37 +/- 0.047%
- PIC24EP/dsPIC33EP GP/MC/MU/GU80X : 7.37 +/- 0.375%
- dsPIC33FJxxxGS40X/60X : 7.37 +/- 0.0938%
- dsPIC33FJxxxGP/MC10X : 7.37 +/- 0.047%
- dsPIC33FJxxxGS00X/10X/20X : 7.37 +/- 0.375%
- dsPIC33FJxxxGP/MC : 7.37 +/- 0.375%
- PIC24F/FJ: 8 +/- 0.05%
- PIC24HJ: 7.37 +/- 0.375%