Converted project evkmimxrt1064_flash_component_nor. How can I reset FLEXCAN in a way that I don't require power cycle prior to running?
MCUXpresso 10.3 MIMXRT1064 Eval Board. SDK 2.6.1.
I converted project evkmimxrt1064_flash_component_nor. Here, I describe how I did that. My actual questions show up in items 5 and 6 below.
1) The example project evkmimxrt1064_flash_component_nor is only available in version 2.7 of the SDK, which only works with MCUXpresso 11.1. We can't use 11.1, because they stopped supporting the config tool in 11.1. It's there, but somehow I don't have access to it. (I forget the error message, as it's been a long time now. It appears we're stuck in 10.3 for the forseeable future until this other problematic issues that exist in 11.1 are addressed, but alas, 'tis a subject for another day!)
2) I brought the files form the project into a copy of the "hello world" example, and deleted the hello_world.c file. As needed, I just dropped files from 11.1 project evkmimxrt1064_flash_component_nor into the source folder of my new 10.3 project, including the 3 files from the "nor_flash" folder of the original project.
3) At the top of nor_flash.c, I made the following modification:
* Definitions
******************************************************************************/
#define useEvalBoardChipFlash 0
#define useDoEraseVerifytest 0
#if useEvalBoardChipFlash
#define FLASH_SIZE 0x2000 /* 64Mb/KByte */
#define EXAMPLE_FLEXSPI_AMBA_BASE FlexSPI_AMBA_BASE
#define FLASH_PAGE_SIZE 256
#define NOR_FLASH_START_ADDRESS 0U
#define EXAMPLE_FLEXSPI_CLOCK kCLOCK_FlexSpi
#define FLASH_SIZE 0x1000 /* 32Mb/KByte */
#define EXAMPLE_FLEXSPI_AMBA_BASE FlexSPI2_AMBA_BASE
#define FLASH_PAGE_SIZE 256
#define NOR_FLASH_START_ADDRESS 0U
#define EXAMPLE_FLEXSPI_CLOCK kCLOCK_FlexSpi2
{
status_t status;
BOARD_InitPins();
BOARD_BootClockRUN();
BOARD_InitDebugConsole();
CLOCK_InitUsb1Pll(&g_ccmConfigUsbPll);
CLOCK_InitUsb1Pfd(kCLOCK_Pfd0, 24); /* Set PLL3 PFD0 clock 360MHZ. */
CLOCK_SetMux(kCLOCK_FlexspiMux, 0x3); /* Choose PLL3 PFD0 clock as flexspi source clock. */
CLOCK_SetDiv(kCLOCK_FlexspiDiv, 2); /* flexspi clock 120M. */
#else
CLOCK_InitUsb1Pll(&g_ccmConfigUsbPll);
CLOCK_InitUsb1Pfd(kCLOCK_Pfd0, 24); /* Set PLL3 PFD0 clock 360MHZ. */
CLOCK_SetMux(kCLOCK_Flexspi2Mux, 0x3); /* Choose PLL3 PFD0 clock as flexspi source clock. */
CLOCK_SetDiv(kCLOCK_Flexspi2Div, 2); /* flexspi clock 120M. */
#endif
flexspi_config_t config;
/* Get FLEXSPI default settings and configure the flexspi. */
FLEXSPI_GetDefaultConfig(&config);
config.ahbConfig.enableAHBPrefetch = true;
config.ahbConfig.enableAHBBufferable = true;
config.ahbConfig.enableReadAddressOpt = true;
config.ahbConfig.enableAHBCachable = true;
config.rxSampleClock = kFLEXSPI_ReadSampleClkLoopbackFromDqsPad;
//! to not hang in Nor_Flash_Init(). No effect.
//! Power cycle is required on each run!!
//! 20200304 PJR
FLEXSPI_Init(EXAMPLE_FLEXSPI, &config);
status = Nor_Flash_Init(&norConfig, &norHandle);
if (status != kStatus_Success)
{
PRINTF("\r\n***NOR Flash Initialization Failed!***\r\n");
ErrorTrap();
}
PRINTF("\r\n***NOR Flash Initialization Success!***\r\n");
/* Erase chip */
PRINTF("\r\n***NOR Flash Erase Chip Start!***\r\n");
status = Nor_Flash_Erase_Chip(&norHandle);
if (status != kStatus_Success)
{
PRINTF("\r\n***NOR Flash Erase Chip Failed!***\r\n");
ErrorTrap();
}
#endif
const uint32_t pageOffset = 256;
#else
const uint32_t pageOffset = 1024;
#endif
{
uint32_t address = NOR_FLASH_START_ADDRESS + norHandle.bytesInPageSize * pageIndex;
status = Nor_Flash_Read(&norHandle, address, mem_readBuffer, norHandle.bytesInPageSize);
if (status != kStatus_Success)
{
PRINTF("\r\n***NOR Flash Read Page Failed!***\r\n");
ErrorTrap();
}
{
if (mem_readBuffer[bytesIndex] != 0xFF)
{
PRINTF("\r\n***NOR Flash Erase Chip Failed!***\r\n");
ErrorTrap();
}
}
#endif
/* Program the page data. */
/* Initialize the write buffers. */
for (uint32_t i = 0; i < norHandle.bytesInPageSize; i++)
{
mem_writeBuffer[i] = i;
}
if (status != kStatus_Success)
{
PRINTF("\r\n***NOR Flash Page %d Program Failed!***\r\n", pageIndex);
ErrorTrap();
}
status = Nor_Flash_Read(&norHandle, address, mem_readBuffer, norHandle.bytesInPageSize);
if (status != kStatus_Success)
{
PRINTF("\r\n***NOR Flash Page %d Read Failed!***\r\n", pageIndex);
ErrorTrap();
}
{
PRINTF("\r\n***NOR Flash Page %d Read/Write Failed!***\r\n", pageIndex);
ErrorTrap();
}
/* Erase Block */
status = Nor_Flash_Erase_Block(&norHandle, address, norHandle.bytesInPageSize);
if (status != kStatus_Success)
{
PRINTF("\r\n***NOR Flash Erase Block Failed!***\r\n");
ErrorTrap();
}
if (status != kStatus_Success)
{
PRINTF("\r\n***NOR Flash Page Read Failed!***\r\n");
ErrorTrap();
}
{
if (mem_readBuffer[bytesIndex] != 0xFF)
{
PRINTF("\r\n***NOR Flash Erase Block Failed!***\r\n");
ErrorTrap();
}
}
#endif // useDoEraseVerifytest
}
while (1)
{
}
}
Hi Paul Roberts,
Why you don't run this driver project directly instead of porting to helloworld project?
SDK_2.7.0_EVK-MIMXRT1064\boards\evkmimxrt1064\driver_examples\flexspi\nor\polling_transfer
If you can't use the newest MCUXPresso IDE, you also can use the above project source file directly.
But please note, because the external QSPI can't support RWW function, then you need to run the above project in the internal RAM instead of run in the external flash directly.
About the linker script, you can refer to the MCUXPresso user manual,
C:\nxp\MCUXpressoIDE_11.1.0_3209\MCUXpresso_IDE_User_Guide.pdf
chapter 17. Memory Configuration and Linker Scripts
About your FLEXSPI_SoftwareReset question, I suggest you run it in this project:
SDK_2.7.0_EVK-MIMXRT1064\boards\evkmimxrt1064\driver_examples\flexspi\nor\polling_transfer
If you still can reproduce it, please tell me the detail issue phenomena and the related modified code, I will try to reproduce it and check more details.
Wish it helps you!
Kerry
-------------------------------------------------------------------------------
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.
-----------------------------------------------------------------------------
Hello Kerry,
Thanks very much for the reply. I followed your suggestion. Here is what happened.
Under MCUXpresso 11.1 with SDK 2.7, yes, the example program evkmimxrt1064_flexspi_nor_polling_transfer runs just fine in the 11.1 debugger, and all of the PRINTF outputs along the way declare victory, that the erase and program flash functions are working as expected.
This is good, but I now must get this program to work in MCUXpresso 10.3 with SDK 2.6, because our company thus far deems MCUXpresso 11.1 an invalid, not very usable version of the IDE. This is because that the
Configuration Tool works in 10.3, and, very unfortunately, does not work at all in 11.1 (the subject of another thread, for sure).
Unfortunately, SDK 2.7 cannot be used with IDE 10.3, so we have to salvage what we can.
When I import the SDK 2.6 example into 10.3, once I change the MCU from MIMXRT1064xxx6A to MIMXRT1064xxxxA, it builds. When I try to debug, I get
which suggests that my J-Link software needs to be updated. It's odd because I've been using Jlink with the 1064 for some time now without complaints. I changed CPU type in linker settings, and it seems like we have to get. Right now, I'm trying to download the latest Jlink software from Segger, and the installer for it is not working. I'm not sure if I have to uninstall the existing Segger Jlink software first. Ugh!
So, hopefully this begins to answer your question as to why I was using evkmimxrt1064_flash_component_nor and not evkmimxrt1064_flexspi_nor_polling_transfer. It's because I need something that works in the 10.3/2.6 environment because 11.1/2.7 is not ready for prime time because the Config Tool is broken. They really need to come out with an 11.2 that fixes the Config Tool!
Cheers,
Paul
Hi Paul Roberts,
Thanks for your detail reply, the IDE version and the new SDK compatibility is really need to improve.
I checked the SDK2.6.0,
It also contains the evkmimxrt1064_flexspi_nor_polling_transfer project, do you mean, you also can't run this version code on your MCUXPresso 10.3? You said you get: which suggests that my J-Link software needs to be updated.
Could you give me a screenshot about it?
If you install the newest JLINK driver, still can't work? What's the detail problem, any picture about it?
To be honest, I even delete the MCUXpresso 10.3 for a so long time. But I would like to help you to analyse your question together.
Wish it helps you!
Kerry
-------------------------------------------------------------------------------
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.
-----------------------------------------------------------------------------