Skip to content

Commit dc57efb

Browse files
committed
Read 5 bytes of chip ID
1 parent 12e929e commit dc57efb

File tree

6 files changed

+14
-10
lines changed

6 files changed

+14
-10
lines changed

firmware/fsmc_nand.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,13 @@ void nand_read_id(nand_id_t *nand_id)
122122

123123
/* Sequence to read ID from NAND flash */
124124
data = *(__IO uint32_t *)(Bank_NAND_ADDR | DATA_AREA);
125+
nand_id->maker_id = ADDR_1st_CYCLE(data);
126+
nand_id->device_id = ADDR_2nd_CYCLE(data);
127+
nand_id->third_id = ADDR_3rd_CYCLE(data);
128+
nand_id->fourth_id = ADDR_4th_CYCLE(data);
125129

126-
nand_id->maker_id = ADDR_1st_CYCLE (data);
127-
nand_id->device_id = ADDR_2nd_CYCLE (data);
128-
nand_id->third_id = ADDR_3rd_CYCLE (data);
129-
nand_id->fourth_id = ADDR_4th_CYCLE (data);
130+
data = *((__IO uint32_t *)(Bank_NAND_ADDR | DATA_AREA) + 1);
131+
nand_id->fifth_id = ADDR_1st_CYCLE(data);
130132
}
131133

132134
void nand_write_page_async(uint8_t *buf, uint32_t page, uint32_t page_size)

firmware/fsmc_nand.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ typedef struct
1414
uint8_t device_id;
1515
uint8_t third_id;
1616
uint8_t fourth_id;
17+
uint8_t fifth_id;
1718
} nand_id_t;
1819

1920
#define CMD_AREA (uint32_t)(1<<16) /* A16 = CLE high */

firmware/nand_programmer.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,9 +301,9 @@ static int _np_cmd_nand_read_id(np_prog_t *prog)
301301
if (np_comm_cb)
302302
np_comm_cb->send((uint8_t *)&resp, resp_len);
303303

304-
DEBUG_PRINT("Chip ID: 0x%x 0x%x 0x%x 0x%x\r\n",
304+
DEBUG_PRINT("Chip ID: 0x%x 0x%x 0x%x 0x%x 0x%x\r\n",
305305
resp.nand_id.maker_id, resp.nand_id.device_id, resp.nand_id.third_id,
306-
resp.nand_id.fourth_id);
306+
resp.nand_id.fourth_id, resp.nand_id.fifth_id);
307307

308308
return 0;
309309
}

qt/cmd.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ typedef struct __attribute__((__packed__))
120120
uint8_t deviceId;
121121
uint8_t thirdId;
122122
uint8_t fourthId;
123+
uint8_t fifthId;
123124
} ChipId;
124125

125126
typedef struct __attribute__((__packed__))

qt/main_window.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,8 @@ void MainWindow::slotProgReadDeviceIdCompleted(int status)
236236
if (status)
237237
return;
238238

239-
idStr.sprintf("0x%02X 0x%02X 0x%02X 0x%02X", chipId.makerId,
240-
chipId.deviceId, chipId.thirdId, chipId.fourthId);
239+
idStr.sprintf("0x%02X 0x%02X 0x%02X 0x%02X 0x%02X", chipId.makerId,
240+
chipId.deviceId, chipId.thirdId, chipId.fourthId, chipId.fifthId);
241241
ui->deviceValueLabel->setText(idStr);
242242

243243
qInfo() << QString("ID ").append(idStr).toLatin1().data();

qt/main_window.ui

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
</property>
6666
<property name="minimumSize">
6767
<size>
68-
<width>150</width>
68+
<width>190</width>
6969
<height>0</height>
7070
</size>
7171
</property>
@@ -165,7 +165,7 @@
165165
<bool>false</bool>
166166
</attribute>
167167
</widget>
168-
<widget class="QWidget" name="">
168+
<widget class="QWidget" name="layoutWidget">
169169
<layout class="QGridLayout" name="gridLayout_2" rowstretch="0,0" columnstretch="0" rowminimumheight="0,0" columnminimumwidth="0">
170170
<property name="sizeConstraint">
171171
<enum>QLayout::SetDefaultConstraint</enum>

0 commit comments

Comments
 (0)