S32K396 adding an ADC to motor control example project

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

S32K396 adding an ADC to motor control example project

343 Views
agus_idiada
Contributor III

Hello,

I am using S32K396-BGA-DC1 board, with Simulink in matlab2024a. I am working on the S32K396_MBDT_BASED_MC_0_9_0 Motor Control Example Project.

In my setup I have the nxp connected with a HIL-RT hardware emulating the power stage and a motor.

My question is regarding the ADC modules. I would like to add several ADC to the motor control example project. However, this is not working for me. After modifying, all the ADCs have and strange behavior so I supposed something is wrong configured.

On the simulink side I add a variable from the the FIFO

agus_idiada_0-1730300749313.png

On EB tresos I configured the adc and pin port.

agus_idiada_1-1730300821620.pngagus_idiada_2-1730300859893.png
agus_idiada_3-1730300900252.pngagus_idiada_4-1730300914680.pngagus_idiada_5-1730300953891.png

 

agus_idiada_6-1730301008177.pngagus_idiada_7-1730301065930.png



Can you please give me support on this and tell me what is missing or wrong in the config?

Thanks, Agustin.

Tags (3)
0 Kudos
Reply
5 Replies

223 Views
Vincent_Deng
NXP Employee
NXP Employee

Hi Agustin,

For the ADC with BCTU FIFO usage, please take care of the conversion rules. For usage in the demo, the BCTU 0 take 3 ADC channels as a group, so you can see there are 6 configured channel(2 group, phase currents as the first group and bus voltage with other no used channel as the second group.) in the BCTU LIST items and only 4 results are used in the demo. For more details, please refer to the Reference Manual, Chapter BCTU. Also, a example demo is supplied in the RTD driver.

As the mentioned above, you can find a quick and easy way to add your channel if you hope the channel is sampled with the phase currents and bus voltage. Replace the unused channel(BctuListItem3 or BctuListItem4) to your correctlly.

Thanks,

Vincent

0 Kudos
Reply

199 Views
agus_idiada
Contributor III

Hello @Vincent_Deng , I tried to follow your suggestion to used BctuListItem3 or BctuListItem4. So I configured a new channel (please see the doc attached) but is not working. Sorry but with my limiting knowledge I could not debug what else is missing. Please if you can help me with this would be great. Thanks.

Tags (3)
0 Kudos
Reply

161 Views
Vincent_Deng
NXP Employee
NXP Employee

Hi @agus_idiada,

I checked the attachment. You wanted to add the ADC2 Channel 0. However, the ADC2 has been used by the BctuListItem_5 for BusVoltage. First, there is a sequence that needs to be careful. Please see the picture(in Reference Manual, Chapter 57 ADC).

Vincent_Deng_0-1732504849318.png

In the Multiple Parallel Conversion(MPC, Chapter 64 BCTU for more details & example), the configuration for the trigger should be in order from ADC 0 to ADC 2. You can see the configuration in the demo, for the first group(BctuListItem_0 to 2), the trigger for ADC 0 Channel 0, ADC 1 Channel 0 and ADC2 Channel 1 in order(phase currents). For the second group, the demo only needs the BusVoltage(ADC 2 Channel 5), however, the BctuListItem configuration adds 2 unused BctuListItems(BctuListItem_3 & 4), then puts the trigger for ADC 2 Channel 5 on the BctuListItem_5.

 

Hope this can help u get to know more about the BCTU and configuration.

Regards,

Vincent

0 Kudos
Reply

151 Views
agus_idiada
Contributor III

Thanks for the answer @Vincent_Deng . Sorry but it is still not clear for me. From your answer and the documentation I got this:

The parallel conversion sequence follows this scheme:


So if I want to add 2 adc for the pre-configured BctuListItem_3 & 4 should be one from ADC0 and other from ADC1. Is this correct?

agus_idiada_0-1732535520999.png

 


Moreover, let's for example add a new channel from the ADC0 in the AdcHwUnit_0. For trigger the new channel conversion should I simply create a new AdcHwTrigger (AdcHwTrigger _5 with BCTU_EMIOS_0_4) and sync them or the AdcHwTrigger should be in order too?

agus_idiada_1-1732535541857.png

 



Tags (2)
0 Kudos
Reply

119 Views
Vincent_Deng
NXP Employee
NXP Employee

Hi @agus_idiada,

The first question you understand is correct.

The second one, if it is not the parallel conversion, no order sequence is required. For this, you might find an example in the RTD package created and built in S32Design Studio. 

 

Regards,

Vincent

0 Kudos
Reply