Skip to content

Commit ec6e865

Browse files
fix QSPI-API for NRF52
1 parent d6784c3 commit ec6e865

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

targets/TARGET_NORDIC/TARGET_NRF5x/qspi_api.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ TODO
7676
// NRF SFDP defines
7777
#define DWORD_LEN 4
7878
#define SFDP_CMD_LEN DWORD_LEN
79-
#define SFDP_DATA_LEN 128 // SFPD data buffer length in bytes, may need to be increased for other flash parts
79+
#define SFDP_DATA_LEN QSPIF_SFDP_DATA_LEN // SFPD data buffer length in bytes, may need to be increased for other flash parts
8080
#define SFDP_READ_LEN 8 // 8 SFDP bytes can be read at a time
8181
#define SFDP_READ_MAX (SFDP_DATA_LEN / SFDP_READ_LEN)
8282

@@ -559,14 +559,9 @@ qspi_status_t sfdp_read(qspi_t *obj, const qspi_command_t *command, void *data,
559559
return QSPI_STATUS_ERROR;
560560
}
561561

562-
// calculate the SFDP data length based on the parameter table offset
563-
// provided at index 12, plus the table length in DWORDS at index 11
564-
uint32_t sfdp_length = sfdp_rx[12] + (sfdp_rx[11] * DWORD_LEN);
565-
566562
// check if the data request is within the SFDP data array
567563
// increase SFDP_DATA_LEN to match sfdp_length, if necessary
568-
if ( sfdp_length <= SFDP_DATA_LEN &&
569-
sfdp_length >= (command->address.value + *length) ) {
564+
if ( SFDP_DATA_LEN >= (command->address.value + *length) ) {
570565
memcpy(data, (sfdp_rx + command->address.value), *length);
571566
return QSPI_STATUS_OK;
572567
} else {

targets/targets.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5568,6 +5568,11 @@
55685568
"uart_1_fifo_size": {
55695569
"help": "UART1 FIFO buffer. FIFO buffer is filled from DMA buffer.",
55705570
"value": 32
5571+
},
5572+
"qspif_sfdp_data_len": {
5573+
"help": "length of Flash SFDP DATA",
5574+
"value": 128,
5575+
"macro_name": "QSPIF_SFDP_DATA_LEN"
55715576
}
55725577
},
55735578
"overrides": {

0 commit comments

Comments
 (0)