I am having an issue with the flexspi_hyper_flash_polling_transfer example whilst debugging with a JLINK on the RT1060EVK.
My project is setup as follows
When I run the demo it fails on page read failure when using JLINK.
FLEXSPI hyperflash example successfully.
FLEXSPI hyperflash example started!
Debugging with JLINK...
Found the HyperFlash by CFI
loop nummber: 0
Page read failure !
Page read failure !
Page read failure !
Page read failure !
Page read failure !
If I change the debug launch to LinkServer with SDRAM connect script it works as expected
FLEXSPI hyperflash example successfully.
FLEXSPI hyperflash example started!
Debugging with LinkSserver...
Found the HyperFlash by CFI
loop nummber: 0
loop nummber: 1
loop nummber: 2
loop nummber: 3
loop nummber: 4
loop nummber: 5
So my question is, why does it work for one and not the other? Is there some other setting that I am missing or do not have configured? Is there some preprocessor setting that I need to make it work for JLINK? I have added SKIP_SYSCLK_INIT.
Hi,
Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.
I think I need more information and whether you ever try to use the on-board debugger (OpenSDA) to debug the demo project, if not, please give it a try.
In addition, what modification you did about the flexspi_hyper_flash_polling_transfer prior to debugging test?
Have a great day.
TIC
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------
Hi Jeremy,
Yes, It works fine with openSDA. See my original post where there are no errors for LinkServer but with the JLINK it gets "page read error". The problem seems to be when JLINK is used. I also tried the flexspi_hyper_flash_polling_transfer example with IAR and it produced the same results, page read error for JLINK.
I made no changes to the firmware or project properties in the flexspi_hyper_flash_polling_transfer example which runs from internal SRAM_DTC on MCUXpresso. Using the default example I enter debug with JLINK launch configuration. The following is printed to the terminal
FLEXSPI hyperflash example started!
Found the HyperFlash by CFI
Erasing whole chip over FlexSPI...
Erase finished !
loop nummber: 0
Page read failure !
loop nummber: 1
loop nummber: 2
loop nummber: 3
loop nummber: 4
loop nummber: 5
FLEXSPI hyperflash example failed.
The SDK I'm using is 2.10.1. I hope to run from SDRAM in my own application but for now the problem also exists running from internal SRAM so I have started here to remove any additional complexity.
Also note, I do not see the same issue with the RT1050-EVKB. The flexspi_hyper_flash_polling_transfer example works fine with the JLINK.
Also to note, there is no issue when I run the same example for the RT1050EVKB using the JLINK.
I have also noticed that using the JLINK with internal SRAM (ie SRAM_DTC) causes the first page to always fail on the RT1060.
FLEXSPI hyperflash example started!
Found the HyperFlash by CFI
Erasing whole chip over FlexSPI...
Erase finished !
loop nummber: 0
Page read failure !
loop nummber: 1
loop nummber: 2
loop nummber: 3
loop nummber: 4
loop nummber: 5
FLEXSPI hyperflash example failed.
So it looks like no matter what configuration I use the JLINK on Hyperflash for the RT1060, it is unreliable. I have disconnected the jumpers J46 and J47 for JLINK programming.
Any pointers would be appreciated.
So it seems putting in a small delay between the flexspi_nor_flash_page_program() and memcpy() makes the program run without any read errors.
status = flexspi_nor_flash_page_program(EXAMPLE_FLEXSPI, (EXAMPLE_SECTOR + j) * SECTOR_SIZE + k * FLASH_PAGE_SIZE, (void *)s_hyperflash_program_buffer);
/* Putting a delay here makes it work with JLINK */
SDK_DelayAtLeastUs(10, SDK_DEVICE_MAXIMUM_CPU_CLOCK_FREQUENCY);
#if defined(__ICACHE_PRESENT) && (__ICACHE_PRESENT == 1U)
if (ICacheEnableFlag)
{
/* Enable I cache. */
SCB_EnableICache();
ICacheEnableFlag = false;
}
#endif /* __ICACHE_PRESENT */
if (status != kStatus_Success)
{
PRINTF("Page program failure !\r\n");
}
#if defined(CACHE_MAINTAIN) && CACHE_MAINTAIN
DCACHE_InvalidateByRange(
EXAMPLE_FLEXSPI_AMBA_BASE + (EXAMPLE_SECTOR + j) * SECTOR_SIZE + k * FLASH_PAGE_SIZE, FLASH_PAGE_SIZE);
#endif
memcpy(s_hyperflash_read_buffer, (void *)(FlexSPI_AMBA_BASE + (EXAMPLE_SECTOR + j) * SECTOR_SIZE + k * FLASH_PAGE_SIZE), sizeof(s_hyperflash_read_buffer));
if (memcmp(s_hyperflash_read_buffer, s_hyperflash_program_buffer, sizeof(s_hyperflash_program_buffer)) != 0)
{
errorFlag = true;
PRINTF("Page read failure !\r\n");
}
All the cache stuff is enabled by default. I tried disabling all the cache stuff but nothing works without adding the delay before the memcpy(). Obviously I'd rather find a better solution than just sticking in a delay.
flexspi_nor_wait_bus_busy() indicates that the flash is ready so I'm not sure what is happening.