S12Z ADC works with emulator and does not work after flashing

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

S12Z ADC works with emulator and does not work after flashing

2,294件の閲覧回数
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,905件の閲覧回数
dianabatrlova
NXP TechSupport
NXP TechSupport

1,905件の閲覧回数
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,905件の閲覧回数
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 件の賞賛
返信