Skip to content

Conversation

@Saatvik-Aggarwal
Copy link

I've added support for 6MHz clock.
I've tested it for accuracy with my CH552G.

Here is a loop function you can use to test:

void loop() {
  delay(1000);
  USBSerial_println(millis());
  
  delay(2000);
  USBSerial_println(millis());

  delay(4000);
  USBSerial_println(millis());

  delay(8000);
  USBSerial_println(millis());
  
  delay(16000);
  USBSerial_println(millis());
}

@DeqingSun
Copy link
Owner

DeqingSun commented Jun 5, 2023

Please do not include the formatting code into the PR or I can not see where you changed. At this moment you changed every line of the code.

Also please only cherry pick the necessary commits.

I know there are format issue in this repo and I'll get them fixed these days. You can do your part afterward.

@Saatvik-Aggarwal
Copy link
Author

@DeqingSun I've undone the formatting changes. Let me know what you think. I had to add a "hacky" part for the delay() function, I'm not sure why the approach that all the other frequencies used does not work. Nevertheless, the code is working and I am now running my CH552G at 6Mhz, saving a few milliamps of current.

@DeqingSun
Copy link
Owner

DeqingSun commented Jun 6, 2023

Thanks, this looks nice. But a clock change will require intensive testing with logic analyzer. I will test the timing then I will merge it.

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

Successfully merging this pull request may close these issues.

2 participants