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.

Error in TSCADCGetFifoWordCount souce code in sdk 2.1.1.2 for am437x?

Hi,
I use idkam437x with sdk 2.1.1.2. I used to have problems with getting a number of words currently present in ADC0 fifo0 buffer. When I used TSCADCGetFifoWordCount() function with a parameter TSCADC_FIFO_SEL_0 a return value was zero. When passing TSCADC_FIFO_SEL_1 parameter, the number returned was correct. In source code of the function, the fifoSel parameter is decreased by one, what might be an error in the TSCADCGetFifoWordCount source code. Am I right?
Thanks
JJ

  • JJ,

    Do you mean below function?

    uint32_t TSCADCGetFifoWordCount(uint32_t baseAddr, uint32_t fifoSel)
    {
        /* Return the number of words present in FIFO. */
        return(HW_RD_FIELD32((baseAddr + ADC0_FIFOCOUNT(fifoSel - 1)),
               ADC0_FIFOCOUNT_WORDS_IN_FIFO));
    }

    From:

    typedef enum tscAdcFifoSel
    {
        TSCADC_FIFO_SEL_MIN = 0U,
        /**< Minimum value of enum. */
        TSCADC_FIFO_SEL_0 = TSCADC_FIFO_SEL_MIN,
        /**< TSCADC FIFO 0. */
        TSCADC_FIFO_SEL_1 = 1U,
        /**< TSCADC FIFO 1. */
        TSCADC_FIFO_SEL_MAX = TSCADC_FIFO_SEL_1
        /**< Maximum value of enum. */
    } tscAdcFifoSel_t;

    #define ADC0_FIFOCOUNT(m)                                           (0xe4U + ((m) * 0xcU))

    From AM437x technical reference menu:

    E4h ADC0_FIFOCOUNT_0

    F0h ADC0_FIFOCOUNT_1

    So, it looks to be a bug for me, the code shouldn't decrease that by 1. Let me check with developmnet team.

    Regards, Eric

  • Hi,

    Thanks for fast response.

    Yes - that is this function - as a result, FIFO0 (equal to zero) is decreased by 1 and causes a lot of problems in my case (reading from a wrong register probably).

    Regards,

    JJ 

  • JJ,

    While waiting for our dev team feedback and fix, you can remove "-1" in the code.

    Regards, Eric