change clock source in operation

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Is this possible? We are hoping to change between PLL1 which is ECO trimmed to Direct_Sel or something else that can be sourced from IMO and USB trimmed. The reason why is that when power is disconnected from the host Laptop, the communication timing appears to change a little bit, and when the clock is trimmed by the host it seems to handle it better. I am hoping to change the clock source whenever VBus is detected but return to normal when it is disconnected to keep good timing on a CAN bus also connected to the micro.

0 Likes
1 Solution
Anonymous
Not applicable

Just went and read the function description. It sounds like that function modifies the IMO clock trimming, is that right? I need to swap between IMO and PLL1 for the HFCLk, luckily though I scrolled down just a little bit after reading that function you suggested and found another function that I think does what I want to do:

void CySysClkWriteHfclkDirect(uint32 clkSelect)

* Selects the direct source for the HFCLK.

* \param clkSelect One of the available HFCLK direct sources.

* CY_SYS_CLK_HFCLK_IMO     IMO.

* CY_SYS_CLK_HFCLK_EXTCLK  External clock pin.

* CY_SYS_CLK_HFCLK_ECO     External crystal oscillator. Applicable for

*                          PSoC 4100 BLE / PSoC 4200 BLE / PSoC 4200L.

* CY_SYS_CLK_HFCLK_PLL0    PLL#0. Applicable for PSoC 4200L.

* CY_SYS_CLK_HFCLK_PLL1    PLL#1. Applicable for PSoC 4200L.

View solution in original post

0 Likes
2 Replies
himam_31
Employee
Employee
50 likes received 25 likes received 10 likes received

Hello,

You can detect the USB connection from the VBUS detection. It is possible to disable the USB lock using firmware. CySysClkImoDisableUsbLock() disables USB lock.

Thanks,

Hima

Anonymous
Not applicable

Just went and read the function description. It sounds like that function modifies the IMO clock trimming, is that right? I need to swap between IMO and PLL1 for the HFCLk, luckily though I scrolled down just a little bit after reading that function you suggested and found another function that I think does what I want to do:

void CySysClkWriteHfclkDirect(uint32 clkSelect)

* Selects the direct source for the HFCLK.

* \param clkSelect One of the available HFCLK direct sources.

* CY_SYS_CLK_HFCLK_IMO     IMO.

* CY_SYS_CLK_HFCLK_EXTCLK  External clock pin.

* CY_SYS_CLK_HFCLK_ECO     External crystal oscillator. Applicable for

*                          PSoC 4100 BLE / PSoC 4200 BLE / PSoC 4200L.

* CY_SYS_CLK_HFCLK_PLL0    PLL#0. Applicable for PSoC 4200L.

* CY_SYS_CLK_HFCLK_PLL1    PLL#1. Applicable for PSoC 4200L.

0 Likes