How to configure SDADC data valid output as input of ETPU

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

How to configure SDADC data valid output as input of ETPU

1,406 Views
tranvantamhp92
Contributor I

Hello NXP talents,

I'm working with SDADC and ETPU modules of MPC5777C MCU. I have created my application based on the examples: Example MPC5777C-eTPU_GPIO_test GHS714  , https://community.nxp.com/docs/DOC-330909 .

In my application, the SDADC_2 data valid event output is configured as input of ETPUB channel 10. I expect the util_etpu_gpio_pin_history() function will return 1 when the Data Valid Flag is 1, but the util_etpu_gpio_pin_history() function always return 0.

The below is my code:

void SDADC2_Init(void)
{

/* Divider 64 for SD_CLK (max 16MHz, min 4MHz) i.e.264/64 = 4.125MHz */
SIU.SDCLKCFG.R = 0x0000003F;
/* enable SDADC in the single-ended mode */
SDADC_2.MCR.R = 0x00000003;
/* INP (positive terminal) = AN[0]
INM (negative terminal) = VREFN */
SDADC_2.CSR.R = 0x0;
/* set output settling delay to max */
SDADC_2.OSDR.R = 0xFF;
/* FIFO 16 words deep, enabled */
SDADC_2.FCR.R = 0x107;
/* Enable data valid event output */
SDADC_2.RSER.R = 0x00000004;
/* send key to reset ADC to start sampling */
SDADC_2.RKR.R = 0x5AF0;
}

void main (void)
{
vint32_t counter = 0;
vint32_t error_code;
vuint32_t dataValidFlag = 0;

HW_init();
Interrupts_init();
Interrupts_enable_Core0();

/* initialize pad */
SIU.PCR[ETPUB10_pin].R = (ALT1 | IBE | WPE | WPS) ;
/* Config the SDADC_2 data valid output is input of ETPUB channel 10 */
SIU.SDETPUB.B.CH10 = 1;

/* initialize ICF filter, otherwise input does not pass to the module */
IGF_1.FILTER[27].MCR.B.FGEN = 1;

/* initialize eTPU hardware */
fs_etpu_init (my_etpu_config, (uint32_t *) etpu_code, sizeof (etpu_code),
(uint32_t *) etpu_globals, sizeof (etpu_globals));

/* initialize eTPU channels */
error_code = fs_etpu_gpio_init (GPIO10_B, FS_ETPU_PRIORITY_MIDDLE);

/* enable all timebases */
fs_timer_start ();
/* Init SDADC_2 */
SDADC2_Init();
/* waiting for data valid flag is set */
while(((dataValidFlag == 0)))
{
validDataFlag = SDADC_2.SFR.R & 0x4;
}
Delay(1000);

fs_etpu_gpio_input_immed(GPIO10_B);
pinstate = util_etpu_gpio_pin_history(GPIO10_B);

while(1);

}

May I have something wrong, could you help me to check it?

Thanks and regards,

Thanh.

Tags (3)
3 Replies

1,150 Views
davidtosenovjan
NXP TechSupport
NXP TechSupport

HI, I have just test it and I think this routing between SDADC and eTPU actually is not implemented.

Only following SDADC related registers are present in the SIU chapter and none of them are connecting 'valid data available' signal. I am checking it with the factory, either the register is missing in the document or the feature is not implemented and it needs to be removed from the documentation.

pastedImage_1.png

pastedImage_4.png

pastedImage_3.png

pastedImage_5.png

I will keep you informed.

1,150 Views
tranvantamhp92
Contributor I

Dear David,

Thanks you for supporting :smileyhappy:.

Did you check for "Conversion limit detection watchdog" signal? Is it ok?..I have configured this signal to be input of ETPU channel, but the ETPU channel state always be 0, the behavior is the same the "Data valid" signal case.

SDADC_ETPU.png

Regards.

0 Kudos
Reply

1,150 Views
davidtosenovjan
NXP TechSupport
NXP TechSupport

You are right, this does not work to me as well. I will try to check it with the factory, if there is anything else needed to configure. Currently I don't know the reason. I will return to you as soon as possible.

0 Kudos
Reply