nRF52840 only: Quad serial peripheral interface (QSPI) driver.
More...
|
#define | QSPI_PIN_SCK BSP_QSPI_SCK_PIN |
|
#define | QSPI_PIN_CSN BSP_QSPI_CSN_PIN |
|
#define | QSPI_PIN_IO0 BSP_QSPI_IO0_PIN |
|
#define | QSPI_PIN_IO1 BSP_QSPI_IO1_PIN |
|
#define | QSPI_PIN_IO2 BSP_QSPI_IO2_PIN |
|
#define | QSPI_PIN_IO3 BSP_QSPI_IO3_PIN |
|
#define | NRF_DRV_QSPI_DEFAULT_CONFIG |
| QSPI instance default configuration. More...
|
|
#define | NRF_DRV_QSPI_DEFAULT_CINSTR(opc, len) |
| QSPI custom instruction helper with default configuration. More...
|
|
|
ret_code_t | nrf_drv_qspi_init (nrf_drv_qspi_config_t const *p_config, nrf_drv_qspi_handler_t handler, void *p_context) |
| Function for initializing the QSPI driver instance. More...
|
|
void | nrf_drv_qspi_uninit (void) |
| Function for uninitializing the QSPI driver instance.
|
|
ret_code_t | nrf_drv_qspi_read (void *p_rx_buffer, size_t rx_buffer_length, uint32_t src_address) |
| Function for reading data from QSPI memory. More...
|
|
ret_code_t | nrf_drv_qspi_write (void const *p_tx_buffer, size_t tx_buffer_length, uint32_t dst_address) |
| Function for writing data to QSPI memory. More...
|
|
ret_code_t | nrf_drv_qspi_erase (nrf_qspi_erase_len_t length, uint32_t start_address) |
| Function for starting erasing of one memory block - 4KB, 64KB, or the whole chip. More...
|
|
ret_code_t | nrf_drv_qspi_chip_erase (void) |
| Function for starting an erase operation of the whole chip. More...
|
|
ret_code_t | nrf_drv_qspi_mem_busy_check (void) |
| Function for getting the current driver status and status byte of memory device with testing WIP (write in progress) bit. More...
|
|
ret_code_t | nrf_drv_qspi_cinstr_xfer (nrf_qspi_cinstr_conf_t const *p_config, void const *p_tx_buffer, void *p_rx_buffer) |
| Function for sending operation code, sending data, and receiving data from the memory device. More...
|
|
ret_code_t | nrf_drv_qspi_cinstr_quick_send (uint8_t opcode, nrf_qspi_cinstr_len_t length, void const *p_tx_buffer) |
| Function for sending operation code and data to the memory device with simpler configuration. More...
|
|
nRF52840 only: Quad serial peripheral interface (QSPI) driver.
#define NRF_DRV_QSPI_DEFAULT_CINSTR |
( |
|
opc, |
|
|
|
len |
|
) |
| |
Value:{ \
.opcode = (opc), \
.length = (len), \
.io2_level = false, \
.io3_level = false, \
.wipwait = false, \
.wren = false \
}
QSPI custom instruction helper with default configuration.
#define NRF_DRV_QSPI_DEFAULT_CONFIG |
Value:{ \
.pins = { \
}, \
.prot_if = { \
.dpmconfig = false, \
}, \
.phy_if = { \
.dpmen = false \
} \
}
QSPI instance default configuration.
QSPI master driver event types, passed to the handler routine provided during initialization.
Enumerator |
---|
NRF_DRV_QSPI_EVENT_DONE |
Transfer done.
|
Function for starting an erase operation of the whole chip.
- Return values
-
NRF_SUCCESS | If the operation was successful (blocking mode) or operation was commissioned (handler mode). |
NRF_ERROR_BUSY | If the driver currently handles another operation. |
Function for sending operation code and data to the memory device with simpler configuration.
Use this function to transfer configuration data to memory and to receive data from memory. This function is a synchronous function and should be used only if necessary.
- Parameters
-
[in] | opcode | Operation code. Sending first. |
[in] | length | Length of the data to send and opcode. See nrf_qspi_cinstr_len_t. |
[in] | p_tx_buffer | Pointer to input data array. |
- Return values
-
NRF_SUCCESS | If the operation was successful. |
NRF_ERROR_BUSY | If the driver currently handles another operation. |
Function for sending operation code, sending data, and receiving data from the memory device.
Use this function to transfer configuration data to memory and to receive data from memory. Pointers can be addresses from flash memory. This function is a synchronous function and should be used only if necessary. See more: Experimental: QSPI.
- Parameters
-
[in] | p_config | Pointer to the structure with opcode and transfer configuration. |
[in] | p_tx_buffer | Pointer to the array with data to send. Can be NULL if only opcode is transmitted. |
[out] | p_rx_buffer | Pointer to the array for data to receive. Can be NULL if there is nothing to receive. |
- Return values
-
NRF_SUCCESS | If the operation was successful. |
NRF_ERROR_BUSY | If the driver currently handles other operation. |
Function for starting erasing of one memory block - 4KB, 64KB, or the whole chip.
Write, read, and erase operations check memory device busy state before starting the operation. If the memory is busy, the resulting action depends on the mode in which the erase operation is used:
- blocking mode (without handler) - a delay occurs until the last operation still runs and until operation data is still being sent.
- interrupt mode (with handler) - event emission occurs after the last operation and sending of operation data are finished. To manually control operation execution in the memory device, use nrf_drv_qspi_mem_busy_check after executing the erase function. Remember that an incoming event signalizes only that data was sent to the memory device and the periheral before the erase operation checked if memory was busy.
- Parameters
-
[in] | length | Size of data to erase. See nrf_qspi_erase_len_t. |
[in] | start_address | Memory address to start erasing. If chip erase is performed, address field is ommited. |
- Return values
-
NRF_SUCCESS | If the operation was successful (blocking mode) or operation was commissioned (handler mode). |
NRF_ERROR_BUSY | If the driver currently handles another operation. |
Function for initializing the QSPI driver instance.
- Parameters
-
[in] | p_config | Pointer to the structure with the initial configuration. |
[in] | handler | Event handler provided by the user. If NULL, transfers will be performed in blocking mode. |
[in] | p_context | Pointer to context. Use in interrupt handler. |
- Return values
-
NRF_SUCCESS | If initialization was successful. |
NRF_ERROR_INVALID_STATE | If the driver was already initialized. |
NRF_ERROR_INVALID_PARAM | If the pin configuration was incorrect. |
Function for getting the current driver status and status byte of memory device with testing WIP (write in progress) bit.
- Return values
-
NRF_SUCCESS | If the driver and memory are ready to handle a new operation. |
NRF_ERROR_BUSY | If the driver or memory currently handle another operation. |
ret_code_t nrf_drv_qspi_read |
( |
void * |
p_rx_buffer, |
|
|
size_t |
rx_buffer_length, |
|
|
uint32_t |
src_address |
|
) |
| |
Function for reading data from QSPI memory.
Write, read, and erase operations check memory device busy state before starting the operation. If the memory is busy, the resulting action depends on the mode in which the read operation is used:
- blocking mode (without handler) - a delay occurs until the last operation still runs and until operation data is still being read.
- interrupt mode (with handler) - event emission occurs after the last operation and reading of data are finished.
- Parameters
-
[out] | p_rx_buffer | Pointer to the receive buffer. |
[in] | rx_buffer_length | Size of the data to read. |
[in] | src_address | Address in memory to read from. |
- Return values
-
NRF_SUCCESS | If the operation was successful (blocking mode) or operation was commissioned (handler mode). |
NRF_ERROR_BUSY | If the driver currently handles another operation. |
NRF_ERROR_INVALID_ADDR | If the provided buffer is not placed in the Data RAM region. |
ret_code_t nrf_drv_qspi_write |
( |
void const * |
p_tx_buffer, |
|
|
size_t |
tx_buffer_length, |
|
|
uint32_t |
dst_address |
|
) |
| |
Function for writing data to QSPI memory.
Write, read, and erase operations check memory device busy state before starting the operation. If the memory is busy, the resulting action depends on the mode in which the write operation is used:
- blocking mode (without handler) - a delay occurs until the last operation still runs and until operation data is still being sent.
- interrupt mode (with handler) - event emission occurs after the last operation and sending of operation data are finished. To manually control operation execution in the memory device, use nrf_drv_qspi_mem_busy_check after executing the write function. Remember that an incoming event signalizes only that data was sent to the memory device and the periheral before the write operation checked if memory was busy.
- Parameters
-
[in] | p_tx_buffer | Pointer to the writing buffer. |
[in] | tx_buffer_length | Size of the data to write. |
[in] | dst_address | Address in memory to write to. |
- Return values
-
NRF_SUCCESS | If the operation was successful (blocking mode) or operation was commissioned (handler mode). |
NRF_ERROR_BUSY | If the driver currently handles other operation. |
NRF_ERROR_INVALID_ADDR | If the provided buffer is not placed in the Data RAM region. |