AnsweredAssumed Answered

Problem with LPIT

Question asked by HARI KRISHNA KAPPARAPU on Oct 1, 2018
Latest reply on Oct 8, 2018 by raul10

I am using LPIT Timer Channel 0 of S32K148.

Seeing some sort of data misalignment with below example.

 

while(1) {

  uint32_t counterValue[20];

   for (uint32_t cnt = 0; cnt < 20; cnt++)

     counterValue[cnt] = *(volatile uint32_t*)0x40037024;

   for (uint32_t cnt = 0; cnt < 19; cnt++) {

     if (counterValue[cnt] < counterValue[cnt+1]) {

       DEBUG_PRINT_MSG ( "%010u (%02d) %010u (%02d)\n\r", counterValue[cnt], cnt, counterValue[cnt+1], cnt+1 );

     } else {

       DEBUG_PRINT_MSG ( "%010u (%02d)\n\r", counterValue[cnt], cnt);

    }

  }

}

Ideally the code shouldn't be reaching to the bold highlighted print message. Is there any reason why this can happen?

Below is the misaligned data observed through these buffer contents as reference.

 

4032996922 (00)
4032996918 (01)
4032996915 (02)
4032996927 (03)
4032996908 (04)
4032996905 (05)
4032996901 (06)
4032996898 (07)
4032996894 (08)
4032996891 (09)
4032996888 (10)
4032996884 (11)
4032996881 (12)
4032996877 (13)
4032996874 (14)
4032996871 (15)
4032996867 (16)
4032996864 (17)
4032996860 (18)

 

My SDK version is 2018.R1Beta 2.9.0

 

Timer initialization structure is here:

 

        /* lpit_user_config_t */
        {
            false,                                  /* enableRunInDebug       */
            false                                   /* enableRunInDoze        */
        },
        /* lpit_user_channel_config_t */
        {
            LPIT_PERIODIC_COUNTER,                  /* timerMode              */
            LPIT_PERIOD_UNITS_COUNTS,               /* periodUnits            */
            MAX_PERIOD_COUNT,                       /* period                 */
            LPIT_TRIGGER_SOURCE_INTERNAL,           /* triggerSource          */
            0U,                                     /* triggerSelect          */
            false,                                  /* enableReloadOnTrigger  */
            false,                                  /* enableStopOnInterrupt  */
            false,                                  /* enableStartOnTrigger   */
            false,                                  /* chainChannel           */
            false                                   /* isInterruptEnabled     */
        },

 

Thanks,

Hari

Outcomes