renesas synergy QSPI memory addressing

hi!

Currently on renesas synergy s7g2-sk board

I am checking the operation to the external memory with the QSPI sample "simple_QSPI_Example".

There is an unknown point in the operation of the sample, and the problem is

Writing is done at an unspecified address

I'm in trouble because I don't know the operation of the above one point.

For the problem, sample numbers are recorded at memory addresses 0x60000000, 0x61000000, 0x62000000, 0x63000000.

The BSP is from s7g2-sk and has not been changed.

The script is set according to the memory size.

The sample code is written in hal_entry.c

A sample code is shown below.

Could you please give me any advice?

Thank you.

Parents
  • Hello Kawamura,

    I believe you forgot to add the sample code to your post. Can you please do this?

    Kind regards,

    Sergey

    If this response, or one provided by another user, answers your question, please verify the answer. Thank you!

    Renesas Engineering Community Moderator
    https://community.renesas.com/
    https://academy.renesas.com/
    https://en-support.renesas.com/knowledgeBase/

  • hello sergey,

    thank you for your reply.
    I forgot to post the sample code.

    This sample code is taken from the Renesas sample.

    If you write this sample code, the memory will be written to 0x60000000, 0x61000000, 0x62000000, 0x63000000 in hexadecimal and it will be in a mirror state.

    Any advice would be great if you could let me know.

    kind regard,kawamura.

    //////////////////////////////////////////////////////////////////////////

    #define QSPI_DEVICE_BASE_ADDR (0x60000000)
    void qspi_dump_mem();

    void qspi_dump_mem()
    {
    volatile int i;
    int *qspi_mem_ptr = (int *)QSPI_DEVICE_BASE_ADDR;

    i = QSPI_pad; // This line is required to force the linker to place QSPI_data[] into the second 64k sector.


    for(i = 0; i < 5; i++)
    {
    #ifdef USE_SEMIHOSTING
    if (CoreDebug->DHCSR & CoreDebug_DHCSR_C_DEBUGEN_Msk)
    {
    int qspi_data = (int)&QSPI_data[i];
    printf("0x%x: 0x%08x 0x%x: 0x%08x \n", (int)qspi_mem_ptr,
    *qspi_mem_ptr,
    qspi_data,
    QSPI_data[i]);
    }
    #endif
    qspi_mem_ptr++;
    }
    }

    /*******************************************************************************************************************//**
    * @brief Blinky example application
    *
    * Blinks all leds at a rate of 1 second using the software delay function provided by the BSP.
    * Only references two other modules including the BSP, IOPORT.
    *
    **********************************************************************************************************************/
    void hal_entry(void) {

    #ifdef USE_SEMIHOSTING
    if (CoreDebug->DHCSR & CoreDebug_DHCSR_C_DEBUGEN_Msk)
    {
    #if defined(__GNUC__) /* GCC Compiler */
    initialise_monitor_handles();
    #endif
    printf("Simple QSPI example\n");

    printf("QSPI memory after Jlink programming\n");
    #endif
    }

    qspi_dump_mem();

    #if 1
    {
    bool write_in_progress;
    int retval;

    retval = g_qspi0.p_api->open(g_qspi0.p_ctrl, g_qspi0.p_cfg);
    if (!retval)
    {
    retval = g_qspi0.p_api->sectorErase(g_qspi0.p_ctrl, (uint8_t *)QSPI_data);
    }
    if (!retval)
    {
    /* Wait for the erase to complete */
    write_in_progress = 1;
    while (write_in_progress & 1)
    {
    retval = g_qspi0.p_api->statusGet(g_qspi0.p_ctrl, &write_in_progress);
    }
    }
    retval = g_qspi0.p_api->close(g_qspi0.p_ctrl);
    }
    #endif

    #ifdef USE_SEMIHOSTING
    if (CoreDebug->DHCSR & CoreDebug_DHCSR_C_DEBUGEN_Msk)
    {
    printf("QSPI memory after sector erase\n");
    }
    #endif

    qspi_dump_mem();

    #if 1
    {
    bool write_in_progress;
    int retval;
    int new_data[] = {0x00009999, 0x00008888, 0x00007777, 0x00006666, 0x00005555};

    retval = g_qspi0.p_api->open(g_qspi0.p_ctrl, g_qspi0.p_cfg);
    if (!retval)
    {
    retval = g_qspi0.p_api->pageProgram(g_qspi0.p_ctrl, (uint8_t *)QSPI_data, (uint8_t *)new_data, sizeof(new_data));
    }
    if (!retval)
    {
    /* Wait for the erase to complete */
    write_in_progress = 1;
    while (write_in_progress & 1)
    {
    retval = g_qspi0.p_api->statusGet(g_qspi0.p_ctrl, &write_in_progress);
    }
    }
    retval = g_qspi0.p_api->close(g_qspi0.p_ctrl);
    }
    #endif

    #ifdef USE_SEMIHOSTING
    if (CoreDebug->DHCSR & CoreDebug_DHCSR_C_DEBUGEN_Msk)
    {
    printf("QSPI memory after page program\n");
    }
    #endif

    qspi_dump_mem();

    #ifdef USE_SEMIHOSTING
    if (CoreDebug->DHCSR & CoreDebug_DHCSR_C_DEBUGEN_Msk)
    {
    printf("Calling Blinky\n");
    }
    #endif
    blinky();

    while(1)
    {};
    }

    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Reply
  • hello sergey,

    thank you for your reply.
    I forgot to post the sample code.

    This sample code is taken from the Renesas sample.

    If you write this sample code, the memory will be written to 0x60000000, 0x61000000, 0x62000000, 0x63000000 in hexadecimal and it will be in a mirror state.

    Any advice would be great if you could let me know.

    kind regard,kawamura.

    //////////////////////////////////////////////////////////////////////////

    #define QSPI_DEVICE_BASE_ADDR (0x60000000)
    void qspi_dump_mem();

    void qspi_dump_mem()
    {
    volatile int i;
    int *qspi_mem_ptr = (int *)QSPI_DEVICE_BASE_ADDR;

    i = QSPI_pad; // This line is required to force the linker to place QSPI_data[] into the second 64k sector.


    for(i = 0; i < 5; i++)
    {
    #ifdef USE_SEMIHOSTING
    if (CoreDebug->DHCSR & CoreDebug_DHCSR_C_DEBUGEN_Msk)
    {
    int qspi_data = (int)&QSPI_data[i];
    printf("0x%x: 0x%08x 0x%x: 0x%08x \n", (int)qspi_mem_ptr,
    *qspi_mem_ptr,
    qspi_data,
    QSPI_data[i]);
    }
    #endif
    qspi_mem_ptr++;
    }
    }

    /*******************************************************************************************************************//**
    * @brief Blinky example application
    *
    * Blinks all leds at a rate of 1 second using the software delay function provided by the BSP.
    * Only references two other modules including the BSP, IOPORT.
    *
    **********************************************************************************************************************/
    void hal_entry(void) {

    #ifdef USE_SEMIHOSTING
    if (CoreDebug->DHCSR & CoreDebug_DHCSR_C_DEBUGEN_Msk)
    {
    #if defined(__GNUC__) /* GCC Compiler */
    initialise_monitor_handles();
    #endif
    printf("Simple QSPI example\n");

    printf("QSPI memory after Jlink programming\n");
    #endif
    }

    qspi_dump_mem();

    #if 1
    {
    bool write_in_progress;
    int retval;

    retval = g_qspi0.p_api->open(g_qspi0.p_ctrl, g_qspi0.p_cfg);
    if (!retval)
    {
    retval = g_qspi0.p_api->sectorErase(g_qspi0.p_ctrl, (uint8_t *)QSPI_data);
    }
    if (!retval)
    {
    /* Wait for the erase to complete */
    write_in_progress = 1;
    while (write_in_progress & 1)
    {
    retval = g_qspi0.p_api->statusGet(g_qspi0.p_ctrl, &write_in_progress);
    }
    }
    retval = g_qspi0.p_api->close(g_qspi0.p_ctrl);
    }
    #endif

    #ifdef USE_SEMIHOSTING
    if (CoreDebug->DHCSR & CoreDebug_DHCSR_C_DEBUGEN_Msk)
    {
    printf("QSPI memory after sector erase\n");
    }
    #endif

    qspi_dump_mem();

    #if 1
    {
    bool write_in_progress;
    int retval;
    int new_data[] = {0x00009999, 0x00008888, 0x00007777, 0x00006666, 0x00005555};

    retval = g_qspi0.p_api->open(g_qspi0.p_ctrl, g_qspi0.p_cfg);
    if (!retval)
    {
    retval = g_qspi0.p_api->pageProgram(g_qspi0.p_ctrl, (uint8_t *)QSPI_data, (uint8_t *)new_data, sizeof(new_data));
    }
    if (!retval)
    {
    /* Wait for the erase to complete */
    write_in_progress = 1;
    while (write_in_progress & 1)
    {
    retval = g_qspi0.p_api->statusGet(g_qspi0.p_ctrl, &write_in_progress);
    }
    }
    retval = g_qspi0.p_api->close(g_qspi0.p_ctrl);
    }
    #endif

    #ifdef USE_SEMIHOSTING
    if (CoreDebug->DHCSR & CoreDebug_DHCSR_C_DEBUGEN_Msk)
    {
    printf("QSPI memory after page program\n");
    }
    #endif

    qspi_dump_mem();

    #ifdef USE_SEMIHOSTING
    if (CoreDebug->DHCSR & CoreDebug_DHCSR_C_DEBUGEN_Msk)
    {
    printf("Calling Blinky\n");
    }
    #endif
    blinky();

    while(1)
    {};
    }

    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Children