s32k144 hw trigger multi-channel adc issue

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

s32k144 hw trigger multi-channel adc issue

900件の閲覧回数
alice_thanks
Contributor III

alice_thanks_0-1701222900596.png

i modify the example Hardware trigger adc, to two channel or multi-channel, but it doesn't work with 2 channels, could you help to check it, thanks!

ADC_DRV_ConfigConverter(ADC_INSTANCE, &adConv1_ConvConfig0);
ADC_DRV_AutoCalibration(ADC_INSTANCE);
ADC_DRV_ConfigChan(ADC_INSTANCE, 0UL, &adConv1_ChnConfig0);
ADC_DRV_ConfigChan(ADC_INSTANCE, 1UL, &adConv1_ChnConfig1);
IRQn_Type adcIRQ;

switch(ADC_INSTANCE)
{
case 0UL:
adcIRQ = ADC0_IRQn;
break;
case 1UL:
adcIRQ = ADC1_IRQn;
break;
default:
adcIRQ = ADC1_IRQn;
break;
}

INT_SYS_InstallHandler(adcIRQ, &ADC_IRQHandler, (isr_t*) 0);

/* Calculate the value needed for PDB instance
* to generate an interrupt at a specified timeout.
* If the value can not be reached, stop the application flow
*/
if (!calculateIntValue(&pdly1_InitConfig0, PDLY_TIMEOUT, &delayValue))
{
/* Stop the application flow */
while(1);
}
/* Setup PDB instance
* - See PDB component for details
* Note: Pre multiplier and Prescaler values come from
* calculateIntValue function.
*/
PDB_DRV_Init(PDB_INSTANCE, &pdly1_InitConfig0);
PDB_DRV_Enable(PDB_INSTANCE);
PDB_DRV_ConfigAdcPreTrigger(PDB_INSTANCE, 0UL, &pdly1_AdcTrigInitConfig0);
PDB_DRV_ConfigAdcPreTrigger(PDB_INSTANCE, 1UL, &pdly1_AdcTrigInitConfig1);
PDB_DRV_SetTimerModulusValue(PDB_INSTANCE, (uint32_t) delayValue);
PDB_DRV_SetAdcPreTriggerDelayValue(PDB_INSTANCE, 0UL, 0UL,
(uint32_t) delayValue);
PDB_DRV_SetAdcPreTriggerDelayValue(PDB_INSTANCE, 1UL, 1UL,
(uint32_t) delayValue/2);
PDB_DRV_LoadValuesCmd(PDB_INSTANCE);
PDB_DRV_SoftTriggerCmd(PDB_INSTANCE);

/* Enable ADC 1 interrupt */
INT_SYS_EnableIRQ(adcIRQ);

0 件の賞賛
返信
8 返答(返信)

881件の閲覧回数
alice_thanks
Contributor III

can anybody help for this case, i search this link:

https://community.nxp.com/t5/S32K/ADC-interrupt-and-channel-number/m-p/1295265

follow it, it also not correct, there is obvious mistake is 

PDB_DRV_ConfigAdcPreTrigger(PDB_INSTANCE, 4UL, &pdly1_AdcTrigInitConfig1);
 
 
0 件の賞賛
返信

869件の閲覧回数
Robin_Shen
NXP TechSupport
NXP TechSupport

Why wouldn't you refer to the working example in the link I gave? Is it because you don’t want Figure 46-1. Example: PDB0 CH0 back-to-back chain and Table 46-6. PDB-ADC back to back connection of S32K1XXRM? (Want the ADC sampling at specified time?)
Please test attached modified project.

0 件の賞賛
返信

826件の閲覧回数
alice_thanks
Contributor III

hello @Robin_Shen 

thanks , i tested your attached code, it works,

how to calculate this delay time , is it depend the channel sample time?

PDB_DRV_SetAdcPreTriggerDelayValue(PDB_INSTANCE, 0UL, 0UL,
(uint32_t) delayValue/8);//delayValue);
PDB_DRV_SetAdcPreTriggerDelayValue(PDB_INSTANCE, 0UL, 1UL,//1UL, 1UL,
(uint32_t) delayValue/2);

and also i follow your link to creat back to back project without DMA,

first it can works serval times, then can't enter the irq, please help to check it, whether some parameter setting wrong ? thanks a lot for your help!

ch=0,adcValue=3.770752
ch=1,adcValue=1.954346
ch=2,adcValue=1.837158
ch=3,adcValue=1.690674
ch=4,adcValue=1.649170
ch=5,adcValue=1.630859
ch=6,adcValue=1.741943
ch=7,adcValue=1.721191
ch=8,adcValue=1.662598
test_adc
ch=0,adcValue=3.767090
ch=1,adcValue=2.634277
ch=2,adcValue=1.936035
ch=3,adcValue=1.690674
ch=4,adcValue=1.649170
ch=5,adcValue=1.630859
ch=6,adcValue=1.741943
ch=7,adcValue=1.721191
ch=8,adcValue=1.662598
test_adc
test_adc
test_adc
test_adc
test_adc
test_adc
test_adc
test_adc 

0 件の賞賛
返信

814件の閲覧回数
Robin_Shen
NXP TechSupport
NXP TechSupport

Please refer to the discussion in Sequence Error with FTM-PDB-ADC Triggering

0 件の賞賛
返信

883件の閲覧回数
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi

Have you already referred to Example S32K144 PDB ADC DMA S32DS.ARM.2018.R1?


Best Regards,
Robin
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 件の賞賛
返信

878件の閲覧回数
alice_thanks
Contributor III

@Robin_Shen 

https://community.nxp.com/t5/S32K/ADC-interrupt-and-channel-number/m-p/1295265

this what i need , but the solution doesn't work, as said above reply

0 件の賞賛
返信

862件の閲覧回数
alice_thanks
Contributor III

@Robin_Shen 

can you help for this case, thanks

タグ(1)
0 件の賞賛
返信

856件の閲覧回数
Robin_Shen
NXP TechSupport
NXP TechSupport

Have you tested the modified program I attached? I changed some points based on your project.

0 件の賞賛
返信