The conversion value of S32K144 ADC module is abnormal?

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

The conversion value of S32K144 ADC module is abnormal?

Jump to solution
2,309 Views
liuqimin
Contributor IV

Hello 

    Test the S32K144 ADC module, use the PDB module to trigger, and keep the output synchronization with the PWM module. But the value converted by the ADC module differs too much from the actual value.
    Tested on 3 channels, the Vdc value obtained after ADC conversion is not much different, Ia is too large, Idc is too small (almost zero), the actual measured Idc voltage is 0.3V, and the Ia voltage is 0.1V.
    Is this because there is a problem with the PDB module or ADC module settings?

liuqimin_0-1608537957329.png

 

   Best Regards!

   Qimin Liu

0 Kudos
1 Solution
2,254 Views
adriantudor
NXP Employee
NXP Employee

@liuqimin,

Hi Liu Qimin, 

I have tested your latest model and it's working. I connected all these 3 pins to gnd and 3.3v and the output it's the expected one.

What's your flashig method that you use? I see that you don't use openSda.

When you use FreeMaster, please be sure that after every build, you reload the latest binary file to FreeMaster project. If you don't do that, FreeMaster variables will be incorrect mapped. 

If you allready do that, then maybe you have a hardware problem.

 

Best regards, 

Adrian

View solution in original post

0 Kudos
8 Replies
2,308 Views
adriantudor
NXP Employee
NXP Employee

@liuqimin ,

 Hi Qimin Liu,

Please tell me what dev-board and motor are you using. The ADC measures a voltage at a time. How did you measure the voltage on the ADC input (using a multimeter or an oscilloscope)?

 

Best regards,

Adrian

0 Kudos
2,303 Views
liuqimin
Contributor IV

Hi Adrian

    This circuit board is a driver board designed by ourselves for DC motor control.
     The three variables measured are: Ia: DC motor armature current, used for feedback of motor closed-loop control. Vdc: Driver board input voltage, Idc: Driver board input current, used for driver board protection.
    The actual voltage is measured using a multimeter.

   BRs!

 Qimin

0 Kudos
2,298 Views
adriantudor
NXP Employee
NXP Employee

@liuqimin ,

Hi Qimin,

In the S32K reference manual, you can find in " 43.4 ADC Hardware Interleaved Channels
" chapter info about interleave hardware function. This interleave function is used to create a more flexible pin configuration for ADC. In this snapshot, these switches are controlled by the interleave function. By default, these switches are like in this picture. So by default, the PTB0 pin is connected to the ADC0. If you want to use this PTB0 connected to ADC1 then you must first use an interleave block and select "PTB0 to ADC0_SE4 and ADC1_SE14". The code generated by this block it's called at the initialization step only. 

adriantudor_0-1608547885791.png

Best regards,

Adrian

0 Kudos
2,270 Views
liuqimin
Contributor IV

Hi Adrian

    PTB0 increases the interleaving to solve the problem of false height of sampled data. But now Ia, Idc sampling port still seems not to work. Use an oscilloscope to measure the actual voltage of the three sampling ports as follows. But the ADC output of Ia and Idc sampling ports is almost 0. See the variable data returned by FREEMASTER below.

 

Is there still a problem with the ADC module settings?

  Best Regards!

  Qimin

 

0 Kudos
2,264 Views
liuqimin
Contributor IV

Ia.PNGIdc.PNGVdc.PNG

freemaster2.PNG

Seems to be missing the picture

 

0 Kudos
2,255 Views
adriantudor
NXP Employee
NXP Employee

@liuqimin,

Hi Liu Qimin, 

I have tested your latest model and it's working. I connected all these 3 pins to gnd and 3.3v and the output it's the expected one.

What's your flashig method that you use? I see that you don't use openSda.

When you use FreeMaster, please be sure that after every build, you reload the latest binary file to FreeMaster project. If you don't do that, FreeMaster variables will be incorrect mapped. 

If you allready do that, then maybe you have a hardware problem.

 

Best regards, 

Adrian

0 Kudos
2,194 Views
liuqimin
Contributor IV

Hi Adrian

    Yes, there should be no problem with the revised model. Now to solve this problem is to modify the hardware-increase the resistance of the current sampling resistor, so that after increasing the sampling voltage, the ADC can convert the data. One thing I don’t understand is that there is a sampling voltage output before increasing the resistance of the sampling resistor. Why can’t the data be converted? ADC module resolution is not enough?
    The generated BIN file is downloaded with J-LINK, so there is no OPENSDA option in the model.

  Best Regards!

  Qimin Liu

0 Kudos
2,179 Views
adriantudor
NXP Employee
NXP Employee

@liuqimin ,

Hi Qimin Liu,

I think it would be great if you will share your schematic. I don't know if the ADC resolution is not enough for you because I don't know what voltage are you trying to measure. Anyway, the ADC resolution is 12 bit (that means for 5V Vref the smallest voltage that can be measured is about 1.22mV). If you measured Ia and Idc (as I have seen in your oscilloscope snapshot) and at the same time your microcontroller it was running, then you should have seen in Freemaster the corresponding ADC values. 

I suggest you to create a method to be sure that every time when you flash something on your microcontroller to be sure that it has flashed (e.g.: create a dummy variable and increase it at every time step or modify your PWM duty cycle and measure it with an oscilloscope). 

 

Best regards,

Adrian

0 Kudos