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?
Solved! Go to Solution.
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:
This variable, tempLUT, contains the LUT that was previously created:
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:
Therefore, if the address passed as a parameter is not within the range of any FLASH memory, the function FLEXSPI_CheckInputLutLocation will return true.
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
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
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].
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:
This variable, tempLUT, contains the LUT that was previously created:
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:
Therefore, if the address passed as a parameter is not within the range of any FLASH memory, the function FLEXSPI_CheckInputLutLocation will return true.
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
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).
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)