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.
Hi,
I attached some useful existing ADC examples and links.
S12Z constant, variable, code allocation in CodeWarrior
BATS Voltage Supply Sense example code for MagniV devices
https://community.nxp.com/docs/DOC-341061
I hope it helps.
Best regards,
Diana
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
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= {..........};