S12Z ADC works with emulator and does not work after flashing

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

S12Z ADC works with emulator and does not work after flashing

2,299 次查看
xiemeijuan
Contributor II

Hi,all

  I found a strange phenomena, I configure PMF and PTU to trigger ADC with restart mode. When I debugged it with emulator (Lauterbach trace32), the ADC module works correctly and result is nice. But I flashing software in ECU and remove the emulator, after restart, I found ADC module does not work correctly and ADC is always in not ready status,so no result is converted. Did anybody encounter the problem before?  I will appreciate for discussion with you about it.

标签 (1)
0 项奖励
回复
3 回复数

1,910 次查看
dianabatrlova
NXP TechSupport
NXP TechSupport

1,910 次查看
kef2
Senior Contributor V

Hi,

debug with "emulator" connected normally involves special mode of operation. Without "emulator" - normal mode. Normal vs special affects write once registers behavior. Common mistake with write once register is write accessing different bit fields of there register. Write once register has to be written all required bits simultaneously in the same write access.

CW classic had the option to not reset target into special mode for debug. This allowed to insert while(x) say at top of main, which allowed target to boot ant wait until debugger is connected and user exits from wait loop and keeps debugging with special mode restrictions applied. I don't know whether this is possible in Eclipse CW for S12Z.

Edward

0 项奖励
回复

1,910 次查看
xiemeijuan
Contributor II

Thanks for your advice. 

I have found the issues and resolved it.  My compiler does not support appointing address likes ADC0CommandList@0x0001000
So the below is used

#pragma section {ram_ad}

volatile uint8 ADC0CommandList= {..........};

#prgma section{ }

When with emulator debug, the  command value  read from ADC0CBP adress is the same as the ADC0CommandList,so ADC works well.

But work without emulator, the  command value  read from ADC0CBP adress is missing ,so ADC does not work.

so the problem resolved as following and it works

#pragma section [ram_ad]

volatile uint8 ADC0CommandList;

#prgma section{ }

const uint8 ADC0CommandListAct={......};

void Adc_Init(void)

{

....

ADC0CommandList[]=ADC0CommandListAct[];

....

}

So what the difference between #pragma section{ } and  #pragma section [ ] ?   It seems that  initialized variables will be reinitialized after powerup with  #pragma section{ }. So it value will not the same as the intialiazed value  by ADC0CommandList= {..........};

0 项奖励
回复