accessible GPIO on s32k3

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

accessible GPIO on s32k3

3,143 Views
kamalwolly
Contributor II

I'd like to know if there's a way to add more ADC channels to the ones made available by the MBDT tool box for the S32K3, cause right now I've got only 6 available ADCs in Simulink but I'm told by the guys laying the PCBA that there's 2 ADC channels and 7 multiplexers  so all together 14 on there, same goes for the PWM, there's channel 0-7 in Simulink but I'm told, there's more than that too,

thanks  

0 Kudos
8 Replies

423 Views
LyingCake
Contributor II

Hi @RegulusCheng @mariuslucianand, were you able to figure out how to get the results from multiple adc channels within a single group? I'm facing the same issue that you found. Thanks!

0 Kudos

2,872 Views
Rosendo
Contributor I

Based on the 32-bit Arm® Cortex®-M7 S32K3 MCU in a 257 MPABGA package, the full-featured S32K3X4EVB-Q257 offers dual cores configured in lockstep mode, ASIL D safety hardware, HSE security engine, OTA support, advanced connectivity and low power?

0 Kudos

3,092 Views
mariuslucianand
NXP Employee
NXP Employee

Hello @kamalwolly,

Of course, you can configure more channels for both ADC and PWM. In the S32K3 toolbox, we have configured some channels connected to the available devices on the board like potentiometers for the ADC.

Now, the S32K3 toolbox uses an external configuration tool in order to make all the settings for the peripheral required in the application, while the MBDT blocks read the configuration and display only the information required for the selected Function. For example, the Adc_StartGroupConversion will update the Group dropdown display options with all the Groups configured in the AdcHwUnit in the external configuration tools. 

In order to add more such ADC Groups, you have to open the ADC Block, press the Configure Button and open the Adc Component. Here you can configure all the required channels from your application.

mariuslucianand_0-1641201573037.png

Once you are happy with the settings, you can save and close the external configuration tool and press the Refresh Button in the ADC block. The refresh action will read the new configuration and update the dropdowns with the new values, if any.

Two notes here:

1. The above screenshot shows the EB Tresos, but you can choose also the S32CT which comes already with our toolbox.

2. If you need more documentation related to the ADC component in the external configuration tool, please open the Adc block, press the Help button, and under Code Generation there are two links: The first one opens the RTD user manual from the RTD Driver (the framework on top of which the code is generated) and the second one opens the Adc Driver Specification of the AUTOSAR standard the mase functions we are using in the generated code.mariuslucianand_1-1641201969029.png

Hope this helps,

Marius

 

 

0 Kudos

3,045 Views
kamalwolly
Contributor II

Hello Marius, 

I am using s32 config tool.  thanks for the direction to the documentation, but except I'm missing something, it doesn't deliver any steps to help with the configuration of the pins, I am operating of the "ADC CTU" example in the toolbox which I presume is dependent on the BCTU control mode in the "S32k3 RTD ADC" documentation, I can add more ADC channels to a configured ADC hardware as shown in the  first image below, However, I do not know where to configure in the BTCU configuration tab to enable the display of the new ADC channel in the Simulink environment. 

one more thing the model "ADC stream read" wouldn't compile. it aborts with the error in the second image below. 

0 Kudos

2,957 Views
mariuslucianand
NXP Employee
NXP Employee

Hello @kamalwolly 

The usage of the S32CT/EBT allows you to access all the MCU settings and it generates the configuration files.

For each pin muxing, in the case of S32CT, you shall use the graphical pins component as shown below (while for the EBT is the Port component). The Pins component can be opened by pressing the first button on the top right-hand side. From this component, you can assign the pins to each peripheral according to your application requirements. For example:

mariuslucianand_0-1642520550715.png

The next step is to enable the channels you want to convert in the Adc tab, as you already showed us in the picture.

mariuslucianand_1-1642520933908.png

Before going further, I shall mention that the MBDT for S32K3 generates code on top of the RTD functions. And there are two types of functions in the RTD: the ones described in the ADC AUTOSAR API specification of the standard MCAL layer(e.g. Adc_StartGroupConversion), and the additional ones designed to cover the extra functionalities of the hardware, like the ones handling the BCTU.

The channels you are adding will not be displayed in our toolbox because the API for the conversions deals with groups. Instead, the channels have to be added inside a group, and you can start conversion for a particular group (please see the s32k344_adc_single_read_s32ct example) even in particular one group can contain only one channel.

Because you have mentioned that you want the BCTU to start the conversions, well, I strongly suggest starting by our s32k344_adc_ctu_ebt. Since the 1.1.0 release, you can open, see how the blocks are being used to trigger such conversions, even you don't have EBT installed. You shall enable the ADC to be controlled by the BCTU using the Adc_EnableCtuControlMode, then you start the conversion of a particular trigger (of course, set in the S32CT).

Each trigger can command either a LIST or a single channel and can store the results either directly in the BCTU_ADC_Data_REGs or inside some FIFOs. In case you are using lists, then you can convert up to 3 channels at the same time, of course, if they belong to different ADC HW instances.

For example, in the below settings, the internal Trigger 2 stores the results inside the ADC Data regs, and starts conversion for a list, on the instances (ADC_2 and ADC_1, because of the Adc TargetMask being 0b110 - on the ADC_0 is disabled) starting from the Conversion List Index 0.

mariuslucianand_0-1642528018004.png

The Bctu List can be seen below. It will start the ADC_2 CH S10 and the ADC_1 Channel S19, and then the triggers will stop, because of the second idem marked as "Last channel"

mariuslucianand_1-1642528188095.png

Unfortunately, for understanding the error's source, you have to send me the entire log. The build process creates multiple threads to build sources files in parallel, so the error is somewhere in the log above the part you have attached to us.

Regards,

Marius

0 Kudos

840 Views
RegulusCheng
Contributor III

Hi, Marius

I noticed that you said "particular one group can contain only one channel" about AdcReadGroup function, dose it meas that if I need obtain 5 channels' ADC conversing data, I need to put 5 channels into 5 different groups?

Regards,

Regulus

 

0 Kudos

827 Views
mariuslucianand
NXP Employee
NXP Employee

Hello @RegulusCheng 

What I was referring to in the response above is that the MBDT ADC conversion block handles groups of channels and not individual ADC channels. Depending on your application, the conversion results might be required at some particular moment in your application execution, and conversions start at different moments in time, which dictates if you need to distribute the channels into one single group or different groups.

To answer your question, you could group all 5 channels into a single group. When you start the group conversion, ADC will convert all 5 channel values sequentially and when the last one is converted, you will be notified and ready to read the results.

Please describe your application requirements for future suggestions.

Regards,
Marius

 

0 Kudos

809 Views
RegulusCheng
Contributor III

Hi, Marius

Thanks for your reply. 

I am working with MCSPTE1K344 EVB, however, I just use the S32K3X4EVB-Q172 part.

I'm just starting to get familiar with the board and try to tune the various resources.
I want to put five channels in a group, but I find that the Adc_ReadGroup module output is a one-dimensional Uint16 data, I can only get the first channel in the group conversion result, if I want to get all channels conversion result, what should I do? I tried to output the result to a Uint16*3 Data Store Memory, but Simulink reported an error and said the dimensions did not match. I also noticed that the SetGroupBuffer module can only accept a Uint16 input.

Regards,

Regulus

0 Kudos