AnsweredAssumed Answered

ADC issue with CW 10.6

Question asked by djmoore on Apr 15, 2014
Latest reply on May 30, 2014 by Petr_H

Hi All,

 

I had an SCI issue with CW 10.4 and installed 10.6 which fixed it, looks like the Enter Critical wasn't disabling interrupts

as the Buffer was good, but the output pointer was getting corrupted.

 

Now I have a new problem, the ADC code which was working in 10.4 has an issue. One channel looks to be reading the

wrong port (now confirmed) (ADC0_SE4B pin 21, KL25 80 pin package)

 

I've tracked down the issue to the following bit in the ADC Init code, produced by Code warrior PE.

 

LDD_TDeviceData* AdcLdd1_Init(LDD_TUserData *UserDataPtr)

 

...snip..

 

/* ADC0_CFG2: MUXSEL=0,ADACKEN=0,ADHSC=0,ADLSTS=0 */

  ADC0_CFG2 &= (uint32_t)~(uint32_t)(

//                ADC_CFG2_MUXSEL_MASK |

                ADC_CFG2_ADACKEN_MASK |

                ADC_CFG2_ADHSC_MASK |

                ADC_CFG2_ADLSTS(0x03)

               );

 

With CW 10.6, the ADC Init code clears the MUXSEL, to choose the 'a' ADC input pins, the only ADC input I'm using

in the 'a'/'b' banks is ADC0_SE4b, pin 21 on the 80pin KL25 package. So PE is selecting the wrong bank.

 

Regards,

Darren

 

KL25P80M48SF0RM.pdf

Chapter 28 Analog-to-Digital Converter (ADC)

page 467

 

4 MUXSEL

ADC Mux Select

Changes the ADC mux setting to select between alternate sets of ADC channels.

0 ADxxa channels are selected.

1 ADxxb channels are selected.

Outcomes