ADC HardWare Trigger Using PDB Autosar mode

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

ADC HardWare Trigger Using PDB Autosar mode

1,616 Views
Anthony_PAT_EFI
Contributor II

Hello everyone,

I come here because after a lot of tries, I cannot successfully trigger the sampling of the ADC with the PDB using the MCALs drivers.

What I have:

  • I'm using an S32K144 demoboard
  • I program it with S32DS using the SDK for easier configuration of the driver

What I want:

  • Let's say I want to sample 3 channels with the ADC0 at 10kHz
  • I would like to trigger the samples with the PDB, but each channel is triggered with its specific timing

For exemple, if the PDB counter goes from 0 to 8000 ; I would like the ADC0CH0 to be triggered when the counter value is 2000, ADC0CH1 at 4000 and ADC0CH2 at 6000.

The idea is then to program those timings dynamically so that we can change the moment when the samples are done.

 

Could you help me setting up all of this? For now, after my tries, I could trigger the ADC using the GPT MCAL with the LPIT0 timer but all the samples are done at the same time, I cannot add a delay between them.

 

I saw this topic in the forum: https://community.nxp.com/t5/S32K/How-to-config-PDB-in-S32K144-using-MCAL/m-p/1722130

But I can't open the project since it seems it hasn't been done with S32DS, or at least not with the config tool I'm using (I need a .mex file in the project)

Thank you for your time

0 Kudos
Reply
8 Replies

1,463 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@Anthony_PAT_EFI

I made a PDB trigger ADC routine with reference to "Adc_example_S32K144", you can refer to it.

The hardware is S32K144EVB and RTD Version is 1.0.1.

10K = 48MHz/4800

Senlent_0-1733732284463.png

PDB delay time:

Senlent_1-1733732326919.png

 

0 Kudos
Reply

1,451 Views
Anthony_PAT_EFI
Contributor II

Hello! Thank you for your work and your example

This almost exactly what I need!

It misses the part where you can change the PDB delay time from the code. 

Do you have any example to do it pls?

0 Kudos
Reply

1,404 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@Anthony_PAT_EFI

I did not find any API to adjust PDB Delay in the API provided by MCAL.

The PDB Delay setting is determined when the ADC is initialized.

If you need to modify the PDB configuration, I think it may be easier to use bare metal code.

0 Kudos
Reply

1,334 Views
Anthony_PAT_EFI
Contributor II

Ok thank you, I'll deal with this

1,577 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@Anthony_PAT_EFI

This demo is made base on RTM 4.0.1 and S32 DS V3.4.

FTM to trigger PDB through TRGMUX and PDB pre-trigger ADC to sample.

You can refer to it and let me know if you have any questions about the demo.

0 Kudos
Reply

1,563 Views
Anthony_PAT_EFI
Contributor II

Hello !

Unfortunatly, this project has been done for S32k116! I'm using a S32K144 which doesn't have the MCAL named PDB (or something like this) so I can't use the project you gave me
In the SDK, there is the Low Level driver PDB but I'd like to use only High Level Driver.

 

Do you have the same example but for the S32K144? Pls

0 Kudos
Reply

1,548 Views
Senlent
NXP TechSupport
NXP TechSupport

Hi@Anthony_PAT_EFI

I guess you are using the RTD driver of S32K1,right? Your previous reply was a bit confusing for me, because S32K1 provides two SDKs: RTM and RTD

 

This pacakge made base on RTD1.0.1 and with S32K148 used, you can refer to it.

https://community.nxp.com/t5/S32K/S32K148-RTD-Example-Use-cases-Projects/m-p/1633067#M22078

After you download this package, you may find below demos and you can refer to hightlight demo.

Senlent_0-1733364567527.png

 

0 Kudos
Reply

1,494 Views
Anthony_PAT_EFI
Contributor II

Hello!
Thank you for your answer.
Thank you also for the package you gave me it can be really helpful for the following project. However, in the example you highlighted, we indeed use everything I asked except the part where we can change dynamically the PDB timings.

Do you have any other example about this? Or maybe make one?

I could see on the web that I'm not the only one asking for this so it can help more than one

Thank you

0 Kudos
Reply