Teensy 4.0 Clock speed influences delay and SPI

Probably easier if I just post it here. Its pretty just an extract of code taken from the 1060 SDK. So its a mess if you dig into it.

@mjs513, Do you have a working version of clocksT4.zip?it does not compile with 1.50 (a bunch of double definitions and more)
 
This works here with TD 1.50 and IDE 1.8.11

Not sure what version and errors you had - there were some in mine - just noise to remove - but it works here now.

Code:
System Clock: 600000000 [600
IPG Clock: 150000000 [150
Semc Clock: 200000000 [200
RTC Clock: 32768 [0
USB1pll Clock: 480000000 [480
Peripheral Clock: 24000000 [24
Osc Clock: 24000000 [24
Arm Clock: 1200000000 [1200
Usb1PllPfd0 Clock: 720000000 [720
Usb1PllPfd1 Clock: 664615368 [664
Usb1PllPfd2 Clock: 508235292 [508
Usb1PllPfd3 Clock: 454736826 [454
Usb2Pll Clock: 24000000 [24
SysPll Clock: 528000000 [528
SysPllPfd0 Clock: 351999990 [351
SysPllPfd1 Clock: 594000000 [594
SysPllPfd2 Clock: 396000000 [396
SysPllPfd3 Clock: 297000000 [297
EnetPll0 Clock: 0 [0
EnetPll1 Clock: 0 [0
AudioPll Clock: 786480000 [786
VideoPll Clock: 0 [0
 
Oh my.. looks like this is the first time I see GCC 9 makes problems.
I switched back to gcc 5 and everything works.

Thank you!

Errors with GCC9:
Code:
Arduino: 1.8.11 (Windows 10), TD: 1.50, Board: "Teensy 4.0, Serial, 600 MHz, Faster, US English"

C:\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Arduino\hardware -hardware C:\Users\Frank\AppData\Local\Arduino15\packages -hardware C:\Users\Frank\Documents\Arduino\hardware -tools C:\Arduino\tools-builder -tools C:\Arduino\hardware\tools\avr -tools C:\Users\Frank\AppData\Local\Arduino15\packages -built-in-libraries C:\Arduino\libraries -libraries C:\Users\Frank\Documents\Arduino\libraries -fqbn=teensy:avr:teensy40:usb=serial,speed=600,opt=o2std,keys=en-us -ide-version=10811 -build-path c:\temp\arduino_build_100906 -warnings=all -build-cache c:\temp\arduino_cache_515481 -verbose C:\Users\Frank\Documents\Arduino\_____T4\ClocksT4\ClocksT4.ino
C:\Arduino\arduino-builder -compile -logger=machine -hardware C:\Arduino\hardware -hardware C:\Users\Frank\AppData\Local\Arduino15\packages -hardware C:\Users\Frank\Documents\Arduino\hardware -tools C:\Arduino\tools-builder -tools C:\Arduino\hardware\tools\avr -tools C:\Users\Frank\AppData\Local\Arduino15\packages -built-in-libraries C:\Arduino\libraries -libraries C:\Users\Frank\Documents\Arduino\libraries -fqbn=teensy:avr:teensy40:usb=serial,speed=600,opt=o2std,keys=en-us -ide-version=10811 -build-path c:\temp\arduino_build_100906 -warnings=all -build-cache c:\temp\arduino_cache_515481 -verbose C:\Users\Frank\Documents\Arduino\_____T4\ClocksT4\ClocksT4.ino
Using board 'teensy40' from platform in folder: C:\Arduino\hardware\teensy\avr
Using core 'teensy4' from platform in folder: C:\Arduino\hardware\teensy\avr
Detecting libraries used...
"C:\\Arduino\\hardware\\teensy/../tools/arm9/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=150 -DARDUINO=10811 -DARDUINO_TEENSY40 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-IC:\\Arduino\\hardware\\teensy\\avr\\cores\\teensy4" "c:\\temp\\arduino_build_100906\\sketch\\ClocksT4.ino.cpp" -o nul
"C:\\Arduino\\hardware\\teensy/../tools/arm9/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=150 -DARDUINO=10811 -DARDUINO_TEENSY40 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-IC:\\Arduino\\hardware\\teensy\\avr\\cores\\teensy4" "c:\\temp\\arduino_build_100906\\sketch\\clock_functions.cpp" -o nul
Generating function prototypes...
"C:\\Arduino\\hardware\\teensy/../tools/arm9/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=150 -DARDUINO=10811 -DARDUINO_TEENSY40 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-IC:\\Arduino\\hardware\\teensy\\avr\\cores\\teensy4" "c:\\temp\\arduino_build_100906\\sketch\\ClocksT4.ino.cpp" -o "c:\\temp\\arduino_build_100906\\preproc\\ctags_target_for_gcc_minus_e.cpp"
"C:\\Arduino\\tools-builder\\ctags\\5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "c:\\temp\\arduino_build_100906\\preproc\\ctags_target_for_gcc_minus_e.cpp"
Sketch wird kompiliert...
"C:\\Arduino\\hardware\\teensy/../tools/precompile_helper" "C:\\Arduino\\hardware\\teensy\\avr/cores/teensy4" "c:\\temp\\arduino_build_100906" "C:\\Arduino\\hardware\\teensy/../tools/arm9/bin/arm-none-eabi-g++" -x c++-header -O2 -fgcse-after-reload -finline-functions -falign-loops -g -Wall -ffunction-sections -fdata-sections -nostdlib -MMD -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=150 -DARDUINO=10811 -DARDUINO_TEENSY40 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-IC:\\Arduino\\hardware\\teensy\\avr/cores/teensy4" "c:\\temp\\arduino_build_100906/pch/Arduino.h" -o "c:\\temp\\arduino_build_100906/pch/Arduino.h.gch"
"C:\\Arduino\\hardware\\teensy/../tools/arm9/bin/arm-none-eabi-g++" -c -O2 -fgcse-after-reload -finline-functions -falign-loops -g -Wall -ffunction-sections -fdata-sections -nostdlib -MMD -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=150 -DARDUINO=10811 -DARDUINO_TEENSY40 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-Ic:\\temp\\arduino_build_100906/pch" "-IC:\\Arduino\\hardware\\teensy\\avr\\cores\\teensy4" "c:\\temp\\arduino_build_100906\\sketch\\clock_functions.cpp" -o "c:\\temp\\arduino_build_100906\\sketch\\clock_functions.cpp.o"
"C:\\Arduino\\hardware\\teensy/../tools/arm9/bin/arm-none-eabi-g++" -c -O2 -fgcse-after-reload -finline-functions -falign-loops -g -Wall -ffunction-sections -fdata-sections -nostdlib -MMD -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=150 -DARDUINO=10811 -DARDUINO_TEENSY40 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-Ic:\\temp\\arduino_build_100906/pch" "-IC:\\Arduino\\hardware\\teensy\\avr\\cores\\teensy4" "c:\\temp\\arduino_build_100906\\sketch\\ClocksT4.ino.cpp" -o "c:\\temp\\arduino_build_100906\\sketch\\ClocksT4.ino.cpp.o"
In file included from C:\Users\Frank\Documents\Arduino\_____T4\ClocksT4\ClocksT4.ino:8:
c:\temp\arduino_build_100906\sketch\clock_functions.h:62: warning: "CCM_ANALOG_PLL_AUDIO_POST_DIV_SELECT" redefined
   62 | #define CCM_ANALOG_PLL_AUDIO_POST_DIV_SELECT(x)  (((uint32_t)(((uint32_t)(x)) << CCM_ANALOG_PLL_AUDIO_POST_DIV_SELECT_SHIFT)) & CCM_ANALOG_PLL_AUDIO_POST_DIV_SELECT_MASK)
      | 
In file included from C:\Arduino\hardware\teensy\avr\cores\teensy4/core_pins.h:32,
                 from C:\Arduino\hardware\teensy\avr\cores\teensy4/wiring.h:39,
                 from C:\Arduino\hardware\teensy\avr\cores\teensy4/WProgram.h:45,
                 from c:\temp\arduino_build_100906\pch\Arduino.h:6:
C:\Arduino\hardware\teensy\avr\cores\teensy4/imxrt.h:1570: note: this is the location of the previous definition
 1570 | #define CCM_ANALOG_PLL_AUDIO_POST_DIV_SELECT(n) ((uint32_t)(((n) & 0x03) <<19))
      | 
In file included from C:\Users\Frank\Documents\Arduino\_____T4\ClocksT4\ClocksT4.ino:8:
c:\temp\arduino_build_100906\sketch\clock_functions.h:64: warning: "CCM_ANALOG_MISC2_AUDIO_DIV_MSB" redefined
   64 | #define CCM_ANALOG_MISC2_AUDIO_DIV_MSB(x)        (((uint32_t)(((uint32_t)(x)) << CCM_ANALOG_MISC2_AUDIO_DIV_MSB_SHIFT)) & CCM_ANALOG_MISC2_AUDIO_DIV_MSB_MASK)
      | 
In file included from C:\Arduino\hardware\teensy\avr\cores\teensy4/core_pins.h:32,
                 from C:\Arduino\hardware\teensy\avr\cores\teensy4/wiring.h:39,
                 from C:\Arduino\hardware\teensy\avr\cores\teensy4/WProgram.h:45,
                 from c:\temp\arduino_build_100906\pch\Arduino.h:6:
C:\Arduino\hardware\teensy\avr\cores\teensy4/imxrt.h:1620: note: this is the location of the previous definition
 1620 | #define CCM_ANALOG_MISC2_AUDIO_DIV_MSB  ((uint32_t)(1<<23))
      | 
In file included from C:\Users\Frank\Documents\Arduino\_____T4\ClocksT4\ClocksT4.ino:8:
c:\temp\arduino_build_100906\sketch\clock_functions.h:65: warning: "CCM_ANALOG_MISC2_AUDIO_DIV_LSB" redefined
   65 | #define CCM_ANALOG_MISC2_AUDIO_DIV_LSB(x)        (((uint32_t)(((uint32_t)(x)) << CCM_ANALOG_MISC2_AUDIO_DIV_LSB_SHIFT)) & CCM_ANALOG_MISC2_AUDIO_DIV_LSB_MASK)
      | 
In file included from C:\Arduino\hardware\teensy\avr\cores\teensy4/core_pins.h:32,
                 from C:\Arduino\hardware\teensy\avr\cores\teensy4/wiring.h:39,
                 from C:\Arduino\hardware\teensy\avr\cores\teensy4/WProgram.h:45,
                 from c:\temp\arduino_build_100906\pch\Arduino.h:6:
C:\Arduino\hardware\teensy\avr\cores\teensy4/imxrt.h:1626: note: this is the location of the previous definition
 1626 | #define CCM_ANALOG_MISC2_AUDIO_DIV_LSB  ((uint32_t)(1<<15))
      | 
In file included from C:\Users\Frank\Documents\Arduino\_____T4\ClocksT4\ClocksT4.ino:8:
c:\temp\arduino_build_100906\sketch\clock_functions.h:67: warning: "CCM_ANALOG_PLL_VIDEO_POST_DIV_SELECT" redefined
   67 | #define CCM_ANALOG_PLL_VIDEO_POST_DIV_SELECT(x)  (((uint32_t)(((uint32_t)(x)) << CCM_ANALOG_PLL_VIDEO_POST_DIV_SELECT_SHIFT)) & CCM_ANALOG_PLL_VIDEO_POST_DIV_SELECT_MASK)
      | 
In file included from C:\Arduino\hardware\teensy\avr\cores\teensy4/core_pins.h:32,
                 from C:\Arduino\hardware\teensy\avr\cores\teensy4/wiring.h:39,
                 from C:\Arduino\hardware\teensy\avr\cores\teensy4/WProgram.h:45,
                 from c:\temp\arduino_build_100906\pch\Arduino.h:6:
C:\Arduino\hardware\teensy\avr\cores\teensy4/imxrt.h:1577: note: this is the location of the previous definition
 1577 | #define CCM_ANALOG_PLL_VIDEO_POST_DIV_SELECT(n) ((uint32_t)(((n) & 0x03) << 19))
      | 
In file included from C:\Users\Frank\Documents\Arduino\_____T4\ClocksT4\ClocksT4.ino:8:
c:\temp\arduino_build_100906\sketch\clock_functions.h:68: warning: "CCM_ANALOG_MISC2_VIDEO_DIV" redefined
   68 | #define CCM_ANALOG_MISC2_VIDEO_DIV(x)            (((uint32_t)(((uint32_t)(x)) << CCM_ANALOG_MISC2_VIDEO_DIV_SHIFT)) & CCM_ANALOG_MISC2_VIDEO_DIV_MASK)
      | 
In file included from C:\Arduino\hardware\teensy\avr\cores\teensy4/core_pins.h:32,
                 from C:\Arduino\hardware\teensy\avr\cores\teensy4/wiring.h:39,
                 from C:\Arduino\hardware\teensy\avr\cores\teensy4/WProgram.h:45,
                 from c:\temp\arduino_build_100906\pch\Arduino.h:6:
C:\Arduino\hardware\teensy\avr\cores\teensy4/imxrt.h:1615: note: this is the location of the previous definition
 1615 | #define CCM_ANALOG_MISC2_VIDEO_DIV(n)  ((uint32_t)(((n) & 0x03) << 30))
      | 
In file included from C:\Users\Frank\Documents\Arduino\_____T4\ClocksT4\ClocksT4.ino:8:
c:\temp\arduino_build_100906\sketch\clock_functions.h:95: warning: "CCM_ANALOG_PLL_VIDEO_DIV_SELECT" redefined
   95 | #define CCM_ANALOG_PLL_VIDEO_DIV_SELECT(x)       (((uint32_t)(((uint32_t)(x)) << CCM_ANALOG_PLL_VIDEO_DIV_SELECT_SHIFT)) & CCM_ANALOG_PLL_VIDEO_DIV_SELECT_MASK)
      | 
In file included from C:\Arduino\hardware\teensy\avr\cores\teensy4/core_pins.h:32,
                 from C:\Arduino\hardware\teensy\avr\cores\teensy4/wiring.h:39,
                 from C:\Arduino\hardware\teensy\avr\cores\teensy4/WProgram.h:45,
                 from c:\temp\arduino_build_100906\pch\Arduino.h:6:
C:\Arduino\hardware\teensy\avr\cores\teensy4/imxrt.h:1582: note: this is the location of the previous definition
 1582 | #define CCM_ANALOG_PLL_VIDEO_DIV_SELECT(n) ((uint32_t)(((n) & 0x7F) << 0))
      | 
In file included from C:\Users\Frank\Documents\Arduino\_____T4\ClocksT4\ClocksT4.ino:8:
c:\temp\arduino_build_100906\sketch\clock_functions.h:104: warning: "CCM_ANALOG_PLL_ENET_DIV_SELECT" redefined
  104 | #define CCM_ANALOG_PLL_ENET_DIV_SELECT(x)        (((uint32_t)(((uint32_t)(x)) << CCM_ANALOG_PLL_ENET_DIV_SELECT_SHIFT)) & CCM_ANALOG_PLL_ENET_DIV_SELECT_MASK)
      | 
In file included from C:\Arduino\hardware\teensy\avr\cores\teensy4/core_pins.h:32,
                 from C:\Arduino\hardware\teensy\avr\cores\teensy4/wiring.h:39,
                 from C:\Arduino\hardware\teensy\avr\cores\teensy4/WProgram.h:45,
                 from c:\temp\arduino_build_100906\pch\Arduino.h:6:
C:\Arduino\hardware\teensy\avr\cores\teensy4/imxrt.h:1591: note: this is the location of the previous definition
 1591 | #define CCM_ANALOG_PLL_ENET_DIV_SELECT(n) ((uint32_t)(((n) & 0x03) << 0))
      | 
In file included from C:\Users\Frank\Documents\Arduino\_____T4\ClocksT4\ClocksT4.ino:9:
c:\temp\arduino_build_100906\sketch\Audio_pll.h:22: warning: "CCM_ANALOG_PLL_AUDIO_BYPASS_CLK_SRC" redefined
   22 | #define CCM_ANALOG_PLL_AUDIO_BYPASS_CLK_SRC(x)   (((uint32_t)(((uint32_t)(x)) << CCM_ANALOG_PLL_AUDIO_BYPASS_CLK_SRC_SHIFT)) & CCM_ANALOG_PLL_AUDIO_BYPASS_CLK_SRC_MASK)
      | 
In file included from C:\Arduino\hardware\teensy\avr\cores\teensy4/core_pins.h:32,
                 from C:\Arduino\hardware\teensy\avr\cores\teensy4/wiring.h:39,
                 from C:\Arduino\hardware\teensy\avr\cores\teensy4/WProgram.h:45,
                 from c:\temp\arduino_build_100906\pch\Arduino.h:6:
C:\Arduino\hardware\teensy\avr\cores\teensy4/imxrt.h:1572: note: this is the location of the previous definition
 1572 | #define CCM_ANALOG_PLL_AUDIO_BYPASS_CLK_SRC(n) ((uint32_t)(((n) & 0x03) <<14))
      | 
In file included from C:\Users\Frank\Documents\Arduino\_____T4\ClocksT4\ClocksT4.ino:9:
c:\temp\arduino_build_100906\sketch\Audio_pll.h:26: warning: "CCM_ANALOG_PLL_AUDIO_DIV_SELECT" redefined
   26 | #define CCM_ANALOG_PLL_AUDIO_DIV_SELECT(x)       (((uint32_t)(((uint32_t)(x)) << CCM_ANALOG_PLL_AUDIO_DIV_SELECT_SHIFT)) & CCM_ANALOG_PLL_AUDIO_DIV_SELECT_MASK)
      | 
In file included from C:\Arduino\hardware\teensy\avr\cores\teensy4/core_pins.h:32,
                 from C:\Arduino\hardware\teensy\avr\cores\teensy4/wiring.h:39,
                 from C:\Arduino\hardware\teensy\avr\cores\teensy4/WProgram.h:45,
                 from c:\temp\arduino_build_100906\pch\Arduino.h:6:
C:\Arduino\hardware\teensy\avr\cores\teensy4/imxrt.h:1575: note: this is the location of the previous definition
 1575 | #define CCM_ANALOG_PLL_AUDIO_DIV_SELECT(n) ((uint32_t)((n) & ((1<<6)-1)))
      | 
In file included from C:\Users\Frank\Documents\Arduino\_____T4\ClocksT4\ClocksT4.ino:8:
clock_functions.h:284: error: dereferencing a null pointer in '*0'
  284 | #define CCM_ANALOG_TUPLE(reg, shift)  ((((uint32_t)(&((CCM_ANALOG_Type *)0U)->reg) & 0xFFFU) << 16U) | (shift))
      |                                                                                                               ^
c:\temp\arduino_build_100906\sketch\clock_functions.h:287:21: note: in expansion of macro 'CCM_ANALOG_TUPLE'
  287 |     kCLOCK_PllArm = CCM_ANALOG_TUPLE(PLL_ARM, CCM_ANALOG_PLL_ARM_ENABLE_SHIFT),       /*!< PLL ARM */
      |                     ^~~~~~~~~~~~~~~~
clock_functions.h:284: error: enumerator value for 'kCLOCK_PllArm' is not an integer constant
  284 | #define CCM_ANALOG_TUPLE(reg, shift)  ((((uint32_t)(&((CCM_ANALOG_Type *)0U)->reg) & 0xFFFU) << 16U) | (shift))
      |                                                                                                               ^
c:\temp\arduino_build_100906\sketch\clock_functions.h:287:21: note: in expansion of macro 'CCM_ANALOG_TUPLE'
  287 |     kCLOCK_PllArm = CCM_ANALOG_TUPLE(PLL_ARM, CCM_ANALOG_PLL_ARM_ENABLE_SHIFT),       /*!< PLL ARM */
      |                     ^~~~~~~~~~~~~~~~
clock_functions.h:284: error: dereferencing a null pointer in '*0'
  284 | #define CCM_ANALOG_TUPLE(reg, shift)  ((((uint32_t)(&((CCM_ANALOG_Type *)0U)->reg) & 0xFFFU) << 16U) | (shift))
      |                                                                                                               ^
c:\temp\arduino_build_100906\sketch\clock_functions.h:288:21: note: in expansion of macro 'CCM_ANALOG_TUPLE'
  288 |     kCLOCK_PllSys = CCM_ANALOG_TUPLE(PLL_SYS, CCM_ANALOG_PLL_SYS_ENABLE_SHIFT),       /*!< PLL SYS */
      |                     ^~~~~~~~~~~~~~~~
clock_functions.h:284: error: enumerator value for 'kCLOCK_PllSys' is not an integer constant
  284 | #define CCM_ANALOG_TUPLE(reg, shift)  ((((uint32_t)(&((CCM_ANALOG_Type *)0U)->reg) & 0xFFFU) << 16U) | (shift))
      |                                                                                                               ^
c:\temp\arduino_build_100906\sketch\clock_functions.h:288:21: note: in expansion of macro 'CCM_ANALOG_TUPLE'
  288 |     kCLOCK_PllSys = CCM_ANALOG_TUPLE(PLL_SYS, CCM_ANALOG_PLL_SYS_ENABLE_SHIFT),       /*!< PLL SYS */
      |                     ^~~~~~~~~~~~~~~~
clock_functions.h:284: error: dereferencing a null pointer in '*0'
  284 | #define CCM_ANALOG_TUPLE(reg, shift)  ((((uint32_t)(&((CCM_ANALOG_Type *)0U)->reg) & 0xFFFU) << 16U) | (shift))
      |                                                                                                               ^
c:\temp\arduino_build_100906\sketch\clock_functions.h:289:22: note: in expansion of macro 'CCM_ANALOG_TUPLE'
  289 |     kCLOCK_PllUsb1 = CCM_ANALOG_TUPLE(PLL_USB1, CCM_ANALOG_PLL_USB1_ENABLE_SHIFT),    /*!< PLL USB1 */
      |                      ^~~~~~~~~~~~~~~~
clock_functions.h:284: error: enumerator value for 'kCLOCK_PllUsb1' is not an integer constant
  284 | #define CCM_ANALOG_TUPLE(reg, shift)  ((((uint32_t)(&((CCM_ANALOG_Type *)0U)->reg) & 0xFFFU) << 16U) | (shift))
      |                                                                                                               ^
c:\temp\arduino_build_100906\sketch\clock_functions.h:289:22: note: in expansion of macro 'CCM_ANALOG_TUPLE'
  289 |     kCLOCK_PllUsb1 = CCM_ANALOG_TUPLE(PLL_USB1, CCM_ANALOG_PLL_USB1_ENABLE_SHIFT),    /*!< PLL USB1 */
      |                      ^~~~~~~~~~~~~~~~
clock_functions.h:284: error: dereferencing a null pointer in '*0'
  284 | #define CCM_ANALOG_TUPLE(reg, shift)  ((((uint32_t)(&((CCM_ANALOG_Type *)0U)->reg) & 0xFFFU) << 16U) | (shift))
      |                                                                                                               ^
c:\temp\arduino_build_100906\sketch\clock_functions.h:290:23: note: in expansion of macro 'CCM_ANALOG_TUPLE'
  290 |     kCLOCK_PllAudio = CCM_ANALOG_TUPLE(PLL_AUDIO, CCM_ANALOG_PLL_AUDIO_ENABLE_SHIFT), /*!< PLL Audio */
      |                       ^~~~~~~~~~~~~~~~
clock_functions.h:284: error: enumerator value for 'kCLOCK_PllAudio' is not an integer constant
  284 | #define CCM_ANALOG_TUPLE(reg, shift)  ((((uint32_t)(&((CCM_ANALOG_Type *)0U)->reg) & 0xFFFU) << 16U) | (shift))
      |                                                                                                               ^
c:\temp\arduino_build_100906\sketch\clock_functions.h:290:23: note: in expansion of macro 'CCM_ANALOG_TUPLE'
  290 |     kCLOCK_PllAudio = CCM_ANALOG_TUPLE(PLL_AUDIO, CCM_ANALOG_PLL_AUDIO_ENABLE_SHIFT), /*!< PLL Audio */
      |                       ^~~~~~~~~~~~~~~~
clock_functions.h:284: error: dereferencing a null pointer in '*0'
  284 | #define CCM_ANALOG_TUPLE(reg, shift)  ((((uint32_t)(&((CCM_ANALOG_Type *)0U)->reg) & 0xFFFU) << 16U) | (shift))
      |                                                                                                               ^
c:\temp\arduino_build_100906\sketch\clock_functions.h:291:23: note: in expansion of macro 'CCM_ANALOG_TUPLE'
  291 |     kCLOCK_PllVideo = CCM_ANALOG_TUPLE(PLL_VIDEO, CCM_ANALOG_PLL_VIDEO_ENABLE_SHIFT), /*!< PLL Video */
      |                       ^~~~~~~~~~~~~~~~
clock_functions.h:284: error: enumerator value for 'kCLOCK_PllVideo' is not an integer constant
  284 | #define CCM_ANALOG_TUPLE(reg, shift)  ((((uint32_t)(&((CCM_ANALOG_Type *)0U)->reg) & 0xFFFU) << 16U) | (shift))
      |                                                                                                               ^
c:\temp\arduino_build_100906\sketch\clock_functions.h:291:23: note: in expansion of macro 'CCM_ANALOG_TUPLE'
  291 |     kCLOCK_PllVideo = CCM_ANALOG_TUPLE(PLL_VIDEO, CCM_ANALOG_PLL_VIDEO_ENABLE_SHIFT), /*!< PLL Video */
      |                       ^~~~~~~~~~~~~~~~
clock_functions.h:284: error: dereferencing a null pointer in '*0'
  284 | #define CCM_ANALOG_TUPLE(reg, shift)  ((((uint32_t)(&((CCM_ANALOG_Type *)0U)->reg) & 0xFFFU) << 16U) | (shift))
      |                                                                                                               ^
c:\temp\arduino_build_100906\sketch\clock_functions.h:292:22: note: in expansion of macro 'CCM_ANALOG_TUPLE'
  292 |     kCLOCK_PllEnet = CCM_ANALOG_TUPLE(PLL_ENET, CCM_ANALOG_PLL_ENET_ENABLE_SHIFT), /*!< PLL Enet0 */
      |                      ^~~~~~~~~~~~~~~~
clock_functions.h:284: error: enumerator value for 'kCLOCK_PllEnet' is not an integer constant
  284 | #define CCM_ANALOG_TUPLE(reg, shift)  ((((uint32_t)(&((CCM_ANALOG_Type *)0U)->reg) & 0xFFFU) << 16U) | (shift))
      |                                                                                                               ^
c:\temp\arduino_build_100906\sketch\clock_functions.h:292:22: note: in expansion of macro 'CCM_ANALOG_TUPLE'
  292 |     kCLOCK_PllEnet = CCM_ANALOG_TUPLE(PLL_ENET, CCM_ANALOG_PLL_ENET_ENABLE_SHIFT), /*!< PLL Enet0 */
      |                      ^~~~~~~~~~~~~~~~
clock_functions.h:284: error: dereferencing a null pointer in '*0'
  284 | #define CCM_ANALOG_TUPLE(reg, shift)  ((((uint32_t)(&((CCM_ANALOG_Type *)0U)->reg) & 0xFFFU) << 16U) | (shift))
      |                                                                                                               ^
c:\temp\arduino_build_100906\sketch\clock_functions.h:293:25: note: in expansion of macro 'CCM_ANALOG_TUPLE'
  293 |     kCLOCK_PllEnet25M = CCM_ANALOG_TUPLE(PLL_ENET, CCM_ANALOG_PLL_ENET_ENET_25M_REF_EN_SHIFT), /*!< PLL Enet1 */
      |                         ^~~~~~~~~~~~~~~~
clock_functions.h:284: error: enumerator value for 'kCLOCK_PllEnet25M' is not an integer constant
  284 | #define CCM_ANALOG_TUPLE(reg, shift)  ((((uint32_t)(&((CCM_ANALOG_Type *)0U)->reg) & 0xFFFU) << 16U) | (shift))
      |                                                                                                               ^
c:\temp\arduino_build_100906\sketch\clock_functions.h:293:25: note: in expansion of macro 'CCM_ANALOG_TUPLE'
  293 |     kCLOCK_PllEnet25M = CCM_ANALOG_TUPLE(PLL_ENET, CCM_ANALOG_PLL_ENET_ENET_25M_REF_EN_SHIFT), /*!< PLL Enet1 */
      |                         ^~~~~~~~~~~~~~~~
clock_functions.h:284: error: dereferencing a null pointer in '*0'
  284 | #define CCM_ANALOG_TUPLE(reg, shift)  ((((uint32_t)(&((CCM_ANALOG_Type *)0U)->reg) & 0xFFFU) << 16U) | (shift))
      |                                                                                                               ^
c:\temp\arduino_build_100906\sketch\clock_functions.h:294:22: note: in expansion of macro 'CCM_ANALOG_TUPLE'
  294 |     kCLOCK_PllUsb2 = CCM_ANALOG_TUPLE(PLL_USB2, CCM_ANALOG_PLL_USB2_ENABLE_SHIFT), /*!< PLL USB2 */
      |                      ^~~~~~~~~~~~~~~~
clock_functions.h:284: error: enumerator value for 'kCLOCK_PllUsb2' is not an integer constant
  284 | #define CCM_ANALOG_TUPLE(reg, shift)  ((((uint32_t)(&((CCM_ANALOG_Type *)0U)->reg) & 0xFFFU) << 16U) | (shift))
      |                                                                                                               ^
c:\temp\arduino_build_100906\sketch\clock_functions.h:294:22: note: in expansion of macro 'CCM_ANALOG_TUPLE'
  294 |     kCLOCK_PllUsb2 = CCM_ANALOG_TUPLE(PLL_USB2, CCM_ANALOG_PLL_USB2_ENABLE_SHIFT), /*!< PLL USB2 */
      |                      ^~~~~~~~~~~~~~~~
In file included from c:\temp\arduino_build_100906\sketch\clock_functions.cpp:9:
c:\temp\arduino_build_100906\sketch\clock_functions.h:62: warning: "CCM_ANALOG_PLL_AUDIO_POST_DIV_SELECT" redefined
   62 | #define CCM_ANALOG_PLL_AUDIO_POST_DIV_SELECT(x)  (((uint32_t)(((uint32_t)(x)) << CCM_ANALOG_PLL_AUDIO_POST_DIV_SELECT_SHIFT)) & CCM_ANALOG_PLL_AUDIO_POST_DIV_SELECT_MASK)
      | 
clock_functions.h:329: warning: 'uint32_t CLOCK_GetPeriphClkFreq()' declared 'static' but never defined 
  329 | static uint32_t CLOCK_GetPeriphClkFreq(void);
      |                 ^~~~~~~~~~~~~~~~~~~~~~
In file included from C:\Arduino\hardware\teensy\avr\cores\teensy4/core_pins.h:32,
                 from C:\Arduino\hardware\teensy\avr\cores\teensy4/wiring.h:39,
                 from C:\Arduino\hardware\teensy\avr\cores\teensy4/WProgram.h:45,
                 from c:\temp\arduino_build_100906/pch/Arduino.h:6,
                 from c:\temp\arduino_build_100906\sketch\clock_functions.h:1,
                 from c:\temp\arduino_build_100906\sketch\clock_functions.cpp:9:
C:\Arduino\hardware\teensy\avr\cores\teensy4/imxrt.h:1570: note: this is the location of the previous definition
 1570 | #define CCM_ANALOG_PLL_AUDIO_POST_DIV_SELECT(n) ((uint32_t)(((n) & 0x03) <<19))
      | 
In file included from c:\temp\arduino_build_100906\sketch\clock_functions.cpp:9:
c:\temp\arduino_build_100906\sketch\clock_functions.h:64: warning: "CCM_ANALOG_MISC2_AUDIO_DIV_MSB" redefined
   64 | #define CCM_ANALOG_MISC2_AUDIO_DIV_MSB(x)        (((uint32_t)(((uint32_t)(x)) << CCM_ANALOG_MISC2_AUDIO_DIV_MSB_SHIFT)) & CCM_ANALOG_MISC2_AUDIO_DIV_MSB_MASK)
      | 
In file included from C:\Arduino\hardware\teensy\avr\cores\teensy4/core_pins.h:32,
                 from C:\Arduino\hardware\teensy\avr\cores\teensy4/wiring.h:39,
                 from C:\Arduino\hardware\teensy\avr\cores\teensy4/WProgram.h:45,
                 from c:\temp\arduino_build_100906/pch/Arduino.h:6,
                 from c:\temp\arduino_build_100906\sketch\clock_functions.h:1,
                 from c:\temp\arduino_build_100906\sketch\clock_functions.cpp:9:
C:\Arduino\hardware\teensy\avr\cores\teensy4/imxrt.h:1620: note: this is the location of the previous definition
 1620 | #define CCM_ANALOG_MISC2_AUDIO_DIV_MSB  ((uint32_t)(1<<23))
      | 
In file included from c:\temp\arduino_build_100906\sketch\clock_functions.cpp:9:
c:\temp\arduino_build_100906\sketch\clock_functions.h:65: warning: "CCM_ANALOG_MISC2_AUDIO_DIV_LSB" redefined
   65 | #define CCM_ANALOG_MISC2_AUDIO_DIV_LSB(x)        (((uint32_t)(((uint32_t)(x)) << CCM_ANALOG_MISC2_AUDIO_DIV_LSB_SHIFT)) & CCM_ANALOG_MISC2_AUDIO_DIV_LSB_MASK)
      | 
In file included from C:\Arduino\hardware\teensy\avr\cores\teensy4/core_pins.h:32,
                 from C:\Arduino\hardware\teensy\avr\cores\teensy4/wiring.h:39,
                 from C:\Arduino\hardware\teensy\avr\cores\teensy4/WProgram.h:45,
                 from c:\temp\arduino_build_100906/pch/Arduino.h:6,
                 from c:\temp\arduino_build_100906\sketch\clock_functions.h:1,
                 from c:\temp\arduino_build_100906\sketch\clock_functions.cpp:9:
C:\Arduino\hardware\teensy\avr\cores\teensy4/imxrt.h:1626: note: this is the location of the previous definition
 1626 | #define CCM_ANALOG_MISC2_AUDIO_DIV_LSB  ((uint32_t)(1<<15))
      | 
In file included from c:\temp\arduino_build_100906\sketch\clock_functions.cpp:9:
c:\temp\arduino_build_100906\sketch\clock_functions.h:67: warning: "CCM_ANALOG_PLL_VIDEO_POST_DIV_SELECT" redefined
   67 | #define CCM_ANALOG_PLL_VIDEO_POST_DIV_SELECT(x)  (((uint32_t)(((uint32_t)(x)) << CCM_ANALOG_PLL_VIDEO_POST_DIV_SELECT_SHIFT)) & CCM_ANALOG_PLL_VIDEO_POST_DIV_SELECT_MASK)
      | 
In file included from C:\Arduino\hardware\teensy\avr\cores\teensy4/core_pins.h:32,
                 from C:\Arduino\hardware\teensy\avr\cores\teensy4/wiring.h:39,
                 from C:\Arduino\hardware\teensy\avr\cores\teensy4/WProgram.h:45,
                 from c:\temp\arduino_build_100906/pch/Arduino.h:6,
                 from c:\temp\arduino_build_100906\sketch\clock_functions.h:1,
                 from c:\temp\arduino_build_100906\sketch\clock_functions.cpp:9:
C:\Arduino\hardware\teensy\avr\cores\teensy4/imxrt.h:1577: note: this is the location of the previous definition
 1577 | #define CCM_ANALOG_PLL_VIDEO_POST_DIV_SELECT(n) ((uint32_t)(((n) & 0x03) << 19))
      | 
In file included from c:\temp\arduino_build_100906\sketch\clock_functions.cpp:9:
c:\temp\arduino_build_100906\sketch\clock_functions.h:68: warning: "CCM_ANALOG_MISC2_VIDEO_DIV" redefined
   68 | #define CCM_ANALOG_MISC2_VIDEO_DIV(x)            (((uint32_t)(((uint32_t)(x)) << CCM_ANALOG_MISC2_VIDEO_DIV_SHIFT)) & CCM_ANALOG_MISC2_VIDEO_DIV_MASK)
      | 
In file included from C:\Arduino\hardware\teensy\avr\cores\teensy4/core_pins.h:32,
                 from C:\Arduino\hardware\teensy\avr\cores\teensy4/wiring.h:39,
                 from C:\Arduino\hardware\teensy\avr\cores\teensy4/WProgram.h:45,
                 from c:\temp\arduino_build_100906/pch/Arduino.h:6,
                 from c:\temp\arduino_build_100906\sketch\clock_functions.h:1,
                 from c:\temp\arduino_build_100906\sketch\clock_functions.cpp:9:
C:\Arduino\hardware\teensy\avr\cores\teensy4/imxrt.h:1615: note: this is the location of the previous definition
 1615 | #define CCM_ANALOG_MISC2_VIDEO_DIV(n)  ((uint32_t)(((n) & 0x03) << 30))
      | 
In file included from c:\temp\arduino_build_100906\sketch\clock_functions.cpp:9:
c:\temp\arduino_build_100906\sketch\clock_functions.h:95: warning: "CCM_ANALOG_PLL_VIDEO_DIV_SELECT" redefined
   95 | #define CCM_ANALOG_PLL_VIDEO_DIV_SELECT(x)       (((uint32_t)(((uint32_t)(x)) << CCM_ANALOG_PLL_VIDEO_DIV_SELECT_SHIFT)) & CCM_ANALOG_PLL_VIDEO_DIV_SELECT_MASK)
      | 
In file included from C:\Arduino\hardware\teensy\avr\cores\teensy4/core_pins.h:32,
                 from C:\Arduino\hardware\teensy\avr\cores\teensy4/wiring.h:39,
                 from C:\Arduino\hardware\teensy\avr\cores\teensy4/WProgram.h:45,
                 from c:\temp\arduino_build_100906/pch/Arduino.h:6,
                 from c:\temp\arduino_build_100906\sketch\clock_functions.h:1,
                 from c:\temp\arduino_build_100906\sketch\clock_functions.cpp:9:
C:\Arduino\hardware\teensy\avr\cores\teensy4/imxrt.h:1582: note: this is the location of the previous definition
 1582 | #define CCM_ANALOG_PLL_VIDEO_DIV_SELECT(n) ((uint32_t)(((n) & 0x7F) << 0))
      | 
In file included from c:\temp\arduino_build_100906\sketch\clock_functions.cpp:9:
c:\temp\arduino_build_100906\sketch\clock_functions.h:104: warning: "CCM_ANALOG_PLL_ENET_DIV_SELECT" redefined
  104 | #define CCM_ANALOG_PLL_ENET_DIV_SELECT(x)        (((uint32_t)(((uint32_t)(x)) << CCM_ANALOG_PLL_ENET_DIV_SELECT_SHIFT)) & CCM_ANALOG_PLL_ENET_DIV_SELECT_MASK)
      | 
In file included from C:\Arduino\hardware\teensy\avr\cores\teensy4/core_pins.h:32,
                 from C:\Arduino\hardware\teensy\avr\cores\teensy4/wiring.h:39,
                 from C:\Arduino\hardware\teensy\avr\cores\teensy4/WProgram.h:45,
                 from c:\temp\arduino_build_100906/pch/Arduino.h:6,
                 from c:\temp\arduino_build_100906\sketch\clock_functions.h:1,
                 from c:\temp\arduino_build_100906\sketch\clock_functions.cpp:9:
C:\Arduino\hardware\teensy\avr\cores\teensy4/imxrt.h:1591: note: this is the location of the previous definition
 1591 | #define CCM_ANALOG_PLL_ENET_DIV_SELECT(n) ((uint32_t)(((n) & 0x03) << 0))
      | 
In file included from c:\temp\arduino_build_100906\sketch\clock_functions.cpp:9:
clock_functions.h:284: error: dereferencing a null pointer in '*0'
  284 | #define CCM_ANALOG_TUPLE(reg, shift)  ((((uint32_t)(&((CCM_ANALOG_Type *)0U)->reg) & 0xFFFU) << 16U) | (shift))
      |                                                                                                               ^
c:\temp\arduino_build_100906\sketch\clock_functions.h:287:21: note: in expansion of macro 'CCM_ANALOG_TUPLE'
  287 |     kCLOCK_PllArm = CCM_ANALOG_TUPLE(PLL_ARM, CCM_ANALOG_PLL_ARM_ENABLE_SHIFT),       /*!< PLL ARM */
      |                     ^~~~~~~~~~~~~~~~
clock_functions.h:284: error: enumerator value for 'kCLOCK_PllArm' is not an integer constant
  284 | #define CCM_ANALOG_TUPLE(reg, shift)  ((((uint32_t)(&((CCM_ANALOG_Type *)0U)->reg) & 0xFFFU) << 16U) | (shift))
      |                                                                                                               ^
c:\temp\arduino_build_100906\sketch\clock_functions.h:287:21: note: in expansion of macro 'CCM_ANALOG_TUPLE'
  287 |     kCLOCK_PllArm = CCM_ANALOG_TUPLE(PLL_ARM, CCM_ANALOG_PLL_ARM_ENABLE_SHIFT),       /*!< PLL ARM */
      |                     ^~~~~~~~~~~~~~~~
clock_functions.h:284: error: dereferencing a null pointer in '*0'
  284 | #define CCM_ANALOG_TUPLE(reg, shift)  ((((uint32_t)(&((CCM_ANALOG_Type *)0U)->reg) & 0xFFFU) << 16U) | (shift))
      |                                                                                                               ^
c:\temp\arduino_build_100906\sketch\clock_functions.h:288:21: note: in expansion of macro 'CCM_ANALOG_TUPLE'
  288 |     kCLOCK_PllSys = CCM_ANALOG_TUPLE(PLL_SYS, CCM_ANALOG_PLL_SYS_ENABLE_SHIFT),       /*!< PLL SYS */
      |                     ^~~~~~~~~~~~~~~~
clock_functions.h:284: error: enumerator value for 'kCLOCK_PllSys' is not an integer constant
  284 | #define CCM_ANALOG_TUPLE(reg, shift)  ((((uint32_t)(&((CCM_ANALOG_Type *)0U)->reg) & 0xFFFU) << 16U) | (shift))
      |                                                                                                               ^
c:\temp\arduino_build_100906\sketch\clock_functions.h:288:21: note: in expansion of macro 'CCM_ANALOG_TUPLE'
  288 |     kCLOCK_PllSys = CCM_ANALOG_TUPLE(PLL_SYS, CCM_ANALOG_PLL_SYS_ENABLE_SHIFT),       /*!< PLL SYS */
      |                     ^~~~~~~~~~~~~~~~
clock_functions.h:284: error: dereferencing a null pointer in '*0'
  284 | #define CCM_ANALOG_TUPLE(reg, shift)  ((((uint32_t)(&((CCM_ANALOG_Type *)0U)->reg) & 0xFFFU) << 16U) | (shift))
      |                                                                                                               ^
c:\temp\arduino_build_100906\sketch\clock_functions.h:289:22: note: in expansion of macro 'CCM_ANALOG_TUPLE'
  289 |     kCLOCK_PllUsb1 = CCM_ANALOG_TUPLE(PLL_USB1, CCM_ANALOG_PLL_USB1_ENABLE_SHIFT),    /*!< PLL USB1 */
      |                      ^~~~~~~~~~~~~~~~
clock_functions.h:284: error: enumerator value for 'kCLOCK_PllUsb1' is not an integer constant
  284 | #define CCM_ANALOG_TUPLE(reg, shift)  ((((uint32_t)(&((CCM_ANALOG_Type *)0U)->reg) & 0xFFFU) << 16U) | (shift))
      |                                                                                                               ^
c:\temp\arduino_build_100906\sketch\clock_functions.h:289:22: note: in expansion of macro 'CCM_ANALOG_TUPLE'
  289 |     kCLOCK_PllUsb1 = CCM_ANALOG_TUPLE(PLL_USB1, CCM_ANALOG_PLL_USB1_ENABLE_SHIFT),    /*!< PLL USB1 */
      |                      ^~~~~~~~~~~~~~~~
clock_functions.h:284: error: dereferencing a null pointer in '*0'
  284 | #define CCM_ANALOG_TUPLE(reg, shift)  ((((uint32_t)(&((CCM_ANALOG_Type *)0U)->reg) & 0xFFFU) << 16U) | (shift))
      |                                                                                                               ^
c:\temp\arduino_build_100906\sketch\clock_functions.h:290:23: note: in expansion of macro 'CCM_ANALOG_TUPLE'
  290 |     kCLOCK_PllAudio = CCM_ANALOG_TUPLE(PLL_AUDIO, CCM_ANALOG_PLL_AUDIO_ENABLE_SHIFT), /*!< PLL Audio */
      |                       ^~~~~~~~~~~~~~~~
clock_functions.h:284: error: enumerator value for 'kCLOCK_PllAudio' is not an integer constant
  284 | #define CCM_ANALOG_TUPLE(reg, shift)  ((((uint32_t)(&((CCM_ANALOG_Type *)0U)->reg) & 0xFFFU) << 16U) | (shift))
      |                                                                                                               ^
c:\temp\arduino_build_100906\sketch\clock_functions.h:290:23: note: in expansion of macro 'CCM_ANALOG_TUPLE'
  290 |     kCLOCK_PllAudio = CCM_ANALOG_TUPLE(PLL_AUDIO, CCM_ANALOG_PLL_AUDIO_ENABLE_SHIFT), /*!< PLL Audio */
      |                       ^~~~~~~~~~~~~~~~
clock_functions.h:284: error: dereferencing a null pointer in '*0'
  284 | #define CCM_ANALOG_TUPLE(reg, shift)  ((((uint32_t)(&((CCM_ANALOG_Type *)0U)->reg) & 0xFFFU) << 16U) | (shift))
      |                                                                                                               ^
c:\temp\arduino_build_100906\sketch\clock_functions.h:291:23: note: in expansion of macro 'CCM_ANALOG_TUPLE'
  291 |     kCLOCK_PllVideo = CCM_ANALOG_TUPLE(PLL_VIDEO, CCM_ANALOG_PLL_VIDEO_ENABLE_SHIFT), /*!< PLL Video */
      |                       ^~~~~~~~~~~~~~~~
clock_functions.h:284: error: enumerator value for 'kCLOCK_PllVideo' is not an integer constant
  284 | #define CCM_ANALOG_TUPLE(reg, shift)  ((((uint32_t)(&((CCM_ANALOG_Type *)0U)->reg) & 0xFFFU) << 16U) | (shift))
      |                                                                                                               ^
c:\temp\arduino_build_100906\sketch\clock_functions.h:291:23: note: in expansion of macro 'CCM_ANALOG_TUPLE'
  291 |     kCLOCK_PllVideo = CCM_ANALOG_TUPLE(PLL_VIDEO, CCM_ANALOG_PLL_VIDEO_ENABLE_SHIFT), /*!< PLL Video */
      |                       ^~~~~~~~~~~~~~~~
clock_functions.h:284: error: dereferencing a null pointer in '*0'
  284 | #define CCM_ANALOG_TUPLE(reg, shift)  ((((uint32_t)(&((CCM_ANALOG_Type *)0U)->reg) & 0xFFFU) << 16U) | (shift))
      |                                                                                                               ^
c:\temp\arduino_build_100906\sketch\clock_functions.h:292:22: note: in expansion of macro 'CCM_ANALOG_TUPLE'
  292 |     kCLOCK_PllEnet = CCM_ANALOG_TUPLE(PLL_ENET, CCM_ANALOG_PLL_ENET_ENABLE_SHIFT), /*!< PLL Enet0 */
      |                      ^~~~~~~~~~~~~~~~
clock_functions.h:284: error: enumerator value for 'kCLOCK_PllEnet' is not an integer constant
  284 | #define CCM_ANALOG_TUPLE(reg, shift)  ((((uint32_t)(&((CCM_ANALOG_Type *)0U)->reg) & 0xFFFU) << 16U) | (shift))
      |                                                                                                               ^
c:\temp\arduino_build_100906\sketch\clock_functions.h:292:22: note: in expansion of macro 'CCM_ANALOG_TUPLE'
  292 |     kCLOCK_PllEnet = CCM_ANALOG_TUPLE(PLL_ENET, CCM_ANALOG_PLL_ENET_ENABLE_SHIFT), /*!< PLL Enet0 */
      |                      ^~~~~~~~~~~~~~~~
clock_functions.h:284: error: dereferencing a null pointer in '*0'
  284 | #define CCM_ANALOG_TUPLE(reg, shift)  ((((uint32_t)(&((CCM_ANALOG_Type *)0U)->reg) & 0xFFFU) << 16U) | (shift))
      |                                                                                                               ^
c:\temp\arduino_build_100906\sketch\clock_functions.h:293:25: note: in expansion of macro 'CCM_ANALOG_TUPLE'
  293 |     kCLOCK_PllEnet25M = CCM_ANALOG_TUPLE(PLL_ENET, CCM_ANALOG_PLL_ENET_ENET_25M_REF_EN_SHIFT), /*!< PLL Enet1 */
      |                         ^~~~~~~~~~~~~~~~
clock_functions.h:284: error: enumerator value for 'kCLOCK_PllEnet25M' is not an integer constant
  284 | #define CCM_ANALOG_TUPLE(reg, shift)  ((((uint32_t)(&((CCM_ANALOG_Type *)0U)->reg) & 0xFFFU) << 16U) | (shift))
      |                                                                                                               ^
c:\temp\arduino_build_100906\sketch\clock_functions.h:293:25: note: in expansion of macro 'CCM_ANALOG_TUPLE'
  293 |     kCLOCK_PllEnet25M = CCM_ANALOG_TUPLE(PLL_ENET, CCM_ANALOG_PLL_ENET_ENET_25M_REF_EN_SHIFT), /*!< PLL Enet1 */
      |                         ^~~~~~~~~~~~~~~~
clock_functions.h:284: error: dereferencing a null pointer in '*0'
  284 | #define CCM_ANALOG_TUPLE(reg, shift)  ((((uint32_t)(&((CCM_ANALOG_Type *)0U)->reg) & 0xFFFU) << 16U) | (shift))
      |                                                                                                               ^
c:\temp\arduino_build_100906\sketch\clock_functions.h:294:22: note: in expansion of macro 'CCM_ANALOG_TUPLE'
  294 |     kCLOCK_PllUsb2 = CCM_ANALOG_TUPLE(PLL_USB2, CCM_ANALOG_PLL_USB2_ENABLE_SHIFT), /*!< PLL USB2 */
      |                      ^~~~~~~~~~~~~~~~
clock_functions.h:284: error: enumerator value for 'kCLOCK_PllUsb2' is not an integer constant
  284 | #define CCM_ANALOG_TUPLE(reg, shift)  ((((uint32_t)(&((CCM_ANALOG_Type *)0U)->reg) & 0xFFFU) << 16U) | (shift))
      |                                                                                                               ^
c:\temp\arduino_build_100906\sketch\clock_functions.h:294:22: note: in expansion of macro 'CCM_ANALOG_TUPLE'
  294 |     kCLOCK_PllUsb2 = CCM_ANALOG_TUPLE(PLL_USB2, CCM_ANALOG_PLL_USB2_ENABLE_SHIFT), /*!< PLL USB2 */
      |                      ^~~~~~~~~~~~~~~~
dereferencing a null pointer in '*0'
 
At your service Frank :) - I even fixed your post … html is hard :) :)

That output is really odd - I wonder if there is a simple problem/fix?

Are the definitions the same in both cases? I've seen dual #defines ignored if they are the same - maybe gcc9 doesn't like that and cores\teensy4/imxrt.h needs a check like:
Code:
#ifndef __INTERVALTIMER_H__
#define __INTERVALTIMER_H__
 
For instance these are only defined one time in cores:
Code:
Searching 4667 files for "CCM_ANALOG_MISC2_VIDEO_DIV"

T:\arduino-1.8.11\hardware\teensy\avr\cores\teensy4\imxrt.h:
 1613  #define CCM_ANALOG_MISC1_LVDSCLK1_OBEN		((uint32_t)(1<<10))
 1614  #define CCM_ANALOG_MISC1_LVDS1_CLK_SEL(n)	((uint32_t)(((n) & 0x1F) << 0))
[B] 1615: #define CCM_ANALOG_MISC2_VIDEO_DIV(n)		((uint32_t)(((n) & 0x03) << 30))[/B]
 1616  #define CCM_ANALOG_MISC2_REG2_STEP_TIME(n)	((uint32_t)(((n) & 0x03) << 28))
 1617  #define CCM_ANALOG_MISC2_REG1_STEP_TIME(n)	((uint32_t)(((n) & 0x03) << 26))

1 match in 1 file

Code:
Searching 4667 files for "CCM_ANALOG_PLL_ENET_DIV_SELECT"

T:\arduino-1.8.11\hardware\teensy\avr\cores\teensy4\imxrt.h:
 1589  #define CCM_ANALOG_PLL_ENET_POWERDOWN		((uint32_t)(1<<12))
 1590  #define CCM_ANALOG_PLL_ENET_ENET2_DIV_SELECT(n)	((uint32_t)(((n) & 0x03) << 2))
[B] 1591: #define CCM_ANALOG_PLL_ENET_DIV_SELECT(n)	((uint32_t)(((n) & 0x03) << 0))[/B]
 1592  #define CCM_ANALOG_MISC0_XTAL_24M_PWD		((uint32_t)(1<<30))
 1593  #define CCM_ANALOG_MISC0_RTC_XTAL_SOURCE	((uint32_t)(1<<29))

1 match in 1 file
 
@defragster - @Frank B
Good morning. Just going through posts over coffee.

Seeing the same warnings with dual defines but the sketches I have for the clocks still compile and run as @defragster mentioned. Interesting GCC9 giving you problems - maybe a flag needs to be set that isn't?

Looking through the errors:
Code:
CCM_ANALOG_PLL_AUDIO_POST_DIV_SELECT" redefined
is defined in:
Code:
cores\teensy4/core_pins.h:32:0,

Will put it on the list of things to update. Too early now with not enough coffee in me.
 
GCC9 stops compiling.
Could just be because it is better in finding errors.
The last line (above) says:
dereferencing a null pointer in '*0'

It's not important. I don't feel like fixing this right now. The old compiler works - all is good.
 
@defragster - @Frank B
Good morning. Just going through posts over coffee.

Seeing the same warnings with dual defines but the sketches I have for the clocks still compile and run as @defragster mentioned. Interesting GCC9 giving you problems - maybe a flag needs to be set that isn't?

Looking through the errors:
Code:
CCM_ANALOG_PLL_AUDIO_POST_DIV_SELECT" redefined
is defined in:
Code:
cores\teensy4/core_pins.h:32:0,

Will put it on the list of things to update. Too early now with not enough coffee in me.

Warnings - opps - I didn't actually read the console output when it worked. Sounds like that warning is elevated to an error?

Not seeing that defined anywhere but one place and used in one place with a Sublimetext Grep of ...\teensy\avr\*.*:
Code:
Searching 4667 files for "CCM_ANALOG_PLL_AUDIO_POST_DIV_SELECT"

T:\arduino-1.8.11\hardware\teensy\avr\cores\teensy4\imxrt.h:
 1568  #define CCM_ANALOG_PLL_SYS_POWERDOWN		((uint32_t)(1<<12))
 1569  #define CCM_ANALOG_PLL_SYS_DIV_SELECT		((uint32_t)(1<<1))
[COLOR="#FF0000"] 1570: #define CCM_ANALOG_PLL_AUDIO_POST_DIV_SELECT(n)	((uint32_t)(((n) & 0x03) <<19)) 
[/COLOR] 1571  #define CCM_ANALOG_PLL_AUDIO_BYPASS		((uint32_t)(1<<16)) 
 1572  #define CCM_ANALOG_PLL_AUDIO_BYPASS_CLK_SRC(n)	((uint32_t)(((n) & 0x03) <<14)) 

T:\arduino-1.8.11\hardware\teensy\avr\libraries\Audio\utility\imxrt_hw.cpp:
   37  
   38  	CCM_ANALOG_PLL_AUDIO = CCM_ANALOG_PLL_AUDIO_BYPASS | CCM_ANALOG_PLL_AUDIO_ENABLE
   39: 			     | CCM_ANALOG_PLL_AUDIO_POST_DIV_SELECT(2) // 2: 1/4; 1: 1/2; 0: 1/1
   40  			     | CCM_ANALOG_PLL_AUDIO_DIV_SELECT(nfact);
   41  

2 matches across 2 files
 
Is peripheral clock not based on IPG clock? Can't see how we get from 150 -> 24, division would have to be 6.25.

This works here with TD 1.50 and IDE 1.8.11


Not sure what version and errors you had - there were some in mine - just noise to remove - but it works here now.

Code:
System Clock: 600000000 [600
IPG Clock: 150000000 [150
Semc Clock: 200000000 [200
RTC Clock: 32768 [0
USB1pll Clock: 480000000 [480
Peripheral Clock: 24000000 [24
Osc Clock: 24000000 [24
Arm Clock: 1200000000 [1200
Usb1PllPfd0 Clock: 720000000 [720
Usb1PllPfd1 Clock: 664615368 [664
Usb1PllPfd2 Clock: 508235292 [508
Usb1PllPfd3 Clock: 454736826 [454
Usb2Pll Clock: 24000000 [24
SysPll Clock: 528000000 [528
SysPllPfd0 Clock: 351999990 [351
SysPllPfd1 Clock: 594000000 [594
SysPllPfd2 Clock: 396000000 [396
SysPllPfd3 Clock: 297000000 [297
EnetPll0 Clock: 0 [0
EnetPll1 Clock: 0 [0
AudioPll Clock: 786480000 [786
VideoPll Clock: 0 [0
 
Is peripheral clock not based on IPG clock? Can't see how we get from 150 -> 24, division would have to be 6.25.

There is a bunch of PLLs and clocks, dividers and switches.
The name "Clock tree" if totally correct:)
Take a look at the reference manual! (But don't trust it)
 
Yeah, I've been reading the manual (p. 1072). Just wondering what the default configuration was. Not sure why I was assuming it was based on IPG. If it's not based on IPG then it's based on 24Mhz internal reference oscillator (OSC) with divide by 1?
 
@mjs513 created that clock summary code - based on his reading of the manual and 'parsing the clock tree'.

He has done a couple of clock related things that worked so unless the version of the one posted it outdated or messed up from original work with changes - it should be correct.

Perhaps @mjs513 could confirm the code and give a clue if needed.

Frank - it would be good to know if the GCC9 issues you saw are resolved for teensy4\imxrt.h with a the addition of:
Code:
#ifndef __IMXRT_H__
#define __IMXRT_H__

While not an error in the current GCC5 - it might be causing extra work in the build if recursively included.
 
Now, when I see these numbers again.. Why is the syspll 528MHZ? Is that optimal? (What is connected?) Have to take a look at the diagram, too.
I guess it's just 528 because that was the default cpu freq. But it isn't 528 anymore..

@Tim, I try it later.
 
We really need our own clock-diagram - nobody knows what is connected where with what speed.

A function to display it at runtime would be perfect. Things can change at runtime. The only constants are the crystals.
 
We really need our own clock-diagram - nobody knows what is connected where with what speed.

A function to display it at runtime would be perfect. Things can change at runtime. The only constants are the crystals.

Indeed a clock diagram could be useful - that is another of those underlying things I just 'assume' to be correct. On T_3.x it was simpler as the F_CPU clock drove most things … now a Tree - with independent branches - has taken Root :)

That code : ClocksT4\ClocksT4.ino :: printClocks();
> Is printing those values in setup() at runtime? It could be called at any time.

The rest of that sketch was leftover from the time when T4 had an issue with set_arm_clock() change not fixing everything to have millis() tick calibrated right IIRC.

@mjs513 would have to make sense of what he did beyond that if there is any reason to distrust those numbers.
 
I trust them.
Now, it needs to be extended to all the peripherals :)

Good to know you trust them. Indeed if there are MORE then adding them would make sense.

For ClocksT4.ino :: > The only EDIT I made was also showing the values in "[MHz" to eliminate confusion 'counting zeros' to clarify 24 MHz from 240 Mhz
>> Serial.printf("SysPll Clock: %d [%d\r\n", ii = CLOCK_GetFreq(kCLOCK_SysPllClk), ii / MHZ_MHZ);
 
Afternoon - just catching up on the thread since that clock sketch seems be resurrected. I put that together in the early days of beta1 testing since I was curious about the clocks at that time. Its a hodgepodge of code I extracted from the SDK clocks.c. We just repurposed a couple of times since that time. Just going over the clock tree looks like for the most part its giving you the vertical clocks not the clocks that go horizontal. It probably could be extended with a bit of work to get the clocks that are in use.
 
I'm curious about them, too (but all time ;-) Your Sketch is great.
For example, for SPI it makes sense to select other inputs to get more choices for the clock (better granularity). I've used this already.
Knowing the actual settings make sense, then.
 
Yeah - just looking at the code now - will be a pain have to go over everything and the manual again to see if there is an easier way to get the clocks than to calculate them based on the mux and gate settings - probably now. Going to be busy with another high priority project over the next few weeks so may be awhile till I get to it unless some one else whats to jump in :)
 
Is peripheral clock not based on IPG clock? Can't see how we get from 150 -> 24, division would have to be 6.25.
I think the IPG_PERCLK_ROOT (peripheral clock) can be derived from either the IPG_CLK_ROOT or the OSC_CLK at 24MHz. Out of reset if you look at the register CCM_CSCMR1[PERCLK_CLK_SEL] the IPG_PERCLK_ROOT is derived from the OSC_CKL so that where your 24 MHz comes from and register CCM_CSCMR1[PERCLK_PODF] divider is 1 so the 24Mhz is not divided down.
Screen Shot 2020-02-11 at 7.17.46 PM.png
 
Back
Top