ADC problem in XMC1100: can't get passed ANRDY

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Not applicable
Hi there,

I have tried to follow the errata sheet but can't get passed the "Wait until calibration is finished" loop.Here is the code so far:
I use the XMC1100 for Arduino Evaluation Board.

//Startup Calibration
VADC->GLOBCFG=1<<31; //Initiate start up calibration, GLOBCFG.SUCAL = 1
VADC->GLOBCFG|=1<<16; //Disable Post calibration, GLOBCFG.DPCAL0 = 1
*((uint32_t*)0x480340E0) = 0x8000; //clear Offset calibration by writing value 00008000H to register
*((uint32_t*)0x480340E4) = 0x8000; //addresses 0x480340E0 and 0x480340E4.
while ((SHS0->SHSCFG & SHS_SHSCFG_STATE_Msk) != 0); // Wait until calibration is finished

this loop never seems to end. If I skip this loop SHS0->SHSCFG shows 0xffffffff.
Does somebody have a working startup routine?
thanks for your help.
2 Replies
Level 4
Level 4
did you verify "switch_on(vadc)" working correctly?

Most likely you didn't activate the ADC clock, SHSCFG reads then 0xffffffff.

See the library code XMC_SCU_CLOCK_UngatePeripheralClock(), although it's author likely didn't remember that SCU_CLK->CGATCLR0 is a "write only" bit clear register, therefore you shouldn't use the read-modify-write as infineon code does but simply write a one bit at the correct place.

BTW: You should write whether you use AA or AB step silicon.
Not applicable
Obetz, thanks,
your comment prompted me to double check this.

And really, VADC was not de-asserted because a wrong number had been assigned to 'vadc' when calling "switch_on(vadc);"