ADC problem with MC9S08GB32

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

ADC problem with MC9S08GB32

3,770件の閲覧回数
unclejay
Contributor I
Hello,

I have some problems with the ADC.
The conversion seems to work fine. I get IRQs but the values are wrong.

When I use 10bit resolution the values are from 970 to 1007 depending on the supplied voltage at the ad pin.

My board configuration:
external XTAL 8MHz

Register:
ICGC1 = 0x70
ADTC1 = 0xC2
ATD1PE = 0x1F

start with
ATD1SC = ATDIE | channel_no

Perhaps anyone has an idea what could be wrong....

Thanks and best regards,

Jürgen
ラベル(1)
0 件の賞賛
返信
3 返答(返信)

988件の閲覧回数
UK_CF_FAE
NXP Employee
NXP Employee
Jürgen,
 
ADC conversion errors are always (in my experience) explained by one of 3 causes:
1) you have too much source impedence in the analog network connected to the ADC input. This large impedance makes the charge-transfer onto the internal sample capacitor too slow, so the ADC reads incorrectly. This is detailed in the ADCRM - ADC Reference Manual, just do a keyword search for ADCRM on our site.
 
2) Incorrect ADC prescaler clock settings in the ATDC_PRS bits. 0xC2 for a 8MHz crystal????? ICGC1 = 0x70 means FBE clock mode, so ICGOUT is 4MHz, and the bus clock is 2MHz.. If you aim for a 1MHz ADC clock, then you need a prescaler of 2, so from the table 14-4 in the datasheet, PRS needs to be 0b0000.
 
3) You mixed up 8 and 10-bit mode, and confused right or left justified, so the chip is reading right, but you incorrectly read the result registers.
 
Post to us on this forum and let us know how you get on,
 
Mark
 
0 件の賞賛
返信

988件の閲覧回数
unclejay
Contributor I
Hello Mark,

first thanks for your answer.

1.) Even when I connect ground to the ad input pin I get 970 as the conversion result.

2.) I have corrected the values. My bus clock is 8 Mhz ( ICGC1 = 0x78 /
ICGC2 = 0x01) and ADC PRS is set to 2 (factor 6). So the conversion clock is 1,33MHz.

3.) The justify and mode settings are correct. For debug I have also checked the values in the result registers. Which also never reach the value 0.

Jürgen
0 件の賞賛
返信

988件の閲覧回数
unclejay
Contributor I
The Problem was solved.... the µC was broken.

Thanks...
0 件の賞賛
返信