Hi :
I find some problem about thGUI_FONT.rar.
First I connect the USB,then I copy a folder with 18 binary files to my 52840DK,then reconnect.and compare the folders in DK with the original folder in my PC,I find out the data of a binary file(FZZJ_ASCII_H29.bin) is differnet with the orignial data.Everytime I try the same file is wrong,but the others are right,I also try to copy the FZZJ_ASCII_H29.bin alone,and the data is wrong too.Is there anything I should pay attention to about the file? I don't understand why dose the wrong data issue appear only at the one binary file.
.
And another question is:
in the library, nrf_block_dev_qspi.c line 330
ret = nrf_drv_qspi_init(p_qspi_cfg, qspi_handler, (void *)p_blk_dev);
I think it may be changed to
ret = nrf_drv_qspi_init(p_qspi_cfg, qspi_handler, (void *)p_qspi_dev);
Am I right?
Here is the code
static ret_code_t block_dev_qspi_init(nrf_block_dev_t const * p_blk_dev,
nrf_block_dev_ev_handler ev_handler,
void const * p_context)
{
ASSERT(p_blk_dev);
nrf_block_dev_qspi_t const * p_qspi_dev =
CONTAINER_OF(p_blk_dev, nrf_block_dev_qspi_t, block_dev);
nrf_block_dev_qspi_work_t * p_work = p_qspi_dev->p_work;
nrf_drv_qspi_config_t const * p_qspi_cfg = &p_qspi_dev->qspi_bdev_config.qspi_config;
ret_code_t ret = NRF_SUCCESS;
NRF_LOG_INST_DEBUG(p_qspi_dev->p_log, "Init");
if (p_qspi_dev->qspi_bdev_config.block_size % BD_PAGE_PROGRAM_SIZE)
{
/*Unsupported block size*/
NRF_LOG_INST_ERROR(p_qspi_dev->p_log, "Unsupported block size because of program page size");
return NRF_ERROR_NOT_SUPPORTED;
}
if (NRF_BLOCK_DEV_QSPI_ERASE_UNIT_SIZE % p_qspi_dev->qspi_bdev_config.block_size)
{
/*Unsupported block size*/
NRF_LOG_INST_ERROR(p_qspi_dev->p_log, "Unsupported block size because of erase unit size");
return NRF_ERROR_NOT_SUPPORTED;
}
if (m_active_qspi_dev)
{
/* QSPI instance is BUSY*/
NRF_LOG_INST_ERROR(p_qspi_dev->p_log, "Cannot init because QSPI is busy");
return NRF_ERROR_BUSY;
}
ret = nrf_drv_qspi_init(p_qspi_cfg, qspi_handler, (void *)p_blk_dev);//ss
if (ret != NRF_SUCCESS)
{
NRF_LOG_INST_ERROR(p_qspi_dev->p_log, "QSPI init error: %"PRIu32"", ret);
return ret;
}
nrf_qspi_cinstr_conf_t cinstr_cfg = {
.opcode = QSPI_STD_CMD_RSTEN,
.length = NRF_QSPI_CINSTR_LEN_1B,
.io2_level = true,
.io3_level = true,
.wipwait = true,
.wren = true
};
/* Send reset enable */
ret = nrf_drv_qspi_cinstr_xfer(&cinstr_cfg, NULL, NULL);
if (ret != NRF_SUCCESS)
{
NRF_LOG_INST_ERROR(p_qspi_dev->p_log, "QSPI reset enable command error: %"PRIu32"", ret);
return ret;
}
/* Send reset command */
cinstr_cfg.opcode = QSPI_STD_CMD_RST;
ret = nrf_drv_qspi_cinstr_xfer(&cinstr_cfg, NULL, NULL);
if (ret != NRF_SUCCESS)
{
NRF_LOG_INST_ERROR(p_qspi_dev->p_log, "QSPI reset command error: %"PRIu32"", ret);
return ret;
}
/* Get 3 byte identification value */
uint8_t rdid_buf[3] = {0, 0, 0};
cinstr_cfg.opcode = QSPI_STD_CMD_READ_ID;
cinstr_cfg.length = NRF_QSPI_CINSTR_LEN_4B;
ret = nrf_drv_qspi_cinstr_xfer(&cinstr_cfg, NULL, rdid_buf);
if (ret != NRF_SUCCESS)
{
NRF_LOG_INST_ERROR(p_qspi_dev->p_log, "QSPI get 3 byte id error: %"PRIu32"", ret);
return ret;
}
nrf_serial_flash_params_t const * serial_flash_id = nrf_serial_flash_params_get(rdid_buf);
if (!serial_flash_id)
{
NRF_LOG_INST_ERROR(p_qspi_dev->p_log, "QSPI FLASH not supported");
return NRF_ERROR_NOT_SUPPORTED;
}
if (serial_flash_id->erase_size != NRF_BLOCK_DEV_QSPI_ERASE_UNIT_SIZE)
{
NRF_LOG_INST_ERROR(p_qspi_dev->p_log, "QSPI FLASH erase unit size not supported");
return NRF_ERROR_NOT_SUPPORTED;
}
/* Calculate block device geometry.... */
uint32_t blk_size = p_qspi_dev->qspi_bdev_config.block_size;
uint32_t blk_count = serial_flash_id->size / p_qspi_dev->qspi_bdev_config.block_size;
if (!blk_count || (blk_count % BD_BLOCKS_PER_ERASEUNIT(blk_size)))
{
NRF_LOG_INST_ERROR(p_qspi_dev->p_log, "QSPI FLASH block size not supported");
return NRF_ERROR_NOT_SUPPORTED;
}
p_work->geometry.blk_size = blk_size;
p_work->geometry.blk_count = blk_count;
p_work->p_context = p_context;
p_work->ev_handler = ev_handler;
p_work->state = NRF_BLOCK_DEV_QSPI_STATE_IDLE;
p_work->erase_unit_idx = BD_ERASE_UNIT_INVALID_ID;
p_work->writeback_mode = (p_qspi_dev->qspi_bdev_config.flags &
NRF_BLOCK_DEV_QSPI_FLAG_CACHE_WRITEBACK) != 0;
m_active_qspi_dev = p_qspi_dev;
if (p_work->ev_handler)
{
/*Asynchronous operation (simulation)*/
const nrf_block_dev_event_t ev = {
NRF_BLOCK_DEV_EVT_INIT,
NRF_BLOCK_DEV_RESULT_SUCCESS,
NULL,
p_work->p_context
};
p_work->ev_handler(p_blk_dev, &ev);
}
return NRF_SUCCESS;
}