S12ZVM ADC timing and data consistency

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

S12ZVM ADC timing and data consistency

1,669 次查看
lill1990
Contributor I

Dear sir,

I have a code fragment as below in my application. 

/*****************************************************************/

ADC0FLWCTL_RSTA = 1u;

while (ADC0CONIF_1_EOL_IF == 0u) 
{
//_asm("NOP");
Variable1= ADCResult[0];  /*read data from RVL*/
Variable2= ADCResult[1];
}

/*****************************************************************/

When the loop is exited(all ADC commands were completed, EOL_IF was set), I could get valid Variable1, however, the Variable2 was mostly invalid.  

I inserted a  "NOP" to the loop, then I could get all data.

I suspect it is caused by ADC timing and data consistency, but I don't have a clear understanding about that.

Could you tell me the probably reason behind this ?

Thanks very much.

0 项奖励
回复
7 回复数

1,663 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hello @lill1990,

As per the EOL_IF description, this bit is set by the binary coded conversion command type select bits CMD_SEL[1:0] for “end of list” type of commands and after such a command has been processed and the related data has been stored RAM.

Can you share the whole ADC configuration?

Or a test project so that I can reproduce the error?

 

Thank you,

BR, Daniel

 

 

0 项奖励
回复

1,659 次查看
lill1990
Contributor I

Hello Daniel,

Thanks very much for your reply.

I attached the code and hope it is helpful for you.

0 项奖励
回复

1,654 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Thank you for the code.

I see you use the max specified BUS_CLK freq (50MHz) and ADCCLK freq (8.33MHz).

Which PLL mode do you use?

Are you sure the BUS_CLK = 50MHz?

Can you scope the clock at ECLK?

Is PLL modulation enabled (CPMUPLL)?

 

Thanks,

Daniel

 

 

 

0 项奖励
回复

1,647 次查看
lill1990
Contributor I

Hello Daniel.

IRC is used in my application and I am sure the clock is correct.

PLL frequency modulation is off.

Thanks.

0 项奖励
回复

1,640 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @lill1990,

I will need to test it.
What is the part number of the MCU (mask-set)?


From the code, I see that you measure the VSUP only if VSUP < 4.5V
Have you tested it under normal conditions when VSUP =~12V.

Since the measurement takes place at low supply voltage, is the BUS_CLK (ADC_CLK) stabilized at the time of the measurement?

Thanks,
Daniel

 

0 项奖励
回复

1,636 次查看
lill1990
Contributor I

Hello Daniel,

The MCU is MC9S12ZVML31, mask set 1N14N.

Yes, the code is used in the initialization to ensure the VSUP is >=4.5 before starting GDU.

The VSUP was stable as 12V, I reset MCU to test this function via debugger.

I tried to add a breakpoint into the while{ADC0CONIF_1_EOL_IF == 0u} loop, then continue running, every thing was OK. I think the ADC completed the conversation during the break.

But if no any break before EOL flag was set by HW, the behavior I described in this question will appear.

Thanks.

0 项奖励
回复

1,567 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hello @lill1990,

I'm sorry for the delay, I was out of office for a few days and could not test it earlier.

I'm not able to reproduce the issue with the test code attached.

Can you run the test project on your side?

 

BR, Daniel

0 项奖励
回复