AnsweredAssumed Answered

How to use OTFAD function in K81

Question asked by xiong hua chun on Apr 25, 2017

hello:

   I 'm trying to configure OTFAD in my own code,which is ported from NXP_Kinetis_Bootloader_2_0_0.But when I read data from flash after enable OTFAD,it is the same as the data before enable OTFAD.I don't know why.See annex for test code.

 

  OTFAD all register values are as follows.

   OTFAD_CR is 0x80000000

   OTFAD_SR is 0x20000040

   OTFAD_CRC is 0x00000000

   OTFAD_CTX0_KEY_W0 is 0x03020100

   OTFAD_CTX0_KEY_W1 is 0x07060504

   OTFAD_CTX0_KEY_W2 is 0x0b0a0908

   OTFAD_CTX0_KEY_W3 is 0x0f0e0d0c

   OTFAD_CTX0_CTR_W0 is 0x67452301

   OTFAD_CTX0_CTR_W1 is 0xefcdab89

   OTFAD_CTX0_RGD_W0 is 0x68080000

   OTFAD_CTX0_RGD_W1 is 0x680fffff

 

   the test code result is as follows.

   enable interrupt
   Read Before Enable OTF
   0x55 0xaa 0xcc 0x44 0x5a 0xa5 0x4c 0xc4 0x53 0x30 0x2d 0x55 0x53 0x45 0x52 0x20
   0x38 0x35 0x30 0x30 0x2d 0x46 0x2d 0x31 0x30 0x33 0x20 0x20 0x20 0x20 0x20 0x20
   0x30 0x30 0x30 0x30 0x2d 0x30 0x31 0x30 0x30 0x2d 0x30 0x30 0x20 0x20 0x20 0x20
   0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20
   0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
   0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
   0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
   0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00

   Read After Enable OTF
   0x55 0xaa 0xcc 0x44 0x5a 0xa5 0x4c 0xc4 0x53 0x30 0x2d 0x55 0x53 0x45 0x52 0x20
   0x38 0x35 0x30 0x30 0x2d 0x46 0x2d 0x31 0x30 0x33 0x20 0x20 0x20 0x20 0x20 0x20
   0x30 0x30 0x30 0x30 0x2d 0x30 0x31 0x30 0x30 0x2d 0x30 0x30 0x20 0x20 0x20 0x20
   0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20
   0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
   0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
   0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
   0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00

   Read After Disable OTF
   0x55 0xaa 0xcc 0x44 0x5a 0xa5 0x4c 0xc4 0x53 0x30 0x2d 0x55 0x53 0x45 0x52 0x20
   0x38 0x35 0x30 0x30 0x2d 0x46 0x2d 0x31 0x30 0x33 0x20 0x20 0x20 0x20 0x20 0x20
   0x30 0x30 0x30 0x30 0x2d 0x30 0x31 0x30 0x30 0x2d 0x30 0x30 0x20 0x20 0x20 0x20
   0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20
   0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
   0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
   0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
   0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00

   OTFAD_CR is 0x80000000
   OTFAD_SR is 0x20000040
   OTFAD_CRC is 0x00000000
   OTFAD_CTX0_KEY_W0 is 0x03020100
   OTFAD_CTX0_KEY_W1 is 0x07060504
   OTFAD_CTX0_KEY_W2 is 0x0b0a0908
   OTFAD_CTX0_KEY_W3 is 0x0f0e0d0c
   OTFAD_CTX0_CTR_W0 is 0x67452301
   OTFAD_CTX0_CTR_W1 is 0xefcdab89
   OTFAD_CTX0_RGD_W0 is 0x68080000
   OTFAD_CTX0_RGD_W1 is 0x680fffff

Original Attachment has been moved to: otftest.c.zip

Original Attachment has been moved to: fsl_otfad_hal.c.zip

Outcomes