Reading or writing to ADC registers causes hard fault (KEA128)

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading or writing to ADC registers causes hard fault (KEA128)

492 Views
batts
Contributor I

Hi there, 

I'm having a problem where whenever I read or write to any of the ADC registers the processor enters a Hard Fault (HardFault_Handler). I am using the SKEAZ1284.h register abstraction to access the ADC registers. These are the registers in question:

#define ADC_BASE (0x4003B000u)

ADC_SC1
ADC_SC2
ADC_SC3
ADC_SC4
ADC_R
ADC_CV
ADC_APCTL1
ADC_SC5 

And the ADC initialisation I'm trying to run:

ADC_SC3 = ADC_SC3_ADLPC_MASK | ADC_SC3_ADLSMP_MASK | ADC_SC3_MODE_MASK;
ADC_SC2 = 0x00;
ADC_SC1 = ADC_SC1_AIEN_MASK | ADC_SC1_ADCH_MASK;

MCU PN: S9KEAZ128AMLK, and I've attached the linker and startup files. 

 

Cheers for any help. 

Original Attachment has been moved to: system_SKEAZ1284.c.zip

Original Attachment has been moved to: startup_SKEAZ1284.S.zip

Original Attachment has been moved to: SKEAZ_flash.ld.zip

Labels (1)
0 Kudos
1 Reply

207 Views
jiri_kral
NXP Employee
NXP Employee

Hi, 

well - I can't reproduce the issue. I create new ADC project from examples (for KEA128), added to main your part of code, replaced linker/system/startup files by files from attachment and I can normally write into registers and MCU is running as expected. Can you attach your full project? 

Jiri 

0 Kudos