This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

RM57L843: questions about ADC FIFO

Part Number: RM57L843
Other Parts Discussed in Thread: HALCOGEN

Recently I am learning to use the ADC, and there are some parts I don't understand.

Question:

  1. In case that ADC RAM Overrun ignore is enabled, when ADC is already overwriting RAM from the start point, what I will get if I read FIFO at this time? The data from the location that is overwritten, or just the oldest data in the RAM?
  2. Can I comprehend the FIFO as a circular buffer? which means that it always gives me the oldest data first. If one element in the buffer is overwritten, the read location points to the next data, leaving the new overwritten data as the newest.
  3. The ADC FIFO has an address range. But the TRM says I can access any of it for data. Did it means that:
    1. If I read one word, I can choose any address in range. (In HALCoGen generated code, it corresponds to BUF0~BUF7 register. )
    2. If I read multiple words using instruction LDM or memcpy function, I can cover all the addresses, and the ADC will automatically give me at most 8 results sequentially.
  • Hello,

    If the OVR_RAM_IGN bit in MODECR is set, then the ADC module ignores the contents of the group’s results’ memory and wraps around to overwrite the memory with the results of new conversions. If the OVR_RAM_IGN bit is not set, then the application program has to read out the group’s results’ memory upon an overrun condition; only then can the ADC continue to write new results to the memory.The conversion result that got stored first gets read first

    1. So it will read the oldest data

    2. Yes, you always get the oldest data first.

    3. Will check this

  • Thank you for the reply. Looking forward to the answer to the third question.
  • Hello,

    1. If I read one word, I can choose any address in range. (In HALCoGen generated code, it corresponds to BUF0~BUF7 register. )

    QJ> You can use any buffer (BUF0~BUF7) to read the data. The data you read out is the oldest data. In this example, channel 4,7,and 8 are selected for conversion group 1, and the conversion results are stored in the group1 memory. Channel 4 data is stored first (memory slot #0, address offset is 0x0), then channel 7 (memory slot #1, address offset is 0x4), and channel 8 (memory slot #2, address offset is 0x8). In continuous mode, the next conversion data of channel 4 will be stored in memory slot #3. In single conversion mode, the next conversion data of channel 4 will be stored in memory slot #0. We are not able to read data in slot #2 before reading slot#0 and slot #1.

    2. If I read multiple words using instruction LDM or memcpy function, I can cover all the addresses, and the ADC will automatically give me at most 8 results sequentially.

    QJ> Using LDM, you can read at most 8 results at a time.

    asm(" push {r0, r1-r12}");

    asm(" ldr r0, addr_value");

    asm(" ldm r0!, {r2-r8}");

    asm(" pop {r0, r1-r12}");

     

  • Hello,

    Using memcpy, you can read as many bytes as you can. This example reads 18 words. The group1 memory region is defined as 40 words.

           memcpy(adc1_data, 0xFF3E0040, 4*18);  //0xFF3E0040 is memory start address for group1 in MibADC1 RAM

  • Thank you for the detailed reply.