how can i use PTU to trigger  ADC?  i want to  get DC current

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

how can i use PTU to trigger  ADC?  i want to  get DC current

1,916 Views
xiangxu860
Contributor II

I use the S12ZVMC128 chip, and i want to PTU to trigger  ADC , then get DC current.

But when i set  ADC CommandList  as shown  below ,   (0xD0 is the channel of DC current) , the results in ADCResultList  are different.(DC current is constant.)177644_177644.pngpastedImage_1.png

what's more, if i don't use the module as shown below ,the results of DC current   I get    are   zero.

177645_177645.pngpastedImage_2.png

The code file is in the attachment.

could you help me and check the code file,find the bug . 

by the way ,could you tell me how can i use PTU to trigger  ADC , which registers should i pay more attention?

Labels (1)
Tags (3)
0 Kudos
8 Replies

1,384 Views
xiangxu860
Contributor II


the problem is still unresolved!
could anyone give me a hand?   thanks very much!!

0 Kudos

1,385 Views
mohanvustepalle
Contributor I

Hi,

Can you check the address 0x00608 to make sure there are no errors.

BR,

Mohan

0 Kudos

1,385 Views
xiangxu860
Contributor II
I have found some problems in my code .
I haven't setup the PMFCFG2  register  in the initPMF() , and it's setup as below in the demo code.
PMF setup.PNG
now i can get signals in  the pin as below.
PTU SETUP.PNG
but now i have some other problems. the PTU trigger doesn't occur  at what i setup in the PTUTriggerEventList.
3EE7EE83-9671-4026-91F3-A67AA90DD1FB.png
and i can't get into the for loop in main function  after the program initialization. then i check some flag registers as below .
 reload event.PNG
if i don't setup the PMFCFG2  register  in the initPMF() ,the result is as follow.
non-reload  event.PNG
could you give me some advice?
thank you very much!
0 Kudos

1,385 Views
xiangxu860
Contributor II

thanks for your answer !

there are no errors in ADC1EIF and ADC0EIF.

i think ptu  doesn't work at all . I can't get any signals in pins. 

pastedImage_1.png

0 Kudos

1,385 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi

I haven’t found any bug in the code. Do you use the software for development kit or you modify own project? Could you attach the project? How significant is the change in results and how did you get stable current?

If the change is significant, there might be a problem with memory allocation. Are the lists properly aligned? Have you tried putting it directly at aligned address?

Daniel

0 Kudos

1,385 Views
xiangxu860
Contributor II

Could you please give me a simple demo software,which can use PTU trigger ADC?

thanks very much!

0 Kudos

1,385 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi

Unfortunately, we don’t have an example code with PTU except for the Complete motor control application software package. 

Regards

Daniel

0 Kudos

1,385 Views
xiangxu860
Contributor II

thanks for your answer !

1,   I modified  my own project ,according to the software of development kit.

2,   I configure the register as follow to  get the stable current.(single bridge PWM)

      PMFOUTC =0x34; 
      PMFOUTB = 0x2A;

3,   memory allocation is configured in the mc9s12zvmc128.prm  file.

pastedImage_11.png

 

0 Kudos