Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

USB Clocking #1

Open
alexpa940 opened this issue Jun 25, 2022 · 2 comments
Open

USB Clocking #1

alexpa940 opened this issue Jun 25, 2022 · 2 comments

Comments

@alexpa940
Copy link

Can USB be clocked from an external oscillator in STC8H8K64U?

@IOsetting
Copy link
Owner

USB peripheral share the same clock source with MCU, so the answer is yes if the MCU is clocked from an external OSC, but if you mean a separate clock source for USB peripheral, the answer is no.

The register USBCLK provides limited control on USB clock.

SFR(USBCLK,             0xDC);

@alexpa940
Copy link
Author

alexpa940 commented Jun 27, 2022

I used a 12 megahertz quartz. The microcontroller itself worked from it. But the USB didn't work with any of the USBCLK settings.

		SFRX_ON(); 
		XOSCCR = 0xCCU; //enable external xtal
		while((XOSCCR & 0x01U) == 0){}; //wait while xtal ready
		
		CLKDIV = 0x00U;//set divider 1
		CLKSEL = 0x01U;//select external xtal
		SFRX_OFF(); 
    //SYS_EnableOscillator48M();
    USB_SetClockPPL(0x1U);
    USB_SetClockSource(USB_ClockSource_12M);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants