Read multiple analog signals. S32k396

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Read multiple analog signals. S32k396

跳至解决方案
1,331 次查看
MaMM
Contributor III

Hello.

I am reading the potentiometer input present on the S32X-MB via the PTD1 input (P0_ChanNum0). Now, I am configuring, within the same signal group, the reading of the next input (PTD0, which corresponds to P1_ChanNum1) by reading a bus in Simulink. To do this, I have added another signal in the same group and assigned it the appropriate pin number in the PORT. When running the code, I observe an analog signal on the variable Group0_Channel0 (via Freemaster), but a zero on the Group0_Channel1 signal, which indicates that either the input is not being initialized correctly, it is not being read, or I am not accessing it correctly using a demux in Simulink.

 

 

Simulink read.pngConfig_new_channel.png

Port_new_channel.png

Any idea?

Thanks

标签 (1)
标记 (1)
0 项奖励
回复
1 解答
1,268 次查看
Irina_Costachescu
NXP Employee
NXP Employee

Hello @MaMM 

You have mentioned in your previous posted that you have added the new signal in the same group, however the attached image shows only its enablement inside the AdcHwUnit settings. Could we please double check if the additional channel has also been added to the Adc0Group_0 - AdcGroupDefinition?

 

adc.png

Thanks,

Irina

在原帖中查看解决方案

0 项奖励
回复
5 回复数
1,308 次查看
MaMM
Contributor III

Hello Irina. Thanks for your response.

As you mentioned, on the MB, the pin is P17[5]. Anyway, even if nothing is connected, it should still be providing a reading. Currently, the value read is always zero, which makes me think that something is missing in the initialization. That is, some configuration might be needed to indicate that there are two signals instead of one, or something along those lines. It seems like the data is not being loaded at that position, and as a result, it constantly reads zero.

In any case, I have wired the signal to the other input (which goes to P19[1]), and obviously, nothing is displayed.

Any idea if something might be missing?

 

0 项奖励
回复
1,269 次查看
Irina_Costachescu
NXP Employee
NXP Employee

Hello @MaMM 

You have mentioned in your previous posted that you have added the new signal in the same group, however the attached image shows only its enablement inside the AdcHwUnit settings. Could we please double check if the additional channel has also been added to the Adc0Group_0 - AdcGroupDefinition?

 

adc.png

Thanks,

Irina

0 项奖励
回复
1,250 次查看
MaMM
Contributor III

Hello Irina,

Thanks for the information. You were right; that part was missing. Now it works perfectly!

Anyway, is there any kind of user manual for the tool that includes configuration examples? That way, we wouldn’t have to ask these kinds of questions all the time.

Currently, based on the examples, we configure our needs, but sometimes a configuration is missing, as has been the case.

BR.

0 项奖励
回复
1,236 次查看
Irina_Costachescu
NXP Employee
NXP Employee

Hi @MaMM 

MBDT integrates the RTD (Real-Time Drivers) for configuration and access to the hardware (peripherals, pins, clocks, interrupts). For more details on configuration parameters, and functions implemented by our blocks, you could check the RTD User Manual for the component you would like to use, and also the AUTOSAR driver standard (RTD MCAL layer is AUTOSAR compatible).

For the ADC, and other blocks as well, you could access this documentation I am referring to by clicking on the Help button of the Simulink block, and navigating to the Code Generation section, like illustrated below

adchelp.png

For configuration examples, you could check the configuration projects that we are delivering together with our application examples. 

Moreover, in case of the ADC, PWM, CAN, UART and DIO, we have also put together some articles on our MBDT NXP Community, that provide a more detailed insight into the available parameters, and settings. Maybe you would find them useful as well. Here is the link to the ADC one, but the others are available under the Beginner's Guide for Model-Based Design Toolbox section on our main page.

Hope this helps you. Please let us know in case additional information is required.

Thanks,

Irina

0 项奖励
回复
1,316 次查看
Irina_Costachescu
NXP Employee
NXP Employee

Hello @MaMM 

From the description provided, your software configuration seems complete - adding the additional Adc Channel to the group, and inside the corresponding Adc Hw Unit should be enough. Also, the Simulink implementation should provide the correct results, as I have just tested the implementation on my end as well.

Could you please check the hardware connections for this use case? As far as I see from the schematics, PTD0, on the EVB, is routed to the J56B[87] pin. On the MB, the J56B[87] pin is labeled as PBC_GPIO[22], accessible on the PortBC[5] pin. Hence, your signal to be converted needs to be fed to PortBC[5], unless other hardware modifications were made to this default setup.

Hope this helps,

Irina

0 项奖励
回复