AnsweredAssumed Answered

Confused, Hardfaults, but clock enabled?

Question asked by Andrew Kroll on Dec 12, 2018
Latest reply on Dec 16, 2018 by Andrew Kroll

MCU: MKE16F512VLH16

 

Working on some bare metal code here, not using any of the prepackaged drivers, and can't seem to get LPSPI, and a few other of the components working. All seem to be related to FIRCDIV2.

 

Here is my register dump.

SCG_FIRCCSR 0x01000001 No error, not sysclk, valid, enabled
SCG_FIRCDIV 0x00000201 FIRCDIV2 /2, FIRCDIV1 /1
SCG_FIRCCFG 0x00000000 48MHz
SCG_FIRCTCFG 0x00000000 N/A
SCG_FIRCSTAT 0x00002353 N/A

SCG_SPLLCFG 0x00040201 *20, prediv /3, source = Fast IRC(48mhz)
SCG_SPLLCSR 0x03000001 SCS Fast IRC, DIVCORE /1, DIVBUS /1, DIVSLOW /2
SCG_SPLLDIV 0x00000101 plldiv2 /1, plldiv1 /1


PCC_LPSPI0 0xc3000000 Present, enabled, FIRCDIV2

PCC_LPI2C0 0xc3000000 Present, enabled, FIRCDIV

PCC_FTM0 0xc3000000 Present, enabled, FIRCDIV

 

SCG_SIRCDIV 0x00000101 div 2 /1, div 1 / 1

SIM_CHIPCTL 0x00008040 can filter SIRC clock, CLKOUT Select LPO clock (128kHz)

SCG_RCCR 0x03000001 SCS Fast IRC, DIVCORE /1, DIVBUS /1, DIVSLOW /2
SCG_HCCR 0x06000017 SCS System PLL, DIVCORE /1, DIVBUS /2 , DIVSLOW /8

 

 

Basically...

CORE_CLK 160MHz
SYS_CLK 160MHz
BUS_CLK 80MHz
FLASH_CLK 20MHz

 

So far...
ADC 24MHz Works!
SPI 24Mhz Hardfault
I2C 24MHz Hardfault
UART 24MHz Not tested yet, will probabbly hardfault.
FLEXIO 24MHz Not tested yet
LPIT 160MHz Works!
LPTMR 160MHz Works!
FTM 160MHz Works!
CAN 80MHz Works!

 

So it would seem to me that FIRCDIV2 isn't working, even though the bits are set? What am I missing?

Outcomes