Hi,
So, I tried to reproduce your solution. For the configuration in PE the only difference with what I tried previously is the PDB trigger channel, I used the CH0 instead of the CH1. Others I think I did correct.
PDB is configured with prescaler 128. divider 10, modulus 46875 (1000ms = 1s), Continuous, interrupt delay 65535 (1398ms) as I don't need I think, Load immediate.
My ADC is set for 2 channels so far, 12bits, 4 clocks periods, 16 conversions, 51.2us conversion time. Configuration was working fine with my solution.
Now I changed the trigger for PDB as you mentioned, updated the interrupt routine by just read back the result with the method provided.
For the init of ADC and PDB I do so:
| EventStruct.ADC1_UserDatas.DeviceDatas = AD1_Init(&EventStruct); |
| if (AD1_SelectSampleGroup(EventStruct.ADC1_UserDatas.DeviceDatas, 0) != ERR_OK) |
printf("Failed AD1_CreateSampleGroup\n");
| | //; /* Prepare ADC to be ready for measure on trigger */ |
| if (AD1_StartLoopTriggeredMeasurement(EventStruct.ADC1_UserDatas.DeviceDatas) != ERR_OK) |
printf("Failed AD1_StartLoopTriggeredMeasurement in hwtimer_task\n");
In your code example at the end of that you use the following routine that I cannot find or add, either the include of "PDB_PDD.h":
PDB_PDD_SoftwareTrigger(PDB0_DEVICE); /* Create SW trigger to start PDB which is selected as trigger source for ADC */
Result is that it doesn't work, it doesn't go into the interrupt and if I stop the execution I can see in the ADC registers RA/B that no measurement have been performed.
Can you help me with that ?
BR
-stéphan-