Hello everyone, I'm using S32K312 microcontroller and I want continuos conversion mode ADC for multi channel but I didnt activate CC(Continous conversion) mode. How can I activate CC mode ? Or, have S32K312 CC mode ?( I wasnt sure because Ref manual say to MC have these mode but I didnt see enable button(for s32ds ) or enable value on struct to firmware.
#adc #s32k312
已解决! 转到解答。
Yes, the S32K312 microcontroller does support continuous conversion mode for ADC. You can enable it by setting the ADC_CFG1[ADLPC] bit to 1. This will enable the low power configuration and continuous conversions.
Here is a code snippet that shows how you can enable continuous conversion mode:
ADC0->CFG1 |= ADC_CFG1_ADLPC_MASK; // Enable low power configuration ADC0->SC3 |= ADC_SC3_ADCO_MASK; // Enable continuous conversion
Also, if you want to use multiple channels in continuous conversion mode, you need to use the ADC's hardware trigger feature. You can set up a periodic timer interrupt to trigger the ADC conversion for different channels.
Here is a code snippet that shows how you can set up a hardware trigger:
ADC0->SC2 |= ADC_SC2_ADTRG_MASK; // Enable hardware trigger
Then, in your timer interrupt handler, you can select the ADC channel to be converted:
ADC0->SC1[0] = ADC_SC1_ADCH(channel); // Select ADC channel
Remember to replace 'channel' with the actual channel number you want to convert.
Thanks for your response. I have one more question. How can I set up a periodic trigger. I tried to do it with PIT but failed. Also, when I want to use multichannel, do I set each channel separately?
there is a demo you can refer to:
Please ignore ramprakash08's answer, this should be an AI.
This routine is based on S32K344, there should be no problem,If there is a problem, please describe your problem in detail