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
On EB tresos I configured the adc and pin port.
Can you please give me support on this and tell me what is missing or wrong in the config?
Thanks, Agustin.
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
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.
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).
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
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?
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?
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