2066753_en-US

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

2066753_en-US

2066753_en-US

s32k312: ADC FIFO (ADC0 and ADC1)

Hi, I'm trying to better understand how ADC FIFO works. I was able to make the 'S32K312 PIT BTCU parallel ADC FIFO DMA DS3.5 RTD300' example working on sdk5.0.0. I was then trying to modify it as I have ADC1 and ADC0 using different number of channels :

ADC0

PaoloRB_0-1742772415846.png

ADC 1

PaoloRB_1-1742772440131.png

I created two trigger event with same pit source and two DMA channels (one for FIFO1 and the other for  FIFO2). BTCU has been set as following:

PaoloRB_2-1742772519962.pngPaoloRB_3-1742772532333.png

The code compile and both callback functions are called: 

void BctuWatermarkNotif_2(void)

{

result2[0] = (uint16_t) (BctuDmaFifo2[0]&0xFFFF)>>3;


val2[0] = ((float) result2[0]/ adcMax) * (ADC_VREFH - ADC_VREFL);


result2[1] = (uint16_t) (BctuDmaFifo2[1]&0xFFFF)>>3;

val2[1] = ((float) result2[1]/ adcMax) * (ADC_VREFH - ADC_VREFL);


result2[2] = (uint16_t) (BctuDmaFifo2[2]&0xFFFF)>>3;

val2[2] = ((float) result2[2]/ adcMax) * (ADC_VREFH - ADC_VREFL);


}


void BctuWatermarkNotif_1(void)

{

result1[0] = (uint16_t) (BctuDmaFifo1[0]&0xFFFF)>>3;


val1[0] = ((float) result1[0]/ adcMax) * (ADC_VREFH - ADC_VREFL);


result1[1] = (uint16_t) (BctuDmaFifo1[1]&0xFFFF)>>3;

val1[1] = ((float) result1[1]/ adcMax) * (ADC_VREFH - ADC_VREFL);


result1[2] = (uint16_t) (BctuDmaFifo1[2]&0xFFFF)>>3;

val1[2] = ((float) result1[2]/ adcMax) * (ADC_VREFH - ADC_VREFL);


result1[3] = (uint16_t) (BctuDmaFifo1[3]&0xFFFF)>>3;

val1[3] = ((float) result1[3]/ adcMax) * (ADC_VREFH - ADC_VREFL);

}


but valx[] array does not contain correct values, look like they are shifting.


here some screenshot:

PaoloRB_4-1742772810422.png

I have attached the source code.

Can you please provide some information about how fix it ?


Can I use a single FIFO when adc0 and 1 use a different number of channels?


Thanks in advance.


regards


Re: s32k312: ADC FIFO (ADC0 and ADC1)

Hi@PaoloRB

1.I have checked your code , the watermask value is wrong in your code.

Please refer to below modification.

Senlent_0-1742796286800.pngSenlent_1-1742796303992.png


2.Can I use a single FIFO when adc0 and 1 use a different number of channels?

Yes, this can be done via "Adc Target Mask", for example, in your case, you can set i to 0b011,

then adc0 and adc1 will be work in parallel and trigger on same trigger source and the data

can be save to fifo1 or fifo2 as you like.

Tags (1)
No ratings
Version history
Last update:
‎11-21-2025 01:49 PM
Updated by: