Jonathan Vervaeke

RT1064 fsl_kpp driver bug (?)

Discussion created by Jonathan Vervaeke on Aug 27, 2019
Latest reply on Aug 28, 2019 by jeremyzhou

Hi, 

Experimenting with the fsl_kpp driver from the SDK_2.x_EVK-MIMXRT1064 2.6.1 package.

 

The keypad driver contains the following example:

in boards/evkmimxrt1064/driver_examples/kpp/kpp.c:

KPP_keyPressScanning(EXAMPLE_KPP, &read_keys[0], CLOCK_GetFreq(kCLOCK_CpuClk));

 

in devices/MIMXRT1064/driver/fsl.kpp.c:

static void KPP_Mdelay(uint64_t tickets)
{
   while (tickets--)
   {
      __NOP();
   }
}
void KPP_keyPressScanning(KPP_Type *base, uint8_t *data, uint32_t clockSrc_Hz)
{
...
   /* Take 100us delays. */
   KPP_Mdelay(clockSrc_Hz / 10000000);
}

For clockSrc_Hz, the parameter is 600'000'000 (so 600MHz which is the clockspeed)

The tickets parameter becomes 60 (600'000'000 / 10'000'000)

 

When I measure this delay, I get 980 ns delay instead of 100us (~100x smaller)

 

What am I missing here? I this a bug in the kpp driver?

 

 

 

plot of the keyPressScanning function (yellow is column, green is the row):

Outcomes