はじめまして
現在、renesas synergy のs7g2-skのボードで
QSPIのサンプル「simple_QSPI_Example」で外部メモリへの動作の確認をしているのですが、
サンプルの動作で不明な点があり、問題としては
指定していないアドレスで書き込みがされている
上記2点の動作が不明で、困っております。
2の問題についてはメモリアドレスの0x60000000、0x61000000,0x62000000,0x63000000のでサンプルの数字が記録されています。
BSPについてはs7g2-skのものを使用して変更しておりません。
スクリプトはメモリサイズに合わせた設定をしています。
サンプルコードはhal_entry.cに記述されています
下記にサンプルコードを記載します。
どんなアドバイスでもよいので教えていただけますでしょうか?
よろしくお願いいたします。
//////////////////////////////////////////////////////////////////////////
#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
#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
#ifdef USE_SEMIHOSTING if (CoreDebug->DHCSR & CoreDebug_DHCSR_C_DEBUGEN_Msk) { printf("Calling Blinky\n"); }#endif blinky();
while(1) {};}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////