MIMXRT1166 FLEXSPI_UpdateLUT fails

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MIMXRT1166 FLEXSPI_UpdateLUT fails

150 Views
tbonkers
Contributor III

When trying to update flash LUT, function FLEXSPI_UpdateLUT fails. MCR0->MDIS is set to zero, so module is not disabled:

 

MCR0 = 0xffffa030,
  MCR1 = 0xffffffff,
  MCR2 = 0x200001f7,
  AHBCR = 0x78,
  INTEN = 0x0,
  INTR = 0x41,
  LUTKEY = 0x5af05af0,
  LUTCR = 0x2,
  AHBRXBUFCR0 = {0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80000000, 0x80070040},
  RESERVED_0 = {0x0 <repeats 32 times>},
  FLSHCR0 = {0x2000, 0x0, 0x0, 0x0},
  FLSHCR1 = {0x63, 0x10063, 0x10063, 0x10063},
  FLSHCR2 = {0x0, 0x900, 0x900, 0x900},
  RESERVED_1 = {0xc, 0xc, 0x0, 0xd},
  FLSHCR4 = 0x3,
  RESERVED_2 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
  IPCR0 = 0x0,
  IPCR1 = 0x10000,
  RESERVED_3 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
  IPCMD = 0x0,
  RESERVED_4 = {0x0, 0x0, 0x0, 0x0},
  IPRXFCR = 0x1c,
  IPTXFCR = 0x1c,
  DLLCR = {0x79, 0x100},
  RESERVED_5 = {0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
  MISCCR4 = 0x0,
  MISCCR5 = 0x0,
  MISCCR6 = 0x0,
  MISCCR7 = 0x0,
  STS0 = 0x3,
  STS1 = 0x0,
  STS2 = 0x1353,
  AHBSPNDSTS = 0x0,
  IPRXFSTS = 0x0,
  IPTXFSTS = 0x80007,
  RESERVED_6 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
  RFDR = {0x8b2007dc, 0x0, 0x0, 0x0, 0x8b200712, 0xa304, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x760, 0x0 <repeats 19 times>},
  TFDR = {0x0 <repeats 32 times>},
  LUT = {0x8b2007fd, 0xa704b306, 0x0, 0x0, 0x4000481, 0x4000400, 0x2001, 0x0, 0x799, 0x0 <repeats 55 times>},
  RESERVED_7 = {0x0 <repeats 256 times>},
  HMSTRCR = {0x40ffcf, 0xffcf, 0x4f00f, 0x22807f, 0x32f87f, 0x11f87f, 0x0, 0x0},
  HADDRSTART = 0x0,
  HADDREND = 0x0,
  HADDROFFSET = 0x0

 

Debug sessions gets killed at the instance when code tries to  update the LUT:

*lutBase++ = *cmd++;

 

I haven't found a way to interrogate the processor as debugger disconnects.

 
 

 

 

0 Kudos
Reply
1 Reply

131 Views
Harry_Zhang
NXP Employee
NXP Employee

Hi @tbonkers 

I think you can refer to the SDK flexspi example FLEXSPI_UpdateLUT function.

void FLEXSPI_UpdateLUT(FLEXSPI_Type *base, uint32_t index, const uint32_t *cmd, uint32_t count)
{
    assert(index < 64U);

    uint32_t i = 0;
    volatile uint32_t *lutBase;

    /* Wait for bus to be idle before changing flash configuration. */
    while (!FLEXSPI_GetBusIdleStatus(base))
    {
    }

    /* Unlock LUT for update. */
#if !((defined(FSL_FEATURE_FLEXSPI_LUTKEY_IS_RO)) && (FSL_FEATURE_FLEXSPI_LUTKEY_IS_RO))
    base->LUTKEY = FLEXSPI_LUT_KEY_VAL;
#endif
    base->LUTCR = 0x02;

    lutBase = &base->LUT[index];
    for (i = 0; i < count; i++)
    {
        *lutBase++ = *cmd++;
    }

    /* Lock LUT. */
#if !((defined(FSL_FEATURE_FLEXSPI_LUTKEY_IS_RO)) && (FSL_FEATURE_FLEXSPI_LUTKEY_IS_RO))
    base->LUTKEY = FLEXSPI_LUT_KEY_VAL;
#endif
    base->LUTCR = 0x01;
}

 

BR

Harry

0 Kudos
Reply