This page goes over different aspect of flash operation scheduler (FLSOPSKD) hardware engine.
OptiFlash technology (OptiFlash Memory Technology) enables XIP, in case, where an application is performing flash writes, would look like as follows:
The following image shows the same:
Here each CPU is requestion data from the external flash through flash controller
for performing XIP or read from the external flash and sending erase, write or status read request. On top of this, each request is asynchronous in nature, meaning that any request can come at anytime.
External flash is connected to microcontroller over 8 data lines (OSPI) and on same data lines, both reads and writes would happen. And in any flash write scenerio, writes would be happening while XIP is going on. During writing, reading should be stopped which also mean that XIP needs to be stopped and this would have an impact on performance and increased complexity in system design.
To synchronize all the read and write request on same 8bit data bus and to minimize the XIP/Read downtime, FLSOPSKD IP has been added. This will help schedule different flash related transaction by prioritizing XIP/Reads. XIP/Reads are prioritized because writes and erase to a nor flash are anyway very slow (may take multiple seconds for a single operation, depending on flash).
To achieve this sort of scheduling, with Optiflash, FLSOPSKD Hardware Engine has been added on top of Flash controller.
The following image shows the same:
One key feature of this hardware is that there is a 8051MCU inside this which is also programable. It has its own program memory (2KB in case of AM263Px) and data memory of 256B.
This 8051 has a very close access to flash controller's configuration and some hooks to know the state of the flash controller (or OSPI controller in case of AM263Px).
R5F CPU or anyother CPU, when it is required to communicate to 8051 would program the MMR registers and signal the firmware that is running inside the 8051 to further process it.
TI Provides some recommendation on how to write custom implementation of the above described scheduling.
The following image shows the same:
On the left hand side, any core which is trying to communicate to 8051 fiirmware would follow the and on the right hand side are the steps that 8051 would follow after recieving signal from SOC core.
Based on the above steps, MCU+ SDK drivers come with prebuit firmware of 8051 and its corresponding R5F drivers.
Any operation that is perform by 8051 is generally in format:
8051 FW supports the following operations
FLSOPSKD IP should be initilized by following procedure:
To perform flash erase R5F should do the following
FOTA_CTRL
register. Once the GO bit is set, then R5F should wait for FOTA DONE
interrupt and check for error codes or status code. Current implementation only supports FOTA done bit in IRQ_STATUS_RAW.fota_done
. It does not provide any error code and status code. It also assumes that flash is configured.Current 8051 implements 256B page writes. Completion of this is notified by IRQ_STATUS_RAW.fota_done bit and does not writes any error code and status code. to write a page to flash perform the following:
CSL_FSS_WBUF_GENREGS_REGS_BASE
(0x5380E000U
in case of am263px) and CSL_FSS_WBUF_GENREGS_REGS_BASE
+ 256B location.FOTA_CTRL
register. Once the GO bit is set, then R5F should wait for FOTA DONE interrupt and check for error codes or status codeThis operation internally uses OSPI STIG feature. for any command to send, it needs the following fields
S.No | Field |
---|---|
1 | Opcode |
2 | Extended Opcode |
3 | Number of address bytes to send |
4 | Address |
5 | Number of dummy bits to send |
6 | Number of bytes to read |
7 | Number of bytes to write |
8 | write bytes |
Current 8051 supports setting all the above fields. Other than that there are other operations, like setting up the tx buffer, reading rx buffer, etc.
XXXXXX02
. Where X
can have any value.To do this send XXXX0002
where XXXX
is the opcode that is required to be programmed. For example, 0x7c
is the opcode that is to be programmed then GP0 should be set to 007C0002
in hex.
Set GP0 to XXXX0102
where XXXX
is the extended opcode that is to be set.
For this set GP0 to XXXX0502
there XXXX
can have the following values
S.No | Number of address bytes to send | Value of XXXX |
---|---|---|
1 | 0 | 0h |
2 | 1 | 8h |
3 | 2 | 9h |
4 | 3 | Ah |
5 | 4 | Bh |
set GP0 to XXXX0402
where XXXX
can have the following values
Number of bytes to write | Value of XXXX |
---|---|
0 | 0x0 |
1 | 0x8 |
2 | 0x9 |
3 | 0xA |
4 | 0xB |
5 | 0xC |
6 | 0xD |
7 | 0xE |
8 | 0xF |
For example, if it is required to send 8 bytes to write then GP0 should be set to 000F0402
for thsi set GP0 tp XXXX0302
there XXXX
can have the following values:
Number of bytes to write | Value of XXXX |
---|---|
0 | 0x0 |
1 | 0x8 |
2 | 0x9 |
3 | 0xA |
4 | 0xB |
5 | 0xC |
6 | 0xD |
7 | 0xE |
8 | 0xF |
Its values is to be directly written to FOTA_ADDR
register.
If this general command is going to write then its needs some data to write. This write data can be setup by using the following procedure (assuming 8B data is to be written):
FOTA_ADDR
registerGP0
to 00000702
and execute the operationFOTA_ADDR
registerGP0
to 00000802
and execute the operationIf the after sending the STIG command, it is expected some data (max 8B) then to read the received data, do the following process (assuming it is required to read 8B):
GP0
to 0000_0A02
and execute the command.GP1
to 0000_0902
and execute the command.set GP0
to XXXX0602
and execute the command, For example if 4 dummy bits is required to be sent then set GP0
to 00040602
. maximum value of dummy bits is 32.
To send this command perform the following process:
FOTA_CTRL
register.