QT Py SAMD21 - core frequency

For Adafruit customers who seek help with microcontrollers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
tomhavel
 
Posts: 6
Joined: Sat Feb 26, 2022 3:11 am

QT Py SAMD21 - core frequency

Post by tomhavel »

Hello,

I have been recently playing with the QT PY SAMD21 and I have one question. While using the Arduino IDE, is there any way to change the core clock frequency? If I am not mistaken and my measurements are correct, it does not run on 48MHz out of the box. Thank you!

User avatar
mikeysklar
 
Posts: 14165
Joined: Mon Aug 01, 2016 8:10 pm

Re: QT Py SAMD21 - core frequency

Post by mikeysklar »

I've not seen a way to do it through Arduino, but forcetronics has a github repo and 20+ minute video explaining how to do it with C++.

https://blog.adafruit.com/2021/01/06/ow ... cetronics/

User avatar
westfw
 
Posts: 2010
Joined: Fri Apr 27, 2007 1:01 pm

Re: QT Py SAMD21 - core frequency

Post by westfw »

If I am not mistaken and my measurements are correct, it does not run on 48MHz out of the box.
What makes you think that it's not running at 48MHz?
The Arduino Build commands show:
Compiling sketch...
/Applications/Arduino-1.8.13.app/Contents/Java/portable/packages/adafruit/tools/arm-none-eabi-gcc/9-2019q4/bin/arm-none-eabi-g++ -mcpu=cortex-m0plus -mthumb -c -g -Os -Wall -Wextra -Wno-expansion-to-defined -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -MMD "-D__SKETCH_NAME__=\"\"\"SAMD_Explorer.ino\"\"\"" -DF_CPU=48000000L -DARDUINO=10813...

User avatar
adafruit2
 
Posts: 22187
Joined: Fri Mar 11, 2005 7:36 pm

Re: QT Py SAMD21 - core frequency

Post by adafruit2 »

if you're trying to speed it up, just FYI the SAMD21 does *not* do overclocking well

User avatar
tomhavel
 
Posts: 6
Joined: Sat Feb 26, 2022 3:11 am

Re: QT Py SAMD21 - core frequency

Post by tomhavel »

Thank you for your replies. My measurements must have been wrong. However, I'll have one more question (I hope it can relate to this)

I have been testing the speeds of the native USB port. I used very simple code:

Code: Select all

unsigned long timee;
void setup() {
  Serial.begin(1000);
  
}
void loop() {
  timee=micros();
  Serial.write('C');
  Serial.println(micros()-timee);
}
The results are however quite surprising with one byte transfer taking as long as 50 microseconds. Is this normal or am I missing something major?

Thank you

User avatar
mikeysklar
 
Posts: 14165
Joined: Mon Aug 01, 2016 8:10 pm

Re: QT Py SAMD21 - core frequency

Post by mikeysklar »

Please open a new forum thread with the USB serial question. It is unrelated to the topic and will be helpful for others if properly labeled. Also include full code so we can see your serial baudrate settings.

Locked
Please be positive and constructive with your questions and comments.

Return to “Microcontrollers”