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.

Wrong value when reading adcRAM1 in RM48 USB Stick Development Kit

Other Parts Discussed in Thread: HALCOGEN

I want to read the adc conversion values directly un adc RAM Memory.

In RM48 USB Stick Development Kit, I selected pin 9 for light sensor and pin 8 for temp sensor.

I use HCG for the configuration and the drivers.

In C language, with the HCG Drivers I got the following result:

Light:          from 0x47 to 0x3EA                         the value changes when the sensor is enlightened

Temp:         from 0x21C to 0x21C                                             the value does not change

 

When I read directly the values in ADCRAM1 I got the following result:

Light:           from  0x61 to  0x6F                         the value does not change when the sensor is enlightened

Temp:         from 0x12B to 3A4                           the value changes when the light sensor is enlightened

 

Address of the result of Light sensor in memory: 0xFF3E0010

Address of the result of Temp sensor in memory: 0xFF3E0014

Resolution 10 bits, adcGroup1

Thanks for your help

  • Jerome,

    Can you please send your code for reading conversion results from the ADC RAM directly? Please also include the setup code for the ADC module.

    Regards, Sunil

  • Sunil,

    Thanks a lot for your answer.

    Yes, you are right so the address is the following: (instead of I wrote before)

    Address of the result of Light sensor in memory: 0xFF3E0014

    Address of the result of Temp sensor in memory: 0xFF3E0010

    But another thing is confusing about the resolution of adc converter:

    I choose 10 bits of resolution in HCG configuration. With the driver HCG the result are coded on 10 bits but in the adcRAM1 the result is coded on 12 bits and it’s why the comparison does not match.

    Regards Jerome

     

     

  • Hi Jerome,

    The ADC core can be configured to be operating in either a 10-bit resolution mode (default) or a 12-bit resolution mode. This is controlled by the 10/12-BIT field of the ADC Operating Mode Control Register.

    When the ADC is configured for 10-bit resolution using this control field, only 10 bits of the conversion result are available in the results' memory. Conversely when the ADC is configured for 12-bit resolution, the results' memory will always hold the entire 12-bit conversion result.

    When reading from the FIFO interface to the ADC results' memory (HALCoGen uses this method), you can choose to either read the full 12-bit result, or a 10-bit result, or an 8-bit result. This is achieved by the FIFO interface by shifting right the required number of least significant bits. No post-processing is required by the application. You can also choose to read the channel id along with the conversion result, if needed by the application.

    This automatic shifting and channel id masking are not available when you access the conversion results directly from the results' memory. That is, you will always read the full conversion result and the associated channel id.

    Regards, Sunil

  • Hi Sunil,

    Thanks a lot, it's clear now for me

    Regards