kopia lustrzana https://github.com/micropython/micropython
stm32/qspi: Handle bus acquisition.
When going out of memory-mapped mode to do a control transfer to the QSPI flash, the MPU settings must be changed to forbid access to the memory mapped region. And any ongoing transfer (eg memory mapped continuous read) must be aborted.pull/4892/head
rodzic
2034c0a2e3
commit
caabdd99c0
|
@ -139,6 +139,16 @@ STATIC int qspi_ioctl(void *self_in, uint32_t cmd) {
|
|||
case MP_QSPI_IOCTL_INIT:
|
||||
qspi_init();
|
||||
break;
|
||||
case MP_QSPI_IOCTL_BUS_ACQUIRE:
|
||||
// Disable memory-mapped region during bus access
|
||||
qspi_mpu_disable_all();
|
||||
// Abort any ongoing transfer if peripheral is busy
|
||||
if (QUADSPI->SR & QUADSPI_SR_BUSY) {
|
||||
QUADSPI->CR |= QUADSPI_CR_ABORT;
|
||||
while (QUADSPI->CR & QUADSPI_CR_ABORT) {
|
||||
}
|
||||
}
|
||||
break;
|
||||
case MP_QSPI_IOCTL_BUS_RELEASE:
|
||||
// Switch to memory-map mode when bus is idle
|
||||
qspi_memory_map();
|
||||
|
|
Ładowanie…
Reference in New Issue