Skip to content

Commit

Permalink
QSPI timing workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulStoffregen committed Nov 10, 2020
1 parent 7af5929 commit 1fa4f14
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/LittleFS.cpp
Expand Up @@ -349,7 +349,8 @@ bool LittleFS_QSPIFlash::begin()
progtime = info->progtime;
erasetime = info->erasetime;

// TODO: configure FlexSPI2 for chip's size
// configure FlexSPI2 for chip's size
FLEXSPI2_FLSHA2CR0 = info->chipsize / 1024;

FLEXSPI2_LUTKEY = FLEXSPI_LUTKEY_VALUE;
FLEXSPI2_LUTCR = FLEXSPI_LUTCR_UNLOCK;
Expand Down Expand Up @@ -395,13 +396,15 @@ int LittleFS_QSPIFlash::read(lfs_block_t block, lfs_off_t offset, void *buf, lfs
flexspi2_ip_read(9, 0x00800000 + addr, buf, size);
// TODO: detect errors, return LFS_ERR_IO
//printtbuf(buf, 20);
delayMicroseconds(25); // TODO: replace this ugly workaround with real solution...
return 0;
}

int LittleFS_QSPIFlash::prog(lfs_block_t block, lfs_off_t offset, const void *buf, lfs_size_t size)
{
flexspi2_ip_command(10, 0x00800000);
const uint32_t addr = block * config.block_size + offset;
//printtbuf(buf, 20);
flexspi2_ip_write(11, 0x00800000 + addr, buf, size);
// TODO: detect errors, return LFS_ERR_IO
return wait(progtime);
Expand Down

0 comments on commit 1fa4f14

Please sign in to comment.