RA6M5 LevelX on QSPI and MCUBoot

Hello,

I've been working on a test project on the EK-RA6M5 board which included several various FSP modules/stacks for testing and includes a working NetX FTP server based on the QSPI flash. After successfully getting all those to work in a separate project Ive had gone ahead and started a new "official" project that only has the NetX FTP on QSPI flash stacks in it. I'm trying to use the MCUBoot stack as well and have created a boot loader project that successfully launches this new FTP server project. However, since using the new project whenever the program calls lx_nor_flash_open() it throws a BSP_CFG_HANDLE_UNRECOVERABLE_ERROR when trying to call the rm_filex_levelx_nor_spi_callback() for the first write operation. I've tried looking into several fixes and none of them seem to have worked. I've tried:

  • Increasing both the main heap and main stack size in the boot loader project
  • Increasing both the main heap and main stack size in the FTP server project
  • Increasing the thread stack size for the FTP server thread.
  • Adding Parameter Checking beyond just BSP for several stacks.
  • Messing around with QSPI settings.
  • Erasing the whole QSPI chip.
  • Various other small things.

I tried looking into the MSP and PSP as well but they seem to set appropriately by the RA MCUBoot port. The MSP and PSP are both higher than the MSPLIM and PSPLIM respectively. I could be missing something here but I am no expert when it comes to boot loaders or ARM architecture.

Here is a photo of the trace.

I also have the a callback for the FileX I/O stack here:

And here's the code that's running in the only thread that is running:

I've tried using the format code that's supplied in the g_levelx_nor_quick_setup() code and tried using R_QSPI_Erase(p_ctrl, (uint8_t *)QSPI_DEVICE_START_ADDRESS, SPI_FLASH_ERASE_SIZE_CHIP_ERASE) which is the only relevant line of code in the currently not called qspi_format_device function.

I'm not sure what to even check anymore, any insight would be appreciated.

Parents
  • I've figured out the problem, it was a function call sequence issue related to FileX and LevelX. The proper function call order should be:

    1. Setup QSPI flash.
    2. Call lx_nor_flash_initialize.
    3. Call fx_system_initialize.
    4. Format QSPI flash (if first time running or formatting in general).
    5. Call fx_media_format (if first time running or formatting in general).
    6. Call lx_nor_flash_open.
    7. Call fx_media_open.

    Where I mistakenly was trying to call lx_nor_flash_open before fx_media_format.

Reply
  • I've figured out the problem, it was a function call sequence issue related to FileX and LevelX. The proper function call order should be:

    1. Setup QSPI flash.
    2. Call lx_nor_flash_initialize.
    3. Call fx_system_initialize.
    4. Format QSPI flash (if first time running or formatting in general).
    5. Call fx_media_format (if first time running or formatting in general).
    6. Call lx_nor_flash_open.
    7. Call fx_media_open.

    Where I mistakenly was trying to call lx_nor_flash_open before fx_media_format.

Children
No Data