FLEXSPI_UpdateLUT in RT1062 SDK, FLEXSPI [2.6.1] change, input LUT address check

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

FLEXSPI_UpdateLUT in RT1062 SDK, FLEXSPI [2.6.1] change, input LUT address check

Jump to solution
500 Views
bw1
Contributor IV

We are investigating updating the SDK files to a recent version and came across something that we don't understand but seems incorrect in the FLEXSPI_UpdateLUT function within the fsl_flexspi.c file.  
if (FLEXSPI_CheckInputLutLocation(base, (uint32_t)cmd) == false)
{
    /* Input LUT address is not allowed. */
    assert(false);
}

The call above passes the parameter "cmd" which is the Command sequence array as passed into this "FLEXSPI_UpdateLUT" function. The way I understand it this is the new LUT array command(s) that you want to save. It is coming from flash ROM, in this case the FlexSPI. 

However, the parameter description of this in FLEXSPI_CheckInputLutLocation() states this:

* param lutAddr The address if input lut.

The function then checks that the lutAddr value is within the flexspi range, but if it is then it returns false rather than true.  

It seems the check is either backward, or that the calling function is passing the wrong value (the new LUT source rather than the destination). 

Can you please review and clarify?

Tags (1)
0 Kudos
Reply
1 Solution
445 Views
Habib_MS
NXP Employee
NXP Employee

Hello @bw1,
The function you are referring to is currently receiving an address, specifically, the address of the variable named tempLUT, as shown in the following image:

Habib_MS_1-1747939842278.png

This variable, tempLUT, contains the LUT that was previously created:

Habib_MS_2-1747939865698.png

Inside the function FLEXSPI_UpdateLUT, there is a call to another function named FLEXSPI_CheckInputLutLocation, which takes as a parameter the memory address pointed to by the pointer. As mentioned earlier, this is the address of the tempLUT variable.
If we examine the cast operation, we can confirm that the address pointed to by cmd refers to a variable located in RAM:

Habib_MS_3-1747939879864.png

Therefore, if the address passed as a parameter is not within the range of any FLASH memory, the function FLEXSPI_CheckInputLutLocation will return true.

Habib_MS_0-1747939835327.png

This behavior is expected, as the purpose of this function is to verify that the LUT is not located in FLEXSPI AHB region.

BR
Habib

View solution in original post

0 Kudos
Reply
5 Replies
486 Views
Habib_MS
NXP Employee
NXP Employee

Hello @bw1,

In order to support you better, could you provide me the SDK version where you obtained this instruction, and which RT1060 evaluation board are you currently using?
if (FLEXSPI_CheckInputLutLocation(base, (uint32_t)cmd) == false)
{
    /* Input LUT address is not allowed. */
    assert(false);
}

BR
Habib

0 Kudos
Reply
480 Views
bw1
Contributor IV

The function is from SDK_24.12.00_MIMXRT1062xxxxA and looks to be the same in the latest SDK_25.03.00_MIMXRT1062xxxxA. 

We are using are own PCBA in our product. The revision history shows the addition was at [2.6.1].

0 Kudos
Reply
446 Views
Habib_MS
NXP Employee
NXP Employee

Hello @bw1,
The function you are referring to is currently receiving an address, specifically, the address of the variable named tempLUT, as shown in the following image:

Habib_MS_1-1747939842278.png

This variable, tempLUT, contains the LUT that was previously created:

Habib_MS_2-1747939865698.png

Inside the function FLEXSPI_UpdateLUT, there is a call to another function named FLEXSPI_CheckInputLutLocation, which takes as a parameter the memory address pointed to by the pointer. As mentioned earlier, this is the address of the tempLUT variable.
If we examine the cast operation, we can confirm that the address pointed to by cmd refers to a variable located in RAM:

Habib_MS_3-1747939879864.png

Therefore, if the address passed as a parameter is not within the range of any FLASH memory, the function FLEXSPI_CheckInputLutLocation will return true.

Habib_MS_0-1747939835327.png

This behavior is expected, as the purpose of this function is to verify that the LUT is not located in FLEXSPI AHB region.

BR
Habib

0 Kudos
Reply
439 Views
bw1
Contributor IV

Thanks Habib,

OK I see why I was confused.  The old FLEXSPI_UpdateLUT() version that we were using copied the table passed in (from ROM) to a RAM table within the function and then called a RAM execution function to complete the process.  Whereas when we upgraded to use the new one, it expects the table passed in via the parameter to already be in RAM (thus the check for that at the beginning). 

0 Kudos
Reply
459 Views
bw1
Contributor IV

If I understand what the code is trying to check it seems like the parameter to pass would be "&base->LUT[index]" rather than "cmd".  However, I am not sure I understand it correctly. 

Given: #define FlexSPI_AMBA_BASE (0x60000000u)

            #define FlexSPI_AMBA_BASE_ARRAY { {0x60000000u}, {0u}, {0x70000000u} }

            #define FlexSPI_AMBA_END_ARRAY { {0x6FFFFFFFu}, {0u}, {0x7EFFFFFFu} }

  and   #define FLEXSPI_BASE (0x402A8000u)

 

0 Kudos
Reply